diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7881344 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,53 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + # whitespace + - id: trailing-whitespace + - id: mixed-line-ending + args: ['--fix', 'lf'] + exclude: '.*\.(svg)$' + - id: check-byte-order-marker + # file format and permissions + - id: check-ast + - id: debug-statements + - id: check-json + files: .*\.json$ + - id: check-yaml + files: .*\.(yaml|yml)$ + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + # git + - id: check-added-large-files + - id: check-case-conflict + - id: detect-private-key + - id: check-merge-conflict + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.5 + hooks: + - id: remove-tabs + exclude: '.*\.(svg)$' + - repo: https://opendev.org/openstack/hacking + rev: 7.0.0 + hooks: + - id: hacking + additional_dependencies: [] + exclude: '^(doc|releasenotes|tools)/.*$' + - repo: https://github.com/sphinx-contrib/sphinx-lint + rev: v1.0.0 + hooks: + - id: sphinx-lint + args: [--enable=default-role] + files: ^doc + types: [rst] + - repo: https://github.com/PyCQA/doc8 + rev: v1.1.2 + hooks: + - id: doc8 + - repo: https://github.com/openstack/bashate + rev: 2.1.1 + hooks: + - id: bashate + entry: bashate -v -iE006,E040 + types: [shell] diff --git a/README.rst b/README.rst index 6bbb24f..fdb84fe 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,8 @@ Devstack Prometheus Plugin Overview -------- -Devstack plugin to configure prometheus, node-exporter, pushgateway and alertmanager. +Devstack plugin to configure prometheus, node-exporter, pushgateway +and alertmanager. Usage ----- diff --git a/tox.ini b/tox.ini index cc5c72f..36f7845 100644 --- a/tox.ini +++ b/tox.ini @@ -8,18 +8,10 @@ usedevelop = False install_command = pip install {opts} {packages} [testenv:linters] -deps = bashate -allowlist_externals = bash -commands = bash -c "find {toxinidir} \ - -not \( -type d -name .?\* -prune \) \ - -not \( -type d -name doc -prune \) \ - -type f \ - -not -name \*~ \ - -not -name \*.md \ - \( \ - -name \*.sh -or \ - -name \*rc -or \ - -name functions\* -or \ - -wholename \*/lib/\* \ - \) \ - -print0 | xargs -0 bashate -v -iE006,E040" +description = + Run style checks. +skip_install = true +deps = + pre-commit +commands = + pre-commit run --all-files --show-diff-on-failure