From 9159a9f9fc89d8aecbb925cac8d69e1b0bfac9af Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 26 Oct 2023 16:56:24 -0700 Subject: [PATCH] Remove pyflakes and pycodestyle integration. Signed-off-by: Anders Kaseorg --- README.md | 2 +- setup.py | 2 -- zulint/linters.py | 50 ++--------------------------------------------- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index c96a162..cc6e46a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ applications using a mix of third-party linters and custom rules. Modern full-stack web applications generally involve code written in several programming languages, each of which have their own standard linter tools. For example, [Zulip](https://zulip.com) uses Python -(mypy/pyflake/pycodestyle), JavaScript (eslint), CSS (stylelint), +(mypy, Ruff), JavaScript (eslint), CSS (stylelint), puppet (puppet-lint), shell (shellcheck), and several more. For many codebases, this results in linting being an unpleasantly slow experience, resulting in even more unpleasant secondary problems like diff --git a/setup.py b/setup.py index fa43102..2cf4483 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,6 @@ VERSION = "1.0.0" REQUIRED = [ - "pyflakes", - "pycodestyle", "typing-extensions", ] diff --git a/zulint/linters.py b/zulint/linters.py index ca75dec..4461484 100644 --- a/zulint/linters.py +++ b/zulint/linters.py @@ -1,9 +1,8 @@ -import argparse import signal import subprocess -from typing import Callable, Sequence, Tuple +from typing import Callable, Sequence -from zulint.printer import colors, print_err +from zulint.printer import print_err def run_command( @@ -29,48 +28,3 @@ def run_command( signal_name = f"signal {-p.returncode}" print_err(name, color, f"{command[0]} terminated by {signal_name}") return p.returncode - - -def run_pycodestyle(files: Sequence[str], ignored_rules: Sequence[str]) -> bool: - if len(files) == 0: - return False - - command = [ - "pycodestyle", - "--ignore={rules}".format(rules=",".join(ignored_rules)), - "--", - *files, - ] - return run_command("pep8", next(colors), command) != 0 - - -def run_pyflakes( - files: Sequence[str], - options: argparse.Namespace, - suppress_patterns: Sequence[Tuple[str, str]] = [], -) -> bool: - if len(files) == 0: - return False - failed = False - color = next(colors) - with subprocess.Popen( - ["pyflakes", "--", *files], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - universal_newlines=True, - ) as pyflakes: - # Implied by use of subprocess.PIPE - assert pyflakes.stdout is not None - assert pyflakes.stderr is not None - - def suppress_line(line: str) -> bool: - for file_pattern, line_pattern in suppress_patterns: - if file_pattern in line and line_pattern in line: - return True - return False - - for ln in pyflakes.stdout.readlines() + pyflakes.stderr.readlines(): - if not suppress_line(ln): - print_err("pyflakes", color, ln) - failed = True - return failed