Use some better linting

Lints docs and yaml files in addition to Python.

This also fixes the encountered issues.

Change-Id: I111cc93939ae4cd2e878e7f863c1a45db51cdbbe
This commit is contained in:
Radosław Piliszek 2021-08-17 18:04:16 +00:00
parent 80ee534f40
commit 18c79eb0ca
4 changed files with 54 additions and 1 deletions

8
.yamllint Normal file
View File

@ -0,0 +1,8 @@
---
extends: default
ignore: |
.tox/
rules:
line-length: disable

View File

@ -1,3 +1,4 @@
---
- project:
templates:
- check-requirements
@ -6,3 +7,9 @@
- release-notes-jobs-python3
- periodic-stable-jobs
- periodic-jobs-with-oslo-master
check:
jobs:
- openstack-tox-linters
gate:
jobs:
- openstack-tox-linters

View File

@ -4,7 +4,7 @@ masakari-monitors Style Commandments
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
masakari-monitors Specific Commandments
------------------------------
---------------------------------------
- [M301] Ensure that the _() function is explicitly imported to ensure proper translations.
- [M302] Validate that log messages are not translated.

38
tox.ini
View File

@ -21,9 +21,42 @@ passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OS_DEB
[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/masakarimonitors/masakarimonitors-config-generator.conf
[testenv:linters]
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
{[testenv:pep8]deps}
{[testenv:doc8]deps}
{[testenv:yamllint]deps}
commands =
{[testenv:pep8]commands}
{[testenv:doc8]commands}
{[testenv:yamllint]commands}
[testenv:pep8]
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
hacking
commands = flake8 {posargs}
[testenv:doc8]
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
doc8
commands =
doc8 README.rst CONTRIBUTING.rst HACKING.rst doc/source
doc8 releasenotes/source
doc8 -e '.yaml' releasenotes/notes
[testenv:yamllint]
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
yamllint
commands = yamllint -s .
[testenv:venv]
commands = {posargs}
@ -94,3 +127,8 @@ paths = ./masakarimonitors/hacking
deps = bindep
commands = bindep test
usedevelop = False
[doc8]
# NOTE(yoctozepto): this is due to multiple violations - it is better to keep
# it limited sanely rather than disable the D001 "Line too long" rule altogether
max-line-length = 105