with item formatting for Python 3.8 or older (#10276)pyupgrade] Allow fixes for f-string rule regardless of line length (UP032) (#10263)pycodestyle] Include actual conditions in E712 diagnostics (#10254)with items formatting (#10274)Parameter range for *args and **kwargs (#10283)typing.Annotated subscripts as type definitions (#10285)pycodestyle] Fix E301 not triggering on decorated methods. (#10117)pycodestyle] Respect isort settings in blank line rules (E3*) (#10096)pycodestyle] Make blank lines in typing stub files optional (E3*) (#10098)pylint] Implement singledispatch-method (E1519) (#10140)pylint] Implement useless-exception-statement (W0133) (#10176)flake8-debugger] Check for use of debugpy and ptvsd debug modules (#10177) (#10194)pyupgrade] Generate diagnostic for all valid f-string conversions regardless of line length (UP032) (#10238)pep8_naming] Add fixes for N804 and N805 (#10215)ruff format --diff (#10110)--config and --isolated global flags (#10150)--config (#10219)required-version (#10216)default-section setting (#10149)CapWords message (#10220)flake8-raise] Avoid false-positives for parens-on-raise with future.exception() (RSE102) (#10206)pylint] Add fix for unary expressions in PLC2801 (#9587)ruff] Fix RUF028 not allowing # fmt: skip on match cases (#10178)This release introduces the new Ruff formatter 2024.2 style and adds a new lint rule to detect invalid formatter suppression comments.
flake8-bandit] Remove suspicious-lxml-import (S410) (#10154)pycodestyle] Allow os.environ modifications between imports (E402) (#10066)pycodestyle] Don't warn about a single whitespace character before a comma in a tuple (E203) (#10094)eradicate] Detect commented out case statements (ERA001) (#10055)eradicate] Detect single-line code for try:, except:, etc. (ERA001) (#10057)flake8-boolean-trap] Allow boolean positionals in __post_init__ (#10027)flake8-copyright] Allow © in copyright notices (#10065)isort]: Use one blank line after imports in typing stub files (#9971)pylint] New Rule dict-iter-missing-items (PLE1141) (#9845)pylint] Ignore sys.version and sys.platform (PLR1714) (#10054)pyupgrade] Detect literals with unary operators (UP018) (#10060)ruff] Expand rule for list(iterable).pop(0) idiom (RUF015) (#10148)This release introduces the Ruff 2024.2 style, stabilizing the following changes:
with parentheses when targeting Python 3.9 or newer (#9222)...) in typing stub files (#9155)...) body (#7440, #9240)extend as part of a --config flag (#10135)build from the default exclusion list (#10093)ruff <path>, ruff --explain, ruff --clean, and ruff --generate-shell-completion in favor of ruff check <path>, ruff rule, ruff clean, and ruff generate-shell-completion (#10169)--format from ruff rule and ruff linter (#10170)flake8-bugbear] Avoid adding default initializers to stubs (B006) (#10152)flake8-type-checking] Respect runtime-required decorators for function signatures (#10091)pycodestyle] Mark fixes overlapping with a multiline string as unsafe (W293) (#10049)pydocstyle] Trim whitespace when removing blank lines after section (D413) (#10162)pylint] Delete entire statement, including semicolons (PLR0203) (#10074)ruff] Avoid f-string false positives in gettext calls (RUF027) (#10118)ruff crashing on PowerPC systems because of too small page size (#10080)line-length option: fix link to pycodestyle.max-line-length (#10136)Highlights include:
--preview).--config argument (e.g., --config "lint.isort.combine-as-imports=false").pycodestyle] Add blank line(s) rules (E301, E302, E303, E304, E305, E306) (#9266)refurb] Implement readlines_in_for (FURB129) (#9880)ruff] Ensure closing parentheses for multiline sequences are always on their own line (RUF022, RUF023) (#9793)numpy] Add missing deprecation violations (NPY002) (#9862)flake8-bandit] Detect mark_safe usages in decorators (#9887)ruff] Expand asyncio-dangling-task (RUF006) to include new_event_loop (#9976)flake8-pyi] Ignore ‘unused’ private type dicts in class scopes (#9952)indent-style=tabs (#9915)preserve mode (#9922)show-settings filters directory-agnostic (#9866)DebugText (#9953)flake8-simplify] Avoid false positive with async for loops (SIM113) (#9996)flake8-trio] Respect async with in timeout-without-await (#9859)perflint] Catch a wider range of mutations in PERF101 (#9955)pycodestyle] Fix E30X panics on blank lines with trailing white spaces (#9907)pydocstyle] Allow using parameters as a subsection header (D405) (#9894)pydocstyle] Fix blank-line docstring rules for module-level docstrings (#9878)pylint] Accept 0.0 and 1.0 as common magic values (PLR2004) (#9964)pylint] Avoid suggesting set rewrites for non-hashable types (#9956)ruff] Avoid false negatives with string literals inside of method calls (RUF027) (#9865)ruff] Fix panic on with f-string detection (RUF027) (#9990)ruff] Ignore builtins when detecting missing f-strings (#9849)memchr for string lexing (#9888)memchr for tab-indentation detection (#9853)Result<Tok, LexicalError> size by using Box<str> instead of String (#9885)Expr from 80 to 64 bytes (#9900)This release includes support for range formatting (i.e., the ability to format specific lines within a source file).
__get__ and __set__ from unnecessary-dunder-call (#9791)Protocol in ellipsis removal (#9841)C408 (#9822)C400, C401, C410, and C418 (#9819)AhoCorasick to speed up quote match (#9773)C405 and C409 (#9821)zero-sleep-call (#9766)C403 (#9818)max-pos-args example to max-positional-args (#9797)weak_cryptographic_key.rs (#9774)ANN rules in changelog (#9771)max-positional-args (#9838)NURSERY selector cannot be used anymoreSee also, the “Remapped rules” section which may result in disabled rules.
The following rules are now deprecated:
missing-type-self (ANN101)missing-type-cls (ANN102)The following command line options are now deprecated:
--show-source; use --output-format full instead--no-show-source; use --output-format concise instead--output-format text; use full or concise insteadThe following settings have moved and the previous name is deprecated:
ruff.allowed-confusables → ruff.lint.allowed-confusablesruff.dummy-variable-rgx → ruff.lint.dummy-variable-rgxruff.explicit-preview-rules → ruff.lint.explicit-preview-rulesruff.extend-fixable → ruff.lint.extend-fixableruff.extend-ignore → ruff.lint.extend-ignoreruff.extend-per-file-ignores → ruff.lint.extend-per-file-ignoresruff.extend-safe-fixes → ruff.lint.extend-safe-fixesruff.extend-select → ruff.lint.extend-selectruff.extend-unfixable → ruff.lint.extend-unfixableruff.extend-unsafe-fixes → ruff.lint.extend-unsafe-fixesruff.external → ruff.lint.externalruff.fixable → ruff.lint.fixableruff.flake8-annotations → ruff.lint.flake8-annotationsruff.flake8-bandit → ruff.lint.flake8-banditruff.flake8-bugbear → ruff.lint.flake8-bugbearruff.flake8-builtins → ruff.lint.flake8-builtinsruff.flake8-comprehensions → ruff.lint.flake8-comprehensionsruff.flake8-copyright → ruff.lint.flake8-copyrightruff.flake8-errmsg → ruff.lint.flake8-errmsgruff.flake8-gettext → ruff.lint.flake8-gettextruff.flake8-implicit-str-concat → ruff.lint.flake8-implicit-str-concatruff.flake8-import-conventions → ruff.lint.flake8-import-conventionsruff.flake8-pytest-style → ruff.lint.flake8-pytest-styleruff.flake8-quotes → ruff.lint.flake8-quotesruff.flake8-self → ruff.lint.flake8-selfruff.flake8-tidy-imports → ruff.lint.flake8-tidy-importsruff.flake8-type-checking → ruff.lint.flake8-type-checkingruff.flake8-unused-arguments → ruff.lint.flake8-unused-argumentsruff.ignore → ruff.lint.ignoreruff.ignore-init-module-imports → ruff.lint.ignore-init-module-importsruff.isort → ruff.lint.isortruff.logger-objects → ruff.lint.logger-objectsruff.mccabe → ruff.lint.mccaberuff.pep8-naming → ruff.lint.pep8-namingruff.per-file-ignores → ruff.lint.per-file-ignoresruff.pycodestyle → ruff.lint.pycodestyleruff.pydocstyle → ruff.lint.pydocstyleruff.pyflakes → ruff.lint.pyflakesruff.pylint → ruff.lint.pylintruff.pyupgrade → ruff.lint.pyupgraderuff.select → ruff.lint.selectruff.task-tags → ruff.lint.task-tagsruff.typing-modules → ruff.lint.typing-modulesruff.unfixable → ruff.lint.unfixableThe following rules have been remapped to new codes:
raise-without-from-inside-except: TRY200 to B904suspicious-eval-usage: PGH001 to S307logging-warn: PGH002 to G010static-key-dict-comprehension: RUF011 to B035runtime-string-union: TCH006 to TCH010The following rules have been stabilized and are no longer in preview:
trio-timeout-without-await (TRIO100)trio-sync-call (TRIO105)trio-async-function-with-timeout (TRIO109)trio-unneeded-sleep (TRIO110)trio-zero-sleep-call (TRIO115)unnecessary-escaped-quote (Q004)enumerate-for-loop (SIM113)zip-dict-keys-and-values (SIM911)timeout-error-alias (UP041)flask-debug-true (S201)tarfile-unsafe-members (S202)ssl-insecure-version (S502)ssl-with-bad-defaults (S503)ssl-with-no-version (S504)weak-cryptographic-key (S505)ssh-no-host-key-verification (S507)django-raw-sql (S611)mako-templates (S702)generator-return-from-iter-method (PYI058)runtime-string-union (TCH006)numpy2-deprecation (NPY201)quadratic-list-summation (RUF017)assignment-in-assert (RUF018)unnecessary-key-check (RUF019)never-union (RUF020)direct-logger-instantiation (LOG001)invalid-get-logger-argument (LOG002)exception-without-exc-info (LOG007)undocumented-warn (LOG009)Fixes for the following rules have been stabilized and are now available without preview:
triple-single-quotes (D300)non-pep604-annotation (UP007)dict-get-with-none-default (SIM910)in-dict-keys (SIM118)collapsible-else-if (PLR5501)if-with-same-arms (SIM114)useless-else-on-loop (PLW0120)unnecessary-literal-union (PYI030)unnecessary-spread (PIE800)error-instead-of-exception (TRY400)redefined-while-unused (F811)duplicate-value (B033)multiple-imports-on-one-line (E401)non-pep585-annotation (UP006)Fixes for the following rules have been promoted from unsafe to safe:
unaliased-collections-abc-set-import (PYI025)The following behaviors have been stabilized:
module-import-not-at-top-of-file (E402) allows sys.path modifications between importsreimplemented-container-builtin (PIE807) includes lambdas that can be replaced with dictunnecessary-placeholder (PIE790) applies to unnecessary ellipses (...)if-else-block-instead-of-dict-get (SIM401) applies to if-else expressionsrefurb] Implement metaclass_abcmeta (FURB180) (#9658)blank_line_after_nested_stub_class preview style (#9155)and-or-ternary (PLR1706) was removedflake8-async] Take pathlib.Path into account when analyzing async functions (#9703)flake8-return] - fix indentation syntax error (RET505) (#9705)RUF022, RUF023: never add two trailing commas to the end of a sequence (#9698)RUF023: Don't sort __match_args__, only __slots__ (#9724)flake8-simplify] - Fix syntax error in autofix (SIM114) (#9704)pylint] Show verbatim constant in magic-value-comparison (PLR2004) (#9694)IfExp with dual string arms in invalid-envvar-default (#9734)pylint] Add __mro_entries__ to known dunder methods (PLW3201) (#9706)NURSERY selector is used with --preview (#9682)flake8-return] Add fixes for all rules (RET505, RET506, RET507, RET508) (#9595)flake8-simplify] Add fix for if-with-same-arms (SIM114) (#9591)pycodestyle] Add fix for multiple-imports-on-one-line (E401) (#9518)pylint] Add fix for collapsible-else-if (PLR5501) (#9594)pylint] Add fix for useless-else-on-loop (PLW0120) (#9590)pylint] Implement assigning-non-slot (E0237) (#9623)pylint] Implement potential-index-error (PLE0643) (#9545)pylint] Implement too-many-nested-blocks (PLR1702) (#9172)ruff] Add rule to sort __slots__ and __match_args__ (#9564)ruff] Detect unnecessary dict comprehensions for iterables (RUF025) (#9613)ruff] Guard against use of default_factory as a keyword argument (RUF026) (#9651)ruff] Implement mutable-fromkeys-value (RUF024) (#9597)--help output (#9633)flake8-no-pep420] Include global --config when determining namespace packages (#9603)flake8-pie] Omit bound tuples passed to .startswith or .endswith (#9661)flake8-return] Avoid panic when fixing inlined else blocks (#9657)flake8-return] Consider exception suppression in unnecessary assignment (#9673)flake8-return] Take NoReturn annotation into account when analyzing implicit returns (#9636)flake8-simplify] Support inverted returns in needless-bool (SIM103) (#9619)flake8-type-checking] Add Pydantic's BaseConfig to default-copy list (#9650)flake8-type-checking] Avoid marking InitVar as a typing-only annotation (#9688)pycodestyle] Allow dtype comparisons in type-comparison (#9676)pydocstyle] Re-implement last-line-after-section (D413) (#9654)flake8-pytest-style] Add fix safety documentation for duplicate-parameterize-test-cases (#9678)pylint] Document literal-membership fix safety conditions (#9677)isort] Fix reference to isort rule code (#9598)flake8-bugbear] Add fix for duplicate-value (B033) (#9510)flake8-simplify] Implement enumerate-for-loop (SIM113) (#7777)pygrep_hooks] Add fix for deprecated-log-warn (PGH002) (#9519)pylint] Implement import-private-name (C2701) (#5920)refurb] Implement regex-flag-alias with fix (FURB167) (#9516)ruff] Add rule and fix to sort contents of __all__ (RUF022) (#9474)tryceratops] Add fix for error-instead-of-exception (TRY400) (#9520)flake8-pyi] Fix PYI047 false negatives on PEP-695 type aliases (#9566)flake8-pyi] Fix PYI049 false negatives on call-based TypedDicts (#9567)pylint] Exclude self and cls when counting method arguments (PLR0917) (#9563)--show-settings displays active settings in a far more readable format (#9464)--extension support to the formatter (#9483)pycodestyle] Use the configured tab size when expanding indents (#9506)flake8-simplify] Avoid some more enumerate-for-loop false positives (SIM113) (#9515)pandas-vet] Limit inplace diagnostics to methods that accept inplace (#9495)pylint] Add the __prepare__ method to the list of recognized dunder method (#9529)pylint] Ignore unnecessary dunder calls within dunder definitions (#9496)refurb] Avoid bailing when reimplemented-operator is called on function (FURB118) (#9556)ruff] Avoid treating named expressions as static keys (RUF011) (#9494)noqa with isort rules (#9555)cargo bench -p ruff_benchmark (#9535)emacs-ruff-format (#9403)flake8-blind-except] Document exceptions to blind-except rule (#9580)flake8-simplify] Account for possibly-empty f-string values in truthiness logic (#9484)pylint] Add the missing period in unnecessary-dunder-call (#9485)pylint] Fix __aenter__ message in unnecessary-dunder-call (#9492)flake8-bandit] Add ssl-with-no-version (S504) (#9384)flake8-bandit] Implement ssl-insecure-version (S502) (#9390)flake8-bandit] Implement ssl-with-bad-defaults (S503) (#9391)flake8-bandit] Implement suspicious import rules (S4XX) (#8831)flake8-simplify] Implement zip-dict-keys-and-values (SIM911) (#9460)pyflakes] Add a fix for redefined-while-unused (F811) (#9419)pylint] Implement unnecessary-dunder-call (C2801) (#9166)ruff] Add parenthesize-chained-operators (RUF021) to enforce parentheses in a or b and c (#9440)flake8-boolean-trap] Allow Boolean positional arguments in setters (#9429)flake8-builtins] Restrict builtin-attribute-shadowing (A003) to actual shadowed references (#9462)flake8-pyi] Add fix for generator-return-from-iter-method (PYI058) (#9355)pyflakes] Don't flag redefined-while-unused (F811) in if branches (#9418)pyupgrade] Add some additional Python 3.12 typing members to deprecated-import (#9445)ruff] Add fix for parenthesize-chained-operators (RUF021) (#9449)ruff] Include subscripts and attributes in static key rule (RUF011) (#9416)ruff] Support variable keys in static dictionary key rule (RUF011) (#9411)# fmt: skip with interspersed same-line comments (#9395)None comparisons (#9376)DisplayParseError for stdin parser errors (#9409)comment_ranges for isort directive extraction (#9414)flake8-pyi] Exclude warnings.deprecated and typing_extensions.deprecated arguments (#9423)flake8-pyi] Fix false negative for unused-private-protocol (PYI046) with unused generic protocols (#9405)pydocstyle] Disambiguate argument descriptors from section headers (#9427)pylint] Homogenize PLR0914 message to match other PLR09XX rules (#9399)ruff] Allow Hashable = None in type annotations (RUF013) (#9442)pylint] Implement super-without-brackets (W0245) (#9257)python -m ruff invocations (#9367)dummy_implementations preview style formatting (#9240)with statements (#9222)flake8-pyi] Implement generator-return-from-iter-method (PYI058) (#9313)pylint] Implement empty-comment (PLR2044) (#9174)refurb] Implement bit-count (FURB161) (#9265)ruff] Add never-union rule to detect redundant typing.NoReturn and typing.Never (#9217)asyncio-dangling-task for nonlocal and global bindings (#9263)__str__ definitions from super classes (#9338)unused-noqa via per-file-ignores (#9300)typing_extensions members as typing aliases (#9335)Display for formatter parse errors (#9316)flake8-annotations] Avoid adding return types to stub methods (#9277)flake8-annotations] Respect mixed return and raise cases in return-type analysis (#9310)flake8-bandit] Don't report violations when SafeLoader is imported from yaml.loader (S506) (#9299)pylint] Avoid panic when comment is preceded by Unicode (#9331)pylint] Change PLR0917 error message to match other PLR09XX messages (#9308)refurb] Avoid false positives for math-constant (FURB152) (#9290)perflint] Document PERF102 fix un-safety (#9351)pyupgrade] Document UP007 fix un-safety (#9306)pylint] Implement too-many-locals (PLR0914) (#9163)reimplemented_operator (FURB118) (#9171)no_blank_line_before_class_docstring preview style (#9154)CONSTANT_CASE variables are improperly flagged for yoda violation (SIM300) (#9164)flake8-pyi] Cover ParamSpecs and TypeVarTuples (PYI018) (#9198)flake8-bugbear] Add fix for zip-without-explicit-strict (B905) (#9176)print and pprint statements (T201, T203) (#9208)Never to NoReturn in auto-typing in Python >= 3.11 (ANN201) (#9213)can_omit_optional_parentheses: Exit early for unparenthesized expressions (#9125)dynamic mode with doctests so that it doesn't exceed configured line width (#9129)can_omit_optional_parentheses for expressions with a right most fstring (#9124)target_version to formatter options (#9220)ruff format --check to display message for already formatted files (#9153)operator.contains (#9192)D208 with multibyte indent (#9147)NoReturn in auto-return-typing (#9206)typing from exempt-modules (#9214)mutable-class-default violations for Pydantic subclasses (#9187)PYI055 autofix (#9161)asyncio-dangling-task violations on shadowed bindings (#9215)This release includes opt-in support for formatting Python snippets within docstrings via the docstring-code-format setting. Check out the blog post for more details!
"preserve" quote-style to mimic Black's skip-string-normalization (#8822)prefer_splitting_right_hand_side_of_assignments preview style (#8943)pycodestyle] Add fix for unexpected-spaces-around-keyword-parameter-equals (#9072)pycodestyle] Add fix for comment-related whitespace rules (#9075)pycodestyle] Allow sys.path modifications between imports (#9047)refurb] Implement hashlib-digest-hex (FURB181) (#9077)flake8-type-checking rules to automatically quote runtime-evaluated references (#6001)flake8-annotations] Avoid ANN2xx fixes for abstract methods with empty bodies (#9034)flake8-self] Ignore underscore references in type annotations (#9036)pep8-naming] Allow class names when apps.get_model is a non-string (#9065)pycodestyle] Allow matplotlib.use calls to intersperse imports (#9094)pyflakes] Support fixing unused assignments in tuples by renaming variables (F841) (#9107)pylint] Add fix for subprocess-run-without-check (PLW1510) (#6708)docstring-code-format knob to enable docstring snippet formatting (#8854)--output-format (#9078)flake8-err-msg] Allow EM fixes even if msg variable is defined (#9059)flake8-pie] Prevent keyword arguments duplication (#8450)flake8-pie] Respect trailing comma in unnecessary-dict-kwargs (PIE804) (#9015)flake8-raise] Avoid removing parentheses on ctypes.WinError (#9027)isort] Avoid invalid combination of force-sort-within-types and lines-between-types (#9041)isort] Ensure that from-style imports are always ordered first in __future__ (#9039)pycodestyle] Allow tab indentation before keyword (#9099)pylint] Ignore @overrides and @overloads for too-many-positional (#9000)pyupgrade] Enable printf-string-formatting fix with comments on right-hand side (#9037)refurb] Make math-constant (FURB152) rule more targeted (#9054)refurb] Support floating-point base in redundant-log-base (FURB163) (#9100)ruff] Detect unused-asyncio-dangling-task (RUF006) on unused assignments (#9060)fix_power_op_line_length preview style (#8947)flake8-annotations] Enable auto-return-type involving Optional and Union annotations (#8885)flake8-bandit] Implement django-raw-sql (S611) (#8651)flake8-bandit] Implement tarfile-unsafe-members (S202) (#8829)flake8-pyi] Implement fix for unnecessary-literal-union (PYI030) (#7934)flake8-simplify] Extend dict-get-with-none-default (SIM910) to non-literals (#8762)pylint] - add unnecessary-list-index-lookup (PLR1736) + autofix (#7999)pylint] - implement R0202 and R0203 with autofixes (#8335)pylint] Implement repeated-keyword (PLe1132) (#8706)pylint] Implement too-many-positional (PLR0917) (#8995)pylint] Implement unnecessary-dict-index-lookup (PLR1733) (#8036)refurb] Implement redundant-log-base (FURB163) (#8842)flake8-boolean-trap] Allow booleans in @override methods (#8882)flake8-bugbear] Avoid B015,B018 for last expression in a cell (#8815)flake8-pie] Allow ellipses for enum values in stub files (#8825)flake8-pyi] Check PEP 695 type aliases for snake-case-type-alias and t-suffixed-type-alias (#8966)flake8-pyi] Check for kwarg and vararg NoReturn type annotations (#8948)flake8-simplify] Omit select context managers from SIM117 (#8801)pep8-naming] Allow Django model loads in non-lowercase-variable-in-function (N806) (#8917)pycodestyle] Avoid E703 for last expression in a cell (#8821)pycodestyle] Update E402 to work at cell level for notebooks (#8872)pydocstyle] Avoid D100 for Jupyter Notebooks (#8816)pylint] Implement fix for unspecified-encoding (PLW1514) (#8928)ruff check and ruff format to default to the current directory (#8791)pylint] Default max-positional-args to max-args (#8998)pylint] Add allow-dunder-method-names setting for bad-dunder-method-name (PLW3201) (#8812)isort] Add support for from-first setting (#8663)isort] Add support for length-sort settings (#8841)@functools.singledispatch (#8934)get_model matching (#8965)@overload and @override methods for too-many-arguments checks (#8954)Mode::Expression (#8880)pydantic_settings.BaseSettings as having default copy semantics (#8793)NamedTuple assignments (#8810)flake8-type-checking (#8768)flake8-annotations] Avoid filtering out un-representable types in return annotation (#8881)flake8-pie] Retain extra ellipses in protocols and abstract methods (#8769)flake8-pyi] Respect local enum subclasses in simple-defaults (PYI052) (#8767)flake8-trio] Use correct range for TRIO115 fix (#8933)flake8-trio] Use full arguments range for zero-sleep-call (#8936)isort] fix: mark __main__ as first-party import (#8805)pep8-naming] Avoid N806 errors for type alias statements (#8785)perflint] Avoid PERF101 if there's an append in loop body (#8809)pycodestyle] Allow space-before-colon after end-of-slice (#8838)pydocstyle] Avoid non-character breaks in over-indentation (D208) (#8866)pydocstyle] Ignore underlines when determining docstring logical lines (#8929)pylint] Extend self-assigning-variable to multi-target assignments (#8839)tryceratops] Avoid repeated triggers in nested tryceratops diagnostics (#8772)flake8-pyi] Fix error in t-suffixed-type-alias (PYI043) example (#8963)flake8-pyi] Improve motivation for custom-type-var-return-type (PYI019) (#8766)flake8-boolean-trap] Extend boolean-type-hint-positional-argument (FBT001) to include booleans in unions (#7501)flake8-pie] Extend reimplemented-list-builtin (PIE807) to dict reimplementations (#8608)flake8-pie] Extend unnecessary-pass (PIE790) to include ellipses (...) (#8641)flake8-pie] Implement fix for unnecessary-spread (PIE800) (#8668)flake8-quotes] Implement unnecessary-escaped-quote (Q004) (#8630)pycodestyle] Implement fix for multiple-spaces-after-keyword (E271) and multiple-spaces-before-keyword (E272) (#8622)pycodestyle] Implement fix for multiple-spaces-after-operator (E222) and multiple-spaces-before-operator (E221) (#8623)pyflakes] Extend is-literal (F632) to include comparisons against mutable initializers (#8607)pylint] Implement redefined-argument-from-local (PLR1704) (#8159)pylint] Implement fix for unnecessary-lambda (PLW0108) (#8621)refurb] Implement if-expr-min-max (FURB136) (#8664)refurb] Implement math-constant (FURB152) (#8727)flake8-annotations] Add autotyping-like return type inference for annotation rules (#8643)flake8-future-annotations] Implement fix for future-required-type-annotation (FA102) (#8711)flake8-implicit-namespace-package] Avoid missing namespace violations in scripts with shebangs (#8710)pydocstyle] Update over-indentation (D208) to preserve indentation offsets when fixing overindented lines (#8699)pyupgrade] Refine timeout-error-alias (UP041) to remove false positives (#8587)await formatting with fluent style (#8676)isort] Support disabling sections with no-sections = true (#8657)pep8-naming] Support local and dynamic class- and static-method decorators (#8592)pydocstyle] Allow overriding pydocstyle convention rules (#8586)trio.lowlevel (#8730)PIE794 (#8634)EM fixes (#7746)whitespace-before-punctuation (E203) (#8654)no-self-use (#8637)PLW0129 (#8675)TYPE_CHECKING blocks imported from typing_extensions or _typeshed (#8429)FURB113 autofix if comments are present (#8494)flake8-commas (#8582)force-sort-within-sections (#8665)flake8-bandit] Implement mako-templates (S702) (#8533)flake8-trio] Implement TRIO105 (#8490)flake8-trio] Implement TRIO109 (#8534)flake8-trio] Implement TRIO110 (#8537)flake8-trio] Implement TRIO115 (#8486)refurb] Implement type-none-comparison (FURB169) (#8487)E721 (#8491)SIM118 fix as safe when the expression is a known dictionary (#8525)--extension to override inference of source type from file extension (#8373)extend_unsafe_fixes and override extend_safe_fixes (#8444)RUFF_NO_CACHE environment variable (#8538)E721] Flag comparisons to memoryview (#8485)D301 autofix for u prefixed strings (#8495)flake8-trio rules when trio import is present (#8550)TRIO115 violations for trio.sleep(...) calls with non-number values (#8532)F841 false negative on assignment to multiple variables (#8489)known-first-party (#8562)project.requires-python over target-version (#8513)B008 documentation (#8501)flake8-trio] Implement timeout-without-await (TRIO001) (#8439)numpy] Implement NumPy 2.0 migration rule (NPY200) (#7702)pylint] Implement bad-open-mode (W1501) (#8294)pylint] Implement import-outside-toplevel (C0415) rule (#5180)pylint] Implement useless-with-lock (W2101) (#8321)pyupgrade] Implement timeout-error-alias (UP041) (#8476)refurb] Implement isinstance-type-none (FURB168) (#8308)RUF001, RUF002, and RUF003 (#4430)fmt: skip (#8273)fmt: off (#8275)--line-length option to format command (#8363)--output-format to ruff rule and ruff linter (#8203)--force-exclude in lint.exclude and format.exclude (#8393)--extend-per-file-ignores on the CLI (#8329)bad-dunder-method-name to permit __index__ (#8300)D300 when both triple quote styles are present (#8462)FStringRanges (#8154)shell=True for truthy, non-True diagnostics (#8359)NamedTuple rewrite with starred annotation (#8434)PLE1307 was raised when formatting %c with characters (#8407)fixedOverflowWidgets for playground popover (#8458)byte_bounds as a non-backwards-compatible NumPy 2.0 change (#8474)--fix and --diff (#8316)This release includes a variety of improvements to the Ruff formatter, removing several known and unintentional deviations from Black.
None, True and False (#8189)isort settings (#8192)isort.force-single-line is true (#8244)SourceKind::diff for formatter (#8240)fmt:off with trailing child comment (#8234)IpyEscapeCommand (#8207)pylint] Add buffer methods to bad-dunder-method-name (PLW3201) exclusions (#8190)external codes setting in unused-noqa (#8177)line-length setting for isort in lieu of pycodestyle.max-line-length (#8235)unnecessary-paren-on-raise-exception to unsafe for unknown types (#8231)W605 (#8255)unused-noqa (#8172)external option to unused-noqa documentation (#8171)magic-trailing-comma option in README (#8200)This release includes the Beta version of the Ruff formatter — an extremely fast, Black-compatible Python formatter. Try it today with ruff format! Check out the blog post and read the docs.
pylint] Implement non-ascii-module-import (C2403) (#8056)pylint] implement non-ascii-name (C2401) (#8038)pylint] Implement unnecessary-lambda (W0108) (#7953)refurb] Implement read-whole-file (FURB101) (#7682)E223, E224, and E242 (#8143)E225, E226, E227, and E228 (#8136)E252 (#8142)E261 (#8114)E273 and E274 (#8144)E275 (#8133)SIM401 to catch ternary operations (#7415)E721 to allow is and is not for direct type comparisons (#7905)backports.strenum to deprecated-imports (#8113)SIM112 to ignore https_proxy, http_proxy, and no_proxy (#8140)literal-membership (PLR6201) to be unsafe (#8097)mutable-argument-defaults (B006) to be unsafe (#8108)line-ending default to auto (#8057)has_own_parentheses (#8100)--line-length option from format command (#8131)line-length documentation (#8150)ruff format command in help menus (#8167)ruff version command with long version display (#8034)pycodestyle.max-line-length option (#8039)sys.version_info slices in outdated-version-block (#8112)TYPE_CHECKING blocks (#8072)too-many-arguments lint (#8092)extend-unsafe-fixes and extend-safe-fixes example (#8139)flake8-import-conventions options (#8115)Options JSON schema description (#8081)pytext -> pytest) (#8117)magic-value-comparison example in docs (#8111)escape-sequence-in-docstring (D301) (#7970)#(deprecated) attribute in configuration options (#8035)[format|lint].exclude options (#8000)tab-size setting in formatter (#8006)lint.preview (#8002)pylint] Implement literal-membership (PLR6201) (#7973)pylint] Implement too-many-boolean-expressions (PLR0916) (#7975)pylint] Implement misplaced-bare-raise (E0704) (#7961)pylint] Implement global-at-module-level (W0604) (#8058)pylint] Implement unspecified-encoding (PLW1514) (#7939)triple-single-quotes (D300) (#7967)ruff format (#7878)--target-version to ruff format (#8055)in keyword (#8054)--diff option to ruff format (#7937)pass over ellipsis in non-function/class contexts (#8049)bad-dunder-method-name for _ (#8015)URLOpen audit (#8047)iteration-over-set to preserve whitespace and comments (#8001)B005 docs (#8028)--output-format (#8014)lint.preview and format.preview (#8032)RuleGroup::Preview. (#7989)This is the first release which uses the CHANGELOG file. See GitHub Releases for prior changelog entries.
Read Ruff's new versioning policy.
format setting has been removed (#7984)format setting cannot be used to configure the output format, use output-format insteadRUFF_FORMAT environment variable is ignored, use RUFF_OUTPUT_FORMAT instead--format option has been removed from ruff check, use --output-format insteadreimplemented-starmap (FURB140) to catch calls with a single and starred argument (#7768)RUF015 (#7848)SIM15 to allow open followed by close (#7916)msgspec.Struct default-copy semantics in RUF012 (#7786)sqlalchemy methods to `flake8-boolean-trap`` exclusion list (#7874)PLR1714 (#7910)PIE804 (#7884)PLC0208 (#7887)PYI055 (#7886)non-pep695-type-alias to require --unsafe-fixes outside of stub files (#7836)UP018 (#7913)PLW3201 to support Enum sunder names (#7987)unnecessary-key-check to simplify key in dct and dct[key] to dct.get(key) (#7895)assignment-in-assert to prevent walrus expressions in assert statements (#7856)refurb] Add single-item-membership-test (FURB171) (#7815)pylint] Add and-or-ternary (R1706) (#7811)New rules are added in preview.
unsafe-fixes setting (#7769)extend-safe-fixes and extend-unsafe-fixes for promoting and demoting fixes (#7841)--unsafe-fixes option for opt-in to display and apply unsafe fixes (#7769)--format option in warning (#7837)--check (#7788)check --diff to include unsafe fix hints (#7790)cell field to JSON output format (#7664)Safe, Unsafe, and Display (#7843)SIM110 with a yield in the condition (#7801)C414 fixes (#7775)unnecessary-enumerate len suggestion (#7781)SIM101 (#7798)E251 false positive inside f-strings (#7894)stdin (#7789)ruff rule (#7812)--unfixable in ISC rules (#7917)PIE804 (#7922)PTH118 for Path.joinpath with starred arguments (#7852)outdated-version-block when using greater than comparisons (#7920)gettext calls (#7898)PLR6301 (#7933)TCH004 (#7968)cache-dir relative to project root (#7962)TCH003 (#7954)line-length (#7883)coalesce keyword (#7876)reimplemented-starmap performance effects (#7846)PLR6301 (#7831)UP038 docs to note that it results in slower code (#7872)unnecessary-subscript-reversal (#7774)FURB177 example (#7832)ruff format message (#7867)ruff_python_formatter generate.py comment (#7850)Quick Fix action (#7824)