lint: Replace Flake8 with Ruff.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
61abe11c1a
commit
01a27a3a1b
5 changed files with 9 additions and 66 deletions
63
.flake8
63
.flake8
|
@ -1,63 +0,0 @@
|
|||
[flake8]
|
||||
ignore =
|
||||
# Each of these rules are ignored for the explained reason.
|
||||
|
||||
# "whitespace before ':'"
|
||||
# Black disagrees with this.
|
||||
E203,
|
||||
|
||||
# "multiple spaces before operator"
|
||||
# There are several typos here, but also several instances that are
|
||||
# being used for alignment in dict keys/values using the `dict`
|
||||
# constructor. We could fix the alignment cases by switching to the `{}`
|
||||
# constructor, but it makes fixing this rule a little less
|
||||
# straightforward.
|
||||
E221,
|
||||
|
||||
# 'missing whitespace around arithmetic operator'
|
||||
# This should possibly be cleaned up, though changing some of
|
||||
# these may make the code less readable.
|
||||
E226,
|
||||
|
||||
# "unexpected spaces around keyword / parameter equals"
|
||||
# Many of these should be fixed, but many are also being used for
|
||||
# alignment/making the code easier to read.
|
||||
E251,
|
||||
|
||||
# "block comment should start with '#'"
|
||||
# These serve to show which lines should be changed in files customized
|
||||
# by the user. We could probably resolve one of E265 or E266 by
|
||||
# standardizing on a single style for lines that the user might want to
|
||||
# change.
|
||||
E265,
|
||||
|
||||
# "too many leading '#' for block comment"
|
||||
# Most of these are there for valid reasons.
|
||||
E266,
|
||||
|
||||
# "expected 2 blank lines after class or function definition"
|
||||
# Zulip only uses 1 blank line after class/function
|
||||
# definitions; the PEP-8 recommendation results in super sparse code.
|
||||
E302, E305,
|
||||
|
||||
# "module level import not at top of file"
|
||||
# Most of these are there for valid reasons, though there might be a
|
||||
# few that could be eliminated.
|
||||
E402,
|
||||
|
||||
# "line too long"
|
||||
# Zulip is a bit less strict about line length, and has its
|
||||
# own check for this (see max_length)
|
||||
E501,
|
||||
|
||||
# "line break before binary operator"
|
||||
# This was obsoleted in favor of the opposite W504.
|
||||
W503,
|
||||
|
||||
# "do not assign a lambda expression, use a def"
|
||||
# Fixing these would probably reduce readability in most cases.
|
||||
E731,
|
||||
|
||||
exclude =
|
||||
# third-party
|
||||
zulip/integrations/perforce/git_p4.py,
|
|
@ -91,3 +91,9 @@ pythonpath = [
|
|||
"zulip_bots",
|
||||
"zulip_botserver",
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
ignore = [
|
||||
"E402", # Module level import not at top of file
|
||||
"E731", # Do not assign a `lambda` expression, use a `def`
|
||||
]
|
||||
|
|
|
@ -2,10 +2,10 @@ crayons
|
|||
twine
|
||||
black~=23.10.1
|
||||
isort
|
||||
flake8
|
||||
mock
|
||||
pytest
|
||||
pytest-cov
|
||||
ruff~=0.1.3
|
||||
-e ./zulip
|
||||
-e ./zulip_bots
|
||||
-e ./zulip_botserver
|
||||
|
|
|
@ -33,7 +33,7 @@ def run() -> None:
|
|||
description="Static type checker for Python (config: mypy.ini)",
|
||||
)
|
||||
linter_config.external_linter(
|
||||
"flake8", ["flake8"], ["py"], description="Standard Python linter (config: .flake8)"
|
||||
"ruff", ["ruff", "check", "--quiet"], ["py"], fix_arg="--fix", description="Python linter"
|
||||
)
|
||||
linter_config.external_linter(
|
||||
"gitlint", ["tools/lint-commits"], description="Git Lint for commit messages"
|
||||
|
|
|
@ -145,7 +145,7 @@ def check_take_mode(response, topic_name, merels_storage):
|
|||
:param merels_storage: Merels' storage
|
||||
:return: None
|
||||
"""
|
||||
if not ("Failed" in response):
|
||||
if "Failed" not in response:
|
||||
if mechanics.can_take_mode(topic_name, merels_storage):
|
||||
mechanics.update_toggle_take_mode(topic_name, merels_storage)
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue