Skip to main content

The National Archives global Ruff config

Project description

The National Archives logo

The National Archives Ruff config

Latest release PyPi version Licence

These configurations are included in the tna-python-dev Docker image as part of the format command.

Two Ruff configurations are available:

Standard configuration

The standard configuration ruff.toml includes the following rules:

Rule Purpose Defined by
E4, E7, E9 Subset of pycodestyle errors Ruff default configuration
F Pyflakes Ruff default configuration
W pycodestyle warnings ruff.toml
C901 mccabe "Function is too complex" ruff.toml
B flake8-bugbear ruff.toml
I isort ruff.toml

Ignores

Certain rules are ignored for __init__.py files:

  • E402 (module-import-not-at-top-of-file) and PLC0415 (import-outside-top-level) - some imports like in Django settings files are added later on in the file, sometimes under conditionals
  • F401 (unused-import) - imports don't have to be used in module files which also helps with Django settings

Strict configuration

Extra rules are included in ruff-strict.toml. You can find more information on each of the rules in the Ruff rules documentation.

Using from PyPI

# Install with Poetry
poetry add tna-ruff-config
TNA_RUFF_CONFIG_DIRECTORY="$(poetry run python -c 'from sysconfig import get_path; print(get_path("platlib"))')/tna_ruff_config"

# ...or pip
pip install tna-ruff-config
TNA_RUFF_CONFIG_DIRECTORY="$(python -c 'from sysconfig import get_path; print(get_path("platlib"))')/tna_ruff_config"

# Run Ruff check using the standard config
ruff check /app --fix --config "$TNA_RUFF_CONFIG_DIRECTORY/ruff.toml"
# Run the Ruff formatter using the standard config
ruff format /app --config "$TNA_RUFF_CONFIG_DIRECTORY/ruff.toml"

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

tna_ruff_config-0.1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tna_ruff_config-0.1.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file tna_ruff_config-0.1.2.tar.gz.

File metadata

  • Download URL: tna_ruff_config-0.1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tna_ruff_config-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d5158aa9c9989b5544869ef30e7bd3836d3e0bcc1641ce22277290c1ce7e91f7
MD5 76eb8e5125e84a3bbd2eab8152f6de56
BLAKE2b-256 6ca11fb249c35e29900cf98829d11daa5f1747f3da259cae800aca3a360a3ba2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tna_ruff_config-0.1.2.tar.gz:

Publisher: publish.yml on nationalarchives/ruff-config

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tna_ruff_config-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for tna_ruff_config-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11be5de08ec0f53b64405acc3abb3a29f0673064430704b55fa0750fc28d2756
MD5 c7392a506aa10159019fcdcf398cbb60
BLAKE2b-256 13808afbbdad8f503693ec7d980ee8680f6dee92f80fe5dfc365462a732344df

See more details on using hashes here.

Provenance

The following attestation bundles were made for tna_ruff_config-0.1.2-py3-none-any.whl:

Publisher: publish.yml on nationalarchives/ruff-config

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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