puppet-lint: Include in linter tool chain to run by default.

We start to use puppet-lint to lint puppet modules by default by
adding it to tools/lint (which controls our linter tool chain).

We also define a few puppet-lint rules to exclude.

Fixes: #9185.
This commit is contained in:
Aditya Bansal 2018-08-07 17:56:46 +05:30 committed by Tim Abbott
parent 56d49980de
commit a3b8ab46b3
2 changed files with 15 additions and 1 deletions

View File

@ -42,7 +42,7 @@ def run():
sys.path.insert(0, root_dir)
from tools.linter_lib.custom_check import build_custom_checkers
from tools.linter_lib.exclude import EXCLUDED_FILES
from tools.linter_lib.exclude import EXCLUDED_FILES, PUPPET_CHECK_RULES_TO_EXCLUDE
from tools.linter_lib.pyflakes import check_pyflakes
from tools.linter_lib.pep8 import check_pep8
@ -92,6 +92,8 @@ def run():
linter_config.external_linter('tslint', ['node', 'node_modules/.bin/tslint', '-c',
'static/ts/tslint.json'], ['ts'])
linter_config.external_linter('puppet', ['puppet', 'parser', 'validate'], ['pp'])
linter_config.external_linter('puppet-lint',
['puppet-lint'] + PUPPET_CHECK_RULES_TO_EXCLUDE, ['pp'])
linter_config.external_linter('templates', ['tools/check-templates'], ['handlebars', 'html'])
linter_config.external_linter('urls', ['tools/check-urls'], ['py'])
linter_config.external_linter('swagger', ['node', 'tools/check-swagger'], ['yaml'])

View File

@ -3,9 +3,21 @@ EXCLUDED_FILES = [
# Third-party code that doesn't match our style
"puppet/apt/.forge-release",
"puppet/apt/README.md",
"puppet/apt/manifests/backports.pp",
"puppet/apt/manifests/params.pp",
"puppet/apt/manifests/unattended_upgrades.pp",
"puppet/stdlib/tests/file_line.pp",
"static/third",
# Transifex syncs translation.json files without trailing
# newlines; there's nothing other than trailing newlines we'd be
# checking for in these anyway.
"static/locale",
]
PUPPET_CHECK_RULES_TO_EXCLUDE = [
"--no-arrow_alignment-check",
"--no-double_quoted_strings-check",
"--no-2sp_soft_tabs-check",
"--no-documentation-check",
"--no-80chars-check",
]