Skip to main content

Convert existing Flake8 configuration to Ruff.

Project description

flake8-to-ruff

Convert existing Flake8 configuration files (setup.cfg, tox.ini, or .flake8) for use with Ruff.

Generates a Ruff-compatible pyproject.toml section.

Installation and Usage

Installation

Available as flake8-to-ruff on PyPI:

pip install flake8-to-ruff

Usage

To run flake8-to-ruff:

flake8-to-ruff path/to/setup.cfg
flake8-to-ruff path/to/tox.ini
flake8-to-ruff path/to/.flake8

flake8-to-ruff will print the relevant pyproject.toml sections to standard output, like so:

[tool.ruff]
exclude = [
    '.svn',
    'CVS',
    '.bzr',
    '.hg',
    '.git',
    '__pycache__',
    '.tox',
    '.idea',
    '.mypy_cache',
    '.venv',
    'node_modules',
    '_state_machine.py',
    'test_fstring.py',
    'bad_coding2.py',
    'badsyntax_*.py',
]
select = [
    'A',
    'E',
    'F',
    'Q',
]
ignore = []

[tool.ruff.flake8-quotes]
inline-quotes = 'single'

[tool.ruff.pep8-naming]
ignore-names = [
    'foo',
    'bar',
]

Plugins

flake8-to-ruff will attempt to infer any activated plugins based on the settings provided in your configuration file.

For example, if your .flake8 file includes a docstring-convention property, flake8-to-ruff will enable the appropriate flake8-docstrings checks.

Alternatively, you can manually specify plugins on the command-line:

flake8-to-ruff path/to/.flake8 --plugin flake8-builtins --plugin flake8-quotes

Limitations

  1. Ruff only supports a subset of the Flake configuration options. flake8-to-ruff will warn on and ignore unsupported options in the .flake8 file (or equivalent). (Similarly, Ruff has a few configuration options that don't exist in Flake8.)
  2. Ruff will omit any rule codes that are unimplemented or unsupported by Ruff, including rule codes from unsupported plugins. (See the Ruff README for the complete list of supported plugins.)

License

MIT

Contributing

Contributions are welcome and hugely appreciated. To get started, check out the contributing guidelines.

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_to_ruff-0.0.233.tar.gz (730.2 kB view hashes)

Uploaded Source

Built Distributions

flake8_to_ruff-0.0.233-py3-none-win_amd64.whl (803.4 kB view hashes)

Uploaded Python 3 Windows x86-64

flake8_to_ruff-0.0.233-py3-none-win32.whl (742.0 kB view hashes)

Uploaded Python 3 Windows x86

flake8_to_ruff-0.0.233-py3-none-musllinux_1_2_x86_64.whl (930.0 kB view hashes)

Uploaded Python 3 musllinux: musl 1.2+ x86-64

flake8_to_ruff-0.0.233-py3-none-musllinux_1_2_i686.whl (887.1 kB view hashes)

Uploaded Python 3 musllinux: musl 1.2+ i686

flake8_to_ruff-0.0.233-py3-none-musllinux_1_2_armv7l.whl (806.0 kB view hashes)

Uploaded Python 3 musllinux: musl 1.2+ ARMv7l

flake8_to_ruff-0.0.233-py3-none-musllinux_1_2_aarch64.whl (822.1 kB view hashes)

Uploaded Python 3 musllinux: musl 1.2+ ARM64

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (887.9 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.1 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (933.0 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (938.0 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (896.1 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ i686

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (795.0 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

flake8_to_ruff-0.0.233-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (810.9 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

flake8_to_ruff-0.0.233-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.7 MB view hashes)

Uploaded Python 3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

flake8_to_ruff-0.0.233-py3-none-macosx_10_7_x86_64.whl (878.4 kB view hashes)

Uploaded Python 3 macOS 10.7+ x86-64

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