lint: Replace pycodestyle with Flake8.

Flake8 combines pycodestyle with pyflakes and automatically gives us
support for noqa comments, parallelism, configuration files, plugins,
and easy editor integration.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-18 15:11:33 -07:00 committed by Tim Abbott
parent f616b9259e
commit b573c1daf3
4 changed files with 62 additions and 105 deletions

View file

@ -5,7 +5,6 @@ import argparse
from zulint.command import add_default_linter_arguments, LinterConfig
from custom_check import python_rules, non_py_rules
from pep8 import check_pep8
EXCLUDED_FILES = [
# This is an external file that doesn't comply with our codestyle
@ -24,6 +23,8 @@ def run() -> None:
linter_config.external_linter('mypy', ['tools/run-mypy'], ['py'], pass_targets=False,
description="Static type checker for Python (config: mypy.ini)")
linter_config.external_linter('flake8', ['flake8'], ['py'],
description="Standard Python linter (config: .flake8)")
@linter_config.lint
def custom_py() -> int:
@ -39,12 +40,6 @@ def run() -> None:
failed = failed or rule.check(by_lang, verbose=args.verbose)
return 1 if failed else 0
@linter_config.lint
def pep8() -> int:
"""Standard Python style linter on 50% of files (config: tools/linter_lib/pep8.py)"""
failed = check_pep8(by_lang['py'])
return 1 if failed else 0
linter_config.do_lint()
if __name__ == '__main__':