Ruff

Latest version: v0.8.6

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 25 of 28

0.1.2

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](https://astral.sh/blog/the-ruff-formatter) and [read the docs](https://docs.astral.sh/ruff/formatter/).

Preview features

- \[`pylint`\] Implement `non-ascii-module-import` (`C2403`) ([8056](https://github.com/astral-sh/ruff/pull/8056))
- \[`pylint`\] implement `non-ascii-name` (`C2401`) ([8038](https://github.com/astral-sh/ruff/pull/8038))
- \[`pylint`\] Implement unnecessary-lambda (W0108) ([7953](https://github.com/astral-sh/ruff/pull/7953))
- \[`refurb`\] Implement `read-whole-file` (`FURB101`) ([7682](https://github.com/astral-sh/ruff/pull/7682))
- Add fix for `E223`, `E224`, and `E242` ([8143](https://github.com/astral-sh/ruff/pull/8143))
- Add fix for `E225`, `E226`, `E227`, and `E228` ([8136](https://github.com/astral-sh/ruff/pull/8136))
- Add fix for `E252` ([8142](https://github.com/astral-sh/ruff/pull/8142))
- Add fix for `E261` ([8114](https://github.com/astral-sh/ruff/pull/8114))
- Add fix for `E273` and `E274` ([8144](https://github.com/astral-sh/ruff/pull/8144))
- Add fix for `E275` ([8133](https://github.com/astral-sh/ruff/pull/8133))
- Update `SIM401` to catch ternary operations ([7415](https://github.com/astral-sh/ruff/pull/7415))
- Update `E721` to allow `is` and `is` not for direct type comparisons ([7905](https://github.com/astral-sh/ruff/pull/7905))

Rule changes

- Add `backports.strenum` to `deprecated-imports` ([8113](https://github.com/astral-sh/ruff/pull/8113))
- Update `SIM112` to ignore `https_proxy`, `http_proxy`, and `no_proxy` ([8140](https://github.com/astral-sh/ruff/pull/8140))
- Update fix for `literal-membership` (`PLR6201`) to be unsafe ([8097](https://github.com/astral-sh/ruff/pull/8097))
- Update fix for `mutable-argument-defaults` (`B006`) to be unsafe ([8108](https://github.com/astral-sh/ruff/pull/8108))

Formatter

- Change `line-ending` default to `auto` ([8057](https://github.com/astral-sh/ruff/pull/8057))
- Respect parenthesized generators in `has_own_parentheses` ([8100](https://github.com/astral-sh/ruff/pull/8100))
- Add caching to formatter ([8089](https://github.com/astral-sh/ruff/pull/8089))
- Remove `--line-length` option from `format` command ([8131](https://github.com/astral-sh/ruff/pull/8131))
- Add formatter to `line-length` documentation ([8150](https://github.com/astral-sh/ruff/pull/8150))
- Warn about incompatible formatter options ([8088](https://github.com/astral-sh/ruff/pull/8088))
- Fix range of unparenthesized tuple subject in match statement ([8101](https://github.com/astral-sh/ruff/pull/8101))
- Remove experimental formatter warning ([8148](https://github.com/astral-sh/ruff/pull/8148))
- Don't move type param opening parenthesis comment ([8163](https://github.com/astral-sh/ruff/pull/8163))
- Update versions in format benchmark script ([8110](https://github.com/astral-sh/ruff/pull/8110))
- Avoid loading files for cached format results ([8134](https://github.com/astral-sh/ruff/pull/8134))

CLI

- Show the `ruff format` command in help menus ([8167](https://github.com/astral-sh/ruff/pull/8167))
- Add `ruff version` command with long version display ([8034](https://github.com/astral-sh/ruff/pull/8034))

Configuration

- New `pycodestyle.max-line-length` option ([8039](https://github.com/astral-sh/ruff/pull/8039))

Bug fixes

- Detect `sys.version_info` slices in `outdated-version-block` ([8112](https://github.com/astral-sh/ruff/pull/8112))
- Avoid if-else simplification for `TYPE_CHECKING` blocks ([8072](https://github.com/astral-sh/ruff/pull/8072))
- Avoid false-positive print separator diagnostic with starred argument ([8079](https://github.com/astral-sh/ruff/pull/8079))

Documentation

- Fix message for `too-many-arguments` lint ([8092](https://github.com/astral-sh/ruff/pull/8092))
- Fix `extend-unsafe-fixes` and `extend-safe-fixes` example ([8139](https://github.com/astral-sh/ruff/pull/8139))
- Add links to `flake8-import-conventions` options ([8115](https://github.com/astral-sh/ruff/pull/8115))
- Rework the documentation to incorporate the Ruff formatter ([7732](https://github.com/astral-sh/ruff/pull/7732))
- Fix `Options` JSON schema description ([8081](https://github.com/astral-sh/ruff/pull/8081))
- Fix typo (`pytext` -> `pytest`) ([8117](https://github.com/astral-sh/ruff/pull/8117))
- Improve `magic-value-comparison` example in docs ([8111](https://github.com/astral-sh/ruff/pull/8111))

0.1.1

Rule changes

- Add unsafe fix for `escape-sequence-in-docstring` (`D301`) ([7970](https://github.com/astral-sh/ruff/pull/7970))

Configuration

- Respect `(deprecated)` attribute in configuration options ([8035](https://github.com/astral-sh/ruff/pull/8035))
- Add `[format|lint].exclude` options ([8000](https://github.com/astral-sh/ruff/pull/8000))
- Respect `tab-size` setting in formatter ([8006](https://github.com/astral-sh/ruff/pull/8006))
- Add `lint.preview` ([8002](https://github.com/astral-sh/ruff/pull/8002))

Preview features

- \[`pylint`\] Implement `literal-membership` (`PLR6201`) ([7973](https://github.com/astral-sh/ruff/pull/7973))
- \[`pylint`\] Implement `too-many-boolean-expressions` (`PLR0916`) ([7975](https://github.com/astral-sh/ruff/pull/7975))
- \[`pylint`\] Implement `misplaced-bare-raise` (`E0704`) ([7961](https://github.com/astral-sh/ruff/pull/7961))
- \[`pylint`\] Implement `global-at-module-level` (`W0604`) ([8058](https://github.com/astral-sh/ruff/pull/8058))
- \[`pylint`\] Implement `unspecified-encoding` (`PLW1514`) ([7939](https://github.com/astral-sh/ruff/pull/7939))
- Add fix for `triple-single-quotes` (`D300`) ([7967](https://github.com/astral-sh/ruff/pull/7967))

Formatter

- New code style badge for `ruff format` ([7878](https://github.com/astral-sh/ruff/pull/7878))
- Fix comments outside expression parentheses ([7873](https://github.com/astral-sh/ruff/pull/7873))
- Add `--target-version` to `ruff format` ([8055](https://github.com/astral-sh/ruff/pull/8055))
- Skip over parentheses when detecting `in` keyword ([8054](https://github.com/astral-sh/ruff/pull/8054))
- Add `--diff` option to `ruff format` ([7937](https://github.com/astral-sh/ruff/pull/7937))
- Insert newline after nested function or class statements ([7946](https://github.com/astral-sh/ruff/pull/7946))
- Use `pass` over ellipsis in non-function/class contexts ([8049](https://github.com/astral-sh/ruff/pull/8049))

Bug fixes

- Lazily evaluate all PEP 695 type alias values ([8033](https://github.com/astral-sh/ruff/pull/8033))
- Avoid failed assertion when showing fixes from stdin ([8029](https://github.com/astral-sh/ruff/pull/8029))
- Avoid flagging HTTP and HTTPS literals in urllib-open ([8046](https://github.com/astral-sh/ruff/pull/8046))
- Avoid flagging `bad-dunder-method-name` for `_` ([8015](https://github.com/astral-sh/ruff/pull/8015))
- Remove Python 2-only methods from `URLOpen` audit ([8047](https://github.com/astral-sh/ruff/pull/8047))
- Use set bracket replacement for `iteration-over-set` to preserve whitespace and comments ([8001](https://github.com/astral-sh/ruff/pull/8001))

Documentation

- Update tutorial to match revised Ruff defaults ([8066](https://github.com/astral-sh/ruff/pull/8066))
- Update rule `B005` docs ([8028](https://github.com/astral-sh/ruff/pull/8028))
- Update GitHub actions example in docs to use `--output-format` ([8014](https://github.com/astral-sh/ruff/pull/8014))
- Document `lint.preview` and `format.preview` ([8032](https://github.com/astral-sh/ruff/pull/8032))
- Clarify that new rules should be added to `RuleGroup::Preview`. ([7989](https://github.com/astral-sh/ruff/pull/7989))

0.1.0

The deprecated `format` setting has been removed

Ruff previously used the `format` setting, `--format` CLI option, and `RUFF_FORMAT` environment variable to
configure the output format of the CLI. This usage was deprecated in `v0.0.291` — the `format` setting is now used
to control Ruff's code formatting. As of this release:

- The `format` setting cannot be used to configure the output format, use `output-format` instead
- The `RUFF_FORMAT` environment variable is ignored, use `RUFF_OUTPUT_FORMAT` instead
- The `--format` option has been removed from `ruff check`, use `--output-format` instead

Unsafe fixes are not applied by default ([7769](https://github.com/astral-sh/ruff/pull/7769))

Ruff labels fixes as "safe" and "unsafe". The meaning and intent of your code will be retained when applying safe
fixes, but the meaning could be changed when applying unsafe fixes. Previously, unsafe fixes were always displayed
and applied when fixing was enabled. Now, unsafe fixes are hidden by default and not applied. The `--unsafe-fixes`
flag or `unsafe-fixes` configuration option can be used to enable unsafe fixes.

See the [docs](https://docs.astral.sh/ruff/configuration/#fix-safety) for details.

Remove formatter-conflicting rules from the default rule set ([7900](https://github.com/astral-sh/ruff/pull/7900))

Previously, Ruff enabled all implemented rules in Pycodestyle (`E`) by default. Ruff now only includes the
Pycodestyle prefixes `E4`, `E7`, and `E9` to exclude rules that conflict with automatic formatters. Consequently,
the stable rule set no longer includes `line-too-long` (`E501`) and `mixed-spaces-and-tabs` (`E101`). Other
excluded Pycodestyle rules include whitespace enforcement in `E1` and `E2`; these rules are currently in preview, and are already omitted by default.

This change only affects those using Ruff under its default rule set. Users that include `E` in their `select` will experience no change in behavior.

0.0.288

Remove support for emoji identifiers ([7212](https://github.com/astral-sh/ruff/pull/7212))

Previously, Ruff supported the non-standard compliant emoji identifiers e.g. `📦 = 1`.
We decided to remove this non-standard language extension, and Ruff now reports syntax errors for emoji identifiers in your code, the same as CPython.

Improved GitLab fingerprints ([7203](https://github.com/astral-sh/ruff/pull/7203))

GitLab uses fingerprints to identify new, existing, or fixed violations. Previously, Ruff included the violation's position in the fingerprint. Using the location has the downside that changing any code before the violation causes the fingerprint to change, resulting in GitLab reporting one fixed and one new violation even though it is a pre-existing violation.

Ruff now uses a more stable location-agnostic fingerprint to minimize that existing violations incorrectly get marked as fixed and re-reported as new violations.

Expect GitLab to report each pre-existing violation in your project as fixed and a new violation in your Ruff upgrade PR.

0.0.283

The target Python version now defaults to 3.8 instead of 3.10 ([6397](https://github.com/astral-sh/ruff/pull/6397))

Previously, when a target Python version was not specified, Ruff would use a default of Python 3.10. However, it is safer to default to an _older_ Python version to avoid assuming the availability of new features. We now default to the oldest supported Python version which is currently Python 3.8.

(We still support Python 3.7 but since [it has reached EOL](https://devguide.python.org/versions/#unsupported-versions) we've decided not to make it the default here.)

Note this change was announced in 0.0.283 but not active until 0.0.284.

0.0.277

`.ipynb_checkpoints`, `.pyenv`, `.pytest_cache`, and `.vscode` are now excluded by default ([5513](https://github.com/astral-sh/ruff/pull/5513))

Ruff maintains a list of default exclusions, which now consists of the following patterns:

- `.bzr`
- `.direnv`
- `.eggs`
- `.git`
- `.git-rewrite`
- `.hg`
- `.ipynb_checkpoints`
- `.mypy_cache`
- `.nox`
- `.pants.d`
- `.pyenv`
- `.pytest_cache`
- `.pytype`
- `.ruff_cache`
- `.svn`
- `.tox`
- `.venv`
- `.vscode`
- `__pypackages__`
- `_build`
- `buck-out`
- `build`
- `dist`
- `node_modules`
- `venv`

Previously, the `.ipynb_checkpoints`, `.pyenv`, `.pytest_cache`, and `.vscode` directories were not
excluded by default. This change brings Ruff's default exclusions in line with other tools like
Black.

Page 25 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.