Skip to main content

A Flake8 plugin that implements miscellaneous checks from Ruff.

Project description

flake8-ruff

A Flake8 plugin that implements miscellaneous checks from 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 to 3.12 is supported.

Installation

Install from PyPI. For example,

pip install flake8-ruff

Then follow the instructions on the Flake8 documentation to enable the plugin.

Checks

RUF020 typing.Never | T is equivalent to T

Checks for typing.Never and typing.NoReturn in union types, which is redundant.

For example, replace

typing.Never | int | None

with

int | None

Derived from never-union (RUF020).

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

{key: 0 for key in keys}

with

dict.fromkeys(keys, 0)

and

{key: None for key in keys}

with

dict.fromkeys(keys)

Derived from unnecessary-dict-comprehension-for-iterable (RUF025).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_ruff-0.1.1.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

flake8_ruff-0.1.1-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page