lint: Add descriptions for all the linters.

This commit is contained in:
Aman Agrawal 2019-06-22 00:07:06 +05:30 committed by Tim Abbott
parent 6d42b2392b
commit 8eee19a160
1 changed files with 32 additions and 10 deletions

View File

@ -51,31 +51,50 @@ def run():
'frontend': ['js', 'ts', 'css', 'scss', 'handlebars', 'html'],
}, exclude=EXCLUDED_FILES)
linter_config.external_linter('add_class', ['tools/find-add-class'], ['js'])
linter_config.external_linter('css', ['node', 'node_modules/.bin/stylelint'], ['css', 'scss'])
linter_config.external_linter('add_class', ['tools/find-add-class'], ['js'],
description="Compares addClass() between JavaSsript and CSS.")
linter_config.external_linter('css', ['node', 'node_modules/.bin/stylelint'], ['css', 'scss'],
description="Standard CSS style and formatting linter "
"(config: .stylelintrc)")
linter_config.external_linter('eslint', ['node', 'node_modules/.bin/eslint',
'--quiet', '--cache', '--ext', '.js,.ts'], ['js', 'ts'])
linter_config.external_linter('puppet', ['puppet', 'parser', 'validate'], ['pp'])
'--quiet', '--cache', '--ext', '.js,.ts'], ['js', 'ts'],
description="Standard JavaScript style and formatting linter"
"(config: .eslintrc).")
linter_config.external_linter('puppet', ['puppet', 'parser', 'validate'], ['pp'],
description="Runs the puppet parser validator, "
"checking for syntax errors.")
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('swagger', ['node', 'tools/check-swagger'], ['yaml'])
linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'])
['puppet-lint'] + PUPPET_CHECK_RULES_TO_EXCLUDE, ['pp'],
description="Standard puppet linter"
"(config: tools/linter_lib/exclude.py)")
linter_config.external_linter('templates', ['tools/check-templates'], ['handlebars', 'html'],
description="Custom linter checks whitespace formatting"
"of HTML templates.")
linter_config.external_linter('swagger', ['node', 'tools/check-swagger'], ['yaml'],
description="Validates our OpenAPI/Swagger API documentation"
"(zerver/openapi/zulip.yaml) ")
linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'],
description="Standard shell script linter.")
command = ['tools/run-mypy']
if args.force:
command.append('--force')
linter_config.external_linter('mypy', command, ['py'], pass_targets=False)
linter_config.external_linter('gitlint', ['tools/commit-message-lint'])
linter_config.external_linter('mypy', command, ['py'], pass_targets=False,
description="Static type checker for Python (config: mypy.ini)")
linter_config.external_linter('gitlint', ['tools/commit-message-lint'],
description="Checks commit messages for common formatting errors."
"(config: .gitlint)")
@linter_config.lint
def custom_py():
# type: () -> int
"""Runs custom checks for python files (config: tools/linter_lib/custom_check.py)"""
failed = python_rules.check(by_lang)
return 1 if failed else 0
@linter_config.lint
def custom_nonpy():
# type: () -> int
"""Runs custom checks for non-python files (config: tools/linter_lib/custom_check.py)"""
failed = False
for rule in non_py_rules:
failed = failed or rule.check(by_lang)
@ -84,6 +103,7 @@ def run():
@linter_config.lint
def pyflakes():
# type: () -> int
"""Standard Python bug and code smell linter (config: tools/linter_lib/pyflakes.py)"""
failed = check_pyflakes(by_lang['py'], args)
return 1 if failed else 0
@ -93,12 +113,14 @@ def run():
@linter_config.lint
def pep8_1of2():
# type: () -> int
"""Standard Python style linter on 50% of files (config: tools/linter_lib/pep8.py)"""
failed = check_pep8(list(python_part1))
return 1 if failed else 0
@linter_config.lint
def pep8_2of2():
# type: () -> int
"""Standard Python style linter on other 50% of files (config: tools/linter_lib/pep8.py)"""
failed = check_pep8(list(python_part2))
return 1 if failed else 0