Skip to content

Commit

Permalink
Update Ruff configuration for 0.0.284
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Aug 13, 2023
1 parent 6cd8723 commit 9bf0f49
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: python -m pip install --upgrade pip

- name: Install known good Ruff
run: python -m pip install ruff==0.0.261
run: python -m pip install ruff==0.0.284
- name: Lint with known good Ruff
run: ruff . --diff --format github

Expand Down
64 changes: 62 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,26 @@ exclude = [
]
ignore = [
# pycodestyle
"E741",
"E721", # do not compare types, use isinstance()
"E741", # ambiguous variable name
"F821", # undefined name
"W291", # trailing whitespace
# flake8-builtins
"A001", # variable is shadowing a python builtin
"A002", # argument is shadowing a python builtin
"A003", # class attribute is shadowing a python builtin
# flake8-annotations
"ANN",
"ANN001", # missing type annotation for function argument
"ANN002", # missing type annotation for *args
"ANN003", # missing type annotation for **kwargs
"ANN101", # missing type annotation for self in method
"ANN102", # missing type annotation for cls in classmethod
"ANN201", # missing type annotation for public function
"ANN202", # missing type annotation for private function
"ANN204", # missing type annotation for special method
"ANN205", # missing type annotation for static method
"ANN206", # missing type annotation for classmethod
"ANN401", # dynamically typed expressions (typing.Any) are disallowed
# flake8-unused-arguments
"ARG001", # unused function argument
"ARG002", # unused method argument
Expand All @@ -172,10 +185,20 @@ ignore = [
"DJ", # Django is not used in Sphinx
# eradicate
"ERA001", # found commented-out code
# flake8-future-annotations
"FA100", # missing from __future__ import annotations
"FA102", # missing from __future__ import annotations
# flake8-boolean-trap
"FBT001", # boolean positional arg in function definition
"FBT002", # boolean default value in function definition
"FBT003", # boolean positional value in function call
# flake8-fixme
"FIX001", # line contains FIXME
"FIX002", # line contains TODO
"FIX003", # line contains XXX
"FIX004", # line contains HACK
# flynt
"FLY002", # Consider f-string instead of string join
# flake8-logging-format
"G002", # logging statement uses `%`
"G003", # logging statement uses `+`
Expand All @@ -189,10 +212,20 @@ ignore = [
"NPY", # numpy is not used in Sphinx
# pandas-vet
"PD", # pandas is not used in Sphinx
# Perflint
"PERF101", # do not cast an iterable to list before iterating over it
"PERF102", # use either dict.keys() or dict.values()
"PERF203", # try-except within a loop incurs performance overhead
"PERF401", # Use a list comprehension to create a transformed list
"PERF402", # Use list or list.copy to create a copy of a list
# flake8-pie
"PIE790", # unnecessary 'pass' statement
# pylint
"PLC0205", # Class __slots__ should be a non-string iterable
"PLC0208", # Use a sequence type instead of a set when iterating over values
"PLC1901", # simplify truthy/falsey string comparisons
"PLR0124", # Name compared with itself
"PLR1714", # Consider merging multiple comparisons
"PLR2004", # avoid magic values
"PLR0911", # too many return statements
"PLR0912", # too many branches
Expand All @@ -203,42 +236,66 @@ ignore = [
"PLW2901", # outer loop variable overwritten by inner assignment
# flake8-use-pathlib
"PTH",
# flake8-pyi
"PYI",
# flake8-quotes
"Q000", # double quotes found but single quotes preferred
"Q001", # single quote docstring found but double quotes preferred
# flake8-return
"RET503", # missing explicit return at the end of function able to return non-None value
"RET504", # unnecessary variable assignment before `return` statement
"RET505", # unnecessary `else` after `return` statement
"RET506", # Unnecessary {branch} after raise statement
# Ruff-specific rules
"RUF001", # string contains ambiguous unicode character
"RUF003", # comment contains ambiguous unicode character
"RUF005", # consider unpacking instead of concatenation
"RUF012", # mutable class attributes should be annotated with typing.ClassVar
"RUF013", # PEP 484 prohibits implicit Optional
"RUF015", # prefer next({iterable}) over single element slice
"RUF100", # unused noqa directive
# flake8-bandit
"S101", # assert used
"S105", # possible hardcoded password
"S110", # try/except/pass detected
"S113", # probable use of requests call without timeout
"S301", # 'pickle' unsafe when loading untrusted data
"S307", # use of possibly insecure function (eval)
"S324", # probable use of insecure hash functions
"S603", # subprocess call: check for execution of untrusted input
"S607", # Starting a process with a partial executable path
"S701", # use autoescape=True for Jinja
# flake8-simplify
"SIM102", # nested 'if' statements
"SIM103", # return condition directly
"SIM105", # use contextlib.suppress
"SIM108", # use ternary operator
"SIM114", # combine if branches using logical or operator
"SIM115", # use context handler for opening files
"SIM117", # use single 'with' statement
"SIM118", # use key in dict not key in dict.keys()
# flake8-slots
"SLOT000", # Subclasses of str should define __slots__
"SLOT001", # Subclasses of tuple should define __slots__
"SLOT002", # Subclasses of collections.namedtuple() should define __slots__
# flake8-self
"SLF001", # private member accessed
# flake8-print
"T201", # print found
# flake8-type-checking
"TCH001", # move application import into a type-checking block
"TCH002", # move third-party import into a type-checking block
# flake8-todo
"TD001", # invalid TODO tag
"TD002", # missing author in TODO
"TD003", # missing issue link on the line following this TODO
"TD004", # missing colon in TODO
"TD005", # missing issue description after TODO
# tryceratops
"TRY",
# pyupgrade
"UP031", # replace with format specifiers
"UP032", # use f-string instead of format call
]
external = [ # Whitelist for RUF100 unknown code warnings
"E704",
Expand All @@ -258,6 +315,9 @@ select = [
"sphinx/environment/collectors/toctree.py" = ["B026"]
"sphinx/environment/adapters/toctree.py" = ["B026"]

# Ruff bug: https://github.com/astral-sh/ruff/issues/6540
"sphinx/transforms/i18n.py" = ["PGH004"]

"tests/*" = ["E501"]
# these tests need old ``typing`` generic aliases
"tests/test_util_typing.py" = ["UP006", "UP035"]
Expand Down

0 comments on commit 9bf0f49

Please sign in to comment.