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

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.1.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.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tna_ruff_config-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 06b5a8379768d76e13db67f42a3ab1f9dad17cbc4f2de872b25556ce37663c79
MD5 84bad1d7a2a744d602c6d829065886db
BLAKE2b-256 49ed76d53f629e610f9a85afc371f3471348cf24c62ed57f1fefd2943c429068

See more details on using hashes here.

Provenance

The following attestation bundles were made for tna_ruff_config-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tna_ruff_config-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02446c0e58b5a91f592d2b21eedbdc4ef2e45af1aff7e3a4b12c27311b861ce1
MD5 bbdcb1998e84dc48b7a951c53f727e1e
BLAKE2b-256 1877f6ad4f1692e66188627dba6017a023529c9cad4b9a7844cf38d21768d3d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tna_ruff_config-0.1.1-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