| Name | flake8-ruff JSON |
| Version |
0.3.1
JSON |
| download |
| home_page | None |
| Summary | A Flake8 plugin that implements miscellaneous checks from Ruff. |
| upload_time | 2025-08-24 00:22:33 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.9 |
| license | None |
| keywords |
flake8
ruff
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# flake8-ruff
[](https://pypi.python.org/pypi/flake8-ruff)
A Flake8 plugin that implements miscellaneous checks from
[Ruff](https://github.com/astral-sh/ruff).
Specifically, this plugin implements checks that are under the `RUF` category
(the rules that do not have a direct equivalent in Flake8).
## Requirements
Python 3.9 and newer is supported.
## Installation
Install from PyPI. For example,
```bash
pip install flake8-ruff
```
Then follow the instructions on the
[Flake8 documentation](https://flake8.pycqa.org/en/latest/index.html) to enable
the plugin.
## Checks
### RUF010 Use explicit conversion flag
Checks for `str()`, `repr()`, and `ascii()` as explicit conversions within
f-strings.
For example, replace
```python
f"{ascii(foo)}, {repr(bar)}, {str(baz)}"
```
with
```python
f"{foo!a}, {bar!r}, {baz!s}"
```
or, often (such as where `__str__` and `__format__` are equivalent),
```python
f"{foo!a}, {bar!r}, {baz}"
```
Derived from
[explicit-f-string-type-conversion (RUF010)](https://docs.astral.sh/ruff/rules/explicit-f-string-type-conversion/).
### RUF018 Avoid assignment expressions in `assert` statements
Checks for named assignment expressions in `assert` statements. When Python is
run with the `-O` option, the `assert` statement is ignored, and the assignment
expression is not executed. This can lead to unexpected behavior.
For example, replace
```python
assert (result := foo()) is not None
```
with
```python
result = foo()
assert result is not None
```
Derived from
[assignment-in-assert (RUF018)](https://docs.astral.sh/ruff/rules/assignment-in-assert/).
### RUF020 `typing.Never | T` is equivalent to `T`
Checks for `typing.Never` and `typing.NoReturn` in union types, which is
redundant.
For example, replace
```python
typing.Never | int | None
```
with
```python
int | None
```
Derived from
[never-union (RUF020)](https://docs.astral.sh/ruff/rules/never-union/).
### RUF025 Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
Checks for dict comprehensions that create a dictionary from an iterable with a
constant value. Instead, use `dict.fromkeys`, which is more efficient.
For example, replace
```python
{key: 0 for key in keys}
```
with
```python
dict.fromkeys(keys, 0)
```
and
```python
{key: None for key in keys}
```
with
```python
dict.fromkeys(keys)
```
Derived from
[unnecessary-dict-comprehension-for-iterable (RUF025)](https://docs.astral.sh/ruff/rules/unnecessary-dict-comprehension-for-iterable/).
Raw data
{
"_id": null,
"home_page": null,
"name": "flake8-ruff",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "flake8, ruff",
"author": null,
"author_email": "Tom Kuson <mail@tjkuson.me>",
"download_url": "https://files.pythonhosted.org/packages/e2/70/892dc878ba2245aa62b34a3bb89405eeb6062dbe2e8b8af9e9f982d35d02/flake8_ruff-0.3.1.tar.gz",
"platform": null,
"description": "# flake8-ruff\n\n[](https://pypi.python.org/pypi/flake8-ruff)\n\nA Flake8 plugin that implements miscellaneous checks from\n[Ruff](https://github.com/astral-sh/ruff).\n\nSpecifically, this plugin implements checks that are under the `RUF` category\n(the rules that do not have a direct equivalent in Flake8).\n\n## Requirements\n\nPython 3.9 and newer is supported.\n\n## Installation\n\nInstall from PyPI. For example,\n\n```bash\npip install flake8-ruff\n```\n\nThen follow the instructions on the\n[Flake8 documentation](https://flake8.pycqa.org/en/latest/index.html) to enable\nthe plugin.\n\n## Checks\n\n### RUF010 Use explicit conversion flag\n\nChecks for `str()`, `repr()`, and `ascii()` as explicit conversions within\nf-strings.\n\nFor example, replace\n\n```python\nf\"{ascii(foo)}, {repr(bar)}, {str(baz)}\"\n```\n\nwith\n\n```python\nf\"{foo!a}, {bar!r}, {baz!s}\"\n```\n\nor, often (such as where `__str__` and `__format__` are equivalent),\n\n```python\nf\"{foo!a}, {bar!r}, {baz}\"\n```\n\nDerived from\n[explicit-f-string-type-conversion (RUF010)](https://docs.astral.sh/ruff/rules/explicit-f-string-type-conversion/).\n\n### RUF018 Avoid assignment expressions in `assert` statements\n\nChecks for named assignment expressions in `assert` statements. When Python is\nrun with the `-O` option, the `assert` statement is ignored, and the assignment\nexpression is not executed. This can lead to unexpected behavior.\n\nFor example, replace\n\n```python\nassert (result := foo()) is not None\n```\n\nwith\n\n```python\nresult = foo()\nassert result is not None\n```\n\nDerived from\n[assignment-in-assert (RUF018)](https://docs.astral.sh/ruff/rules/assignment-in-assert/).\n\n### RUF020 `typing.Never | T` is equivalent to `T`\n\nChecks for `typing.Never` and `typing.NoReturn` in union types, which is\nredundant.\n\nFor example, replace\n\n```python\ntyping.Never | int | None\n```\n\nwith\n\n```python\nint | None\n```\n\nDerived from\n[never-union (RUF020)](https://docs.astral.sh/ruff/rules/never-union/).\n\n### RUF025 Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead\n\nChecks for dict comprehensions that create a dictionary from an iterable with a\nconstant value. Instead, use `dict.fromkeys`, which is more efficient.\n\nFor example, replace\n\n```python\n{key: 0 for key in keys}\n```\n\nwith\n\n```python\ndict.fromkeys(keys, 0)\n```\n\nand\n\n```python\n{key: None for key in keys}\n```\n\nwith\n\n```python\ndict.fromkeys(keys)\n```\n\nDerived from\n[unnecessary-dict-comprehension-for-iterable (RUF025)](https://docs.astral.sh/ruff/rules/unnecessary-dict-comprehension-for-iterable/).\n",
"bugtrack_url": null,
"license": null,
"summary": "A Flake8 plugin that implements miscellaneous checks from Ruff.",
"version": "0.3.1",
"project_urls": {
"Repository": "https://github.com/tjkuson/flake8-ruff"
},
"split_keywords": [
"flake8",
" ruff"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5597c6f1961927d9d4df147d8a84b5ad2cab8ae71ca3c424b326abc09049b172",
"md5": "28143e5da1528b2a6ff0eeb851a77a73",
"sha256": "d0d71e066df562b7307cb2cb3a646a7b55018fdeebc5457167f3f1b652d8d2fe"
},
"downloads": -1,
"filename": "flake8_ruff-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28143e5da1528b2a6ff0eeb851a77a73",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4832,
"upload_time": "2025-08-24T00:22:32",
"upload_time_iso_8601": "2025-08-24T00:22:32.058521Z",
"url": "https://files.pythonhosted.org/packages/55/97/c6f1961927d9d4df147d8a84b5ad2cab8ae71ca3c424b326abc09049b172/flake8_ruff-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e270892dc878ba2245aa62b34a3bb89405eeb6062dbe2e8b8af9e9f982d35d02",
"md5": "654099b00a089602a565a2a58d6ea608",
"sha256": "afa65ef8c84760593db76d9c5cec7d7a588b499792461f048924280ac89bb7b4"
},
"downloads": -1,
"filename": "flake8_ruff-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "654099b00a089602a565a2a58d6ea608",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 26033,
"upload_time": "2025-08-24T00:22:33",
"upload_time_iso_8601": "2025-08-24T00:22:33.481874Z",
"url": "https://files.pythonhosted.org/packages/e2/70/892dc878ba2245aa62b34a3bb89405eeb6062dbe2e8b8af9e9f982d35d02/flake8_ruff-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-24 00:22:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tjkuson",
"github_project": "flake8-ruff",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flake8-ruff"
}