@@ -26,6 +26,7 @@ exclude = [
2626]
2727
2828[tool .ruff .lint ]
29+ future-annotations = true
2930# Disable all rules on test cases by default:
3031# test cases often deliberately contain code
3132# that might not be considered idiomatic or modern.
@@ -69,15 +70,22 @@ select = [
6970 # Only include flake8-annotations rules that are autofixable. Otherwise leave this to mypy+pyright
7071 " ANN2" ,
7172 # Most refurb rules are in preview and can be opinionated,
72- # consider them individually as they come out of preview (last check: 0.8.4 )
73+ # consider them individually as they come out of preview (last check: 0.13.1 )
7374 " FURB105" , # Unnecessary empty string passed to `print`
75+ " FURB116" , # Replace `{function_name}` call with `{display}`
76+ " FURB122" , # Use of `{}.write` in a for loop
7477 " FURB129" , # Instead of calling `readlines()`, iterate over file object directly
78+ " FURB132" , # Use `{suggestion}` instead of `check` and `remove`
7579 " FURB136" , # Replace `if` expression with `{min_max}` call
80+ " FURB157" , # Verbose expression in `Decimal` constructor
81+ " FURB162" , # Unnecessary timezone replacement with zero offset
82+ " FURB166" , # Use of `int` with explicit `base={base}` after removing prefix
7683 " FURB167" , # Use of regular expression alias `re.{}`
7784 " FURB168" , # Prefer `is` operator over `isinstance` to check if an object is `None`
7885 " FURB169" , # Compare the identities of `{object}` and None instead of their respective types
7986 " FURB177" , # Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups
8087 " FURB187" , # Use of assignment of `reversed` on list `{name}`
88+ " FURB188" , # Prefer `str.removeprefix()` over conditionally replacing with slice.
8189 # Used for lint.flake8-import-conventions.aliases
8290 " ICN001" , # `{name}` should be imported as `{asname}`
8391 # PYI: only enable rules that have autofixes and that we always want to fix (even manually),
@@ -89,6 +97,7 @@ select = [
8997 " PYI014" , # Only simple default values allowed for arguments
9098 " PYI015" , # Only simple default values allowed for assignments
9199 " PYI016" , # Duplicate union member `{}`
100+ " PYI018" , # Private `{type_var_like_kind}` `{type_var_like_name}` is never used
92101 " PYI019" , # Methods like `{method_name}` should return `Self` instead of a custom `TypeVar`
93102 " PYI020" , # Quoted annotations should not be included in stubs
94103 " PYI025" , # Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
@@ -99,7 +108,8 @@ select = [
99108 " PYI044" , # `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics
100109 " PYI055" , # Multiple `type[T]` usages in a union. Combine them into one, e.g., `type[{union_str}]`.
101110 " PYI058" , # Use `{return_type}` as the return value for simple `{method}` methods
102- # "PYI061", # TODO: Enable when out of preview
111+ # "PYI059", # TODO: Add when dropping Python 3.9 support
112+ " PYI061" , # Use `None` rather than `Literal[None]`
103113 " PYI062" , # Duplicate literal member `{}`
104114 " PYI064" , # `Final[Literal[{literal}]]` can be replaced with a bare Final
105115 # flake8-simplify, excluding rules that can reduce performance or readability due to long line formatting
@@ -124,6 +134,7 @@ select = [
124134 " SIM223" , # Use `{expr}` instead of `{replaced}`
125135 " SIM300" , # Yoda condition detected
126136 " SIM401" , # Use `{contents}` instead of an if block
137+ " SIM905" , # Consider using a list literal instead of `str.{}`
127138 " SIM910" , # Use `{expected}` instead of `{actual}` (dict-get-with-none-default)
128139 " SIM911" , # Use `{expected}` instead of `{actual}` (zip-dict-keys-and-values)
129140 # Don't include TC rules that create a TYPE_CHECKING block or stringifies annotations
@@ -159,7 +170,7 @@ ignore = [
159170 # see https://github.com/astral-sh/ruff/issues/6465
160171 " E721" , # Do not compare types, use `isinstance()`
161172 # Highly opinionated, and it's often necessary to violate it
162- " PLC0415" , # `import` should be at the top-level of a file
173+ " PLC0415" , # `import` should be at the top-level of a file
163174 # Leave the size and complexity of tests to human interpretation
164175 " PLR09" , # Too many ...
165176 # Too many magic number "2" that are preferable inline. https://github.com/astral-sh/ruff/issues/10009
@@ -175,9 +186,6 @@ ignore = [
175186 " TD003" , # Missing issue link for this TODO
176187 # Mostly from scripts and tests, it's ok to have messages passed directly to exceptions
177188 " TRY003" , # Avoid specifying long messages outside the exception class
178- # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871
179- " UP038" , # Use `X | Y` in `isinstance` call instead of `(X, Y)`
180- " PLC0205" , # Sometimes __slots__ really is a string at runtime
181189 # ##
182190 # False-positives, but already checked by type-checkers
183191 # ##
@@ -208,6 +216,8 @@ ignore = [
208216 # Most pep8-naming rules don't apply for third-party stubs like typeshed.
209217 # N811 to N814 could apply, but we often use them to disambiguate a name whilst making it look like a more common one
210218 " N8" , # pep8-naming
219+ # Sometimes __slots__ really is a string at runtime
220+ " PLC0205" , # Class `__slots__` should be a non-string iterable
211221 # Stubs are allowed to use private variables (pyright's reportPrivateUsage is also disabled)
212222 " PLC2701" , # Private name import from external module
213223 # Names in stubs should match implementation
0 commit comments