Ruff
Ruff, a fast Python linter
ruff.toml.ruff.toml
Validate
Check your file against this schema
Opens the validator with this schema already loaded. Paste your
ruff.toml and it validates in your browser — nothing is uploaded.
Reference
Fields
Generated directly from the schema, following local
$refs, to two levels of nesting.
| Field | Type | Description |
|---|---|---|
allowed-confusablesdeprecated | array | null | A list of allowed "confusable" Unicode characters to ignore when enforcing `RUF001`, `RUF002`, and `RUF003`. |
analyze | anyOf | Options to configure import map generation. |
builtins | array | null | A list of builtins to treat as defined references, in addition to the system builtins. |
cache-dir | string | null | A path to the cache directory. By default, Ruff stores cache results in a `.ruff_cache` directory in the current project root. However, Ruff will also respect the `RUFF_CACHE_DIR` environment variable, which takes precedence over that |
dummy-variable-rgxdeprecated | string | null | A regular expression used to identify "dummy" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`. |
exclude | array | null | A list of file patterns to exclude from formatting and linting. Exclusions are based on globs, and can be either: - Single-path patterns, like `.mypy_cache` (to exclude any directory named `.mypy_cache` in the tree), `foo.py` (to exclude |
explicit-preview-rulesdeprecated | boolean | null | Whether to require exact codes to select preview rules. When enabled, preview rules will not be selected by prefixes — the full code of each preview rule will be required to enable the rule. |
extend | string | null | A path to a local `pyproject.toml` or `ruff.toml` file to merge into this configuration. User home directory and environment variables will be expanded. To resolve the current configuration file, Ruff will first load this base |
extend-exclude | array | null | A list of file patterns to omit from formatting and linting, in addition to those specified by [`exclude`](#exclude). Exclusions are based on globs, and can be either: - Single-path patterns, like `.mypy_cache` (to exclude any directory |
extend-fixabledeprecated | array | null | A list of rule codes or prefixes to consider fixable, in addition to those specified by [`fixable`](#lint_fixable). |
extend-ignoredeprecated | array | null | A list of rule codes or prefixes to ignore, in addition to those specified by `ignore`. This option is deprecated because it is now interchangeable with [`ignore`](#lint_ignore). In earlier versions of Ruff, `ignore` would _replace_ the |
extend-include | array | null | A list of file patterns to include when linting, in addition to those specified by [`include`](#include). Inclusion are based on globs, and should be single-path patterns, like `*.pyw`, to include any file with the `.pyw` extension. For |
extend-per-file-ignoresdeprecated | object | null | A list of mappings from file pattern to rule codes or prefixes to exclude, in addition to any rules excluded by [`per-file-ignores`](#lint_per-file-ignores). |
extend-safe-fixesdeprecated | array | null | A list of rule codes or prefixes for which unsafe fixes should be considered safe. |
extend-selectdeprecated | array | null | A list of rule codes or prefixes to enable, in addition to those specified by [`select`](#lint_select). Unlike [`select`](#lint_select), which _replaces_ the default rule set when specified, `extend-select` _adds_ to whatever rules are |
extend-unfixabledeprecated | array | null | A list of rule codes or prefixes to consider non-auto-fixable, in addition to those specified by [`unfixable`](#lint_unfixable). |
extend-unsafe-fixesdeprecated | array | null | A list of rule codes or prefixes for which safe fixes should be considered unsafe. |
extension | object | null | A mapping of custom file extensions to known file types (overridden by the `--extension` command-line flag). Supported file types include `python`, `pyi`, `ipynb`, and `markdown`. Any file extensions listed here will be automatically added |
externaldeprecated | array | null | A list of rule codes or prefixes that are unsupported by Ruff, but should be preserved when (e.g.) validating `# noqa` directives. Useful for retaining `# noqa` directives that cover plugins not yet implemented by Ruff. |
fix | boolean | null | Enable fix behavior by-default when running `ruff` (overridden by the `--fix` and `--no-fix` command-line flags). Only includes automatic fixes unless `--unsafe-fixes` is provided. |
fix-only | boolean | null | Like [`fix`](#fix), but disables reporting on leftover violation. Implies [`fix`](#fix). |
fixabledeprecated | array | null | A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable. |
flake8-annotationsdeprecated | anyOf | Options for the `flake8-annotations` plugin. |
flake8-banditdeprecated | anyOf | Options for the `flake8-bandit` plugin. |
flake8-boolean-trapdeprecated | anyOf | Options for the `flake8-boolean-trap` plugin. |
flake8-bugbeardeprecated | anyOf | Options for the `flake8-bugbear` plugin. |
flake8-builtinsdeprecated | anyOf | Options for the `flake8-builtins` plugin. |
flake8-comprehensionsdeprecated | anyOf | Options for the `flake8-comprehensions` plugin. |
flake8-copyrightdeprecated | anyOf | Options for the `flake8-copyright` plugin. |
flake8-errmsgdeprecated | anyOf | Options for the `flake8-errmsg` plugin. |
flake8-gettextdeprecated | anyOf | Options for the `flake8-gettext` plugin. |
flake8-implicit-str-concatdeprecated | anyOf | Options for the `flake8-implicit-str-concat` plugin. |
flake8-import-conventionsdeprecated | anyOf | Options for the `flake8-import-conventions` plugin. |
flake8-pytest-styledeprecated | anyOf | Options for the `flake8-pytest-style` plugin. |
flake8-quotesdeprecated | anyOf | Options for the `flake8-quotes` plugin. |
flake8-selfdeprecated | anyOf | Options for the `flake8_self` plugin. |
flake8-tidy-importsdeprecated | anyOf | Options for the `flake8-tidy-imports` plugin. |
flake8-type-checkingdeprecated | anyOf | Options for the `flake8-type-checking` plugin. |
flake8-unused-argumentsdeprecated | anyOf | Options for the `flake8-unused-arguments` plugin. |
force-exclude | boolean | null | Whether to enforce [`exclude`](#exclude) and [`extend-exclude`](#extend-exclude) patterns, even for paths that are passed to Ruff explicitly. Typically, Ruff will lint any paths passed in directly, even if they would typically be excluded |
format | anyOf | Options to configure code formatting. |
ignoredeprecated | array | null | A list of rule codes or prefixes to ignore. Prefixes can specify exact rules (like `F841`), entire groups (like `F`), or anything in between. When breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively) |
ignore-init-module-importsdeprecated | boolean | null | Avoid automatically removing unused imports in `__init__.py` files. Such imports will still be flagged, but with a dedicated message suggesting that the import is either added to the module's `__all__` symbol, or re-exported with a |
include | array | null | A list of file patterns to include when linting. Inclusion are based on globs, and should be single-path patterns, like `*.pyw`, to include any file with the `.pyw` extension. `pyproject.toml`, `ruff.toml`, and `.ruff.toml` are included |
indent-width | anyOf | The number of spaces per indentation level (tab). Used by the formatter and when enforcing long-line violations (like `E501`) to determine the visual width of a tab. This option changes the number of spaces the formatter inserts when using |
isortdeprecated | anyOf | Options for the `isort` plugin. |
line-length | anyOf | The line length to use when enforcing long-lines violations (like `E501`) and at which `isort` and the formatter prefers to wrap lines. The length is determined by the number of characters per line, except for lines containing East Asian |
lint | anyOf | — |
logger-objectsdeprecated | array | null | A list of objects that should be treated equivalently to a `logging.Logger` object. This is useful for ensuring proper diagnostics (e.g., to identify `logging` deprecations and other best-practices) for projects that re-export a |
mccabedeprecated | anyOf | Options for the `mccabe` plugin. |
namespace-packages | array | null | Mark the specified directories as namespace packages. For the purpose of module resolution, Ruff will treat those directories and all their subdirectories as if they contained an `__init__.py` file. |
output-format | anyOf | The style in which violation messages should be formatted: `"full"` (default) (shows source), `"concise"`, `"grouped"` (group messages by file), `"json"` (machine-readable), `"junit"` (machine-readable XML), `"github"` (GitHub Actions |
output-prefer-rule-codes | boolean | null | Whether to prefer rule codes over human-readable rule names in diagnostic output, even when preview mode is enabled. Diagnostics without rule codes, such as syntax errors and formatting diagnostics, will continue to use the human-readable |
pep8-namingdeprecated | anyOf | Options for the `pep8-naming` plugin. |
per-file-ignoresdeprecated | object | null | A list of mappings from file pattern to rule codes or prefixes to exclude, when considering any matching files. An initial '!' negates the file pattern. For more information on the glob syntax, refer to the [`globset` |
per-file-target-version | object | null | A list of mappings from glob-style file pattern to Python version to use when checking the corresponding file(s). This may be useful for overriding the global Python version settings in `target-version` or `requires-python` for a subset of |
preview | boolean | null | Whether to enable preview mode. When preview mode is enabled, Ruff will use unstable rules, fixes, and formatting. |
pycodestyledeprecated | anyOf | Options for the `pycodestyle` plugin. |
pydocstyledeprecated | anyOf | Options for the `pydocstyle` plugin. |
pyflakesdeprecated | anyOf | Options for the `pyflakes` plugin. |
pylintdeprecated | anyOf | Options for the `pylint` plugin. |
pyupgradedeprecated | anyOf | Options for the `pyupgrade` plugin. |
required-version | anyOf | Enforce a requirement on the version of Ruff, to enforce at runtime. If the version of Ruff does not meet the requirement, Ruff will exit with an error. Useful for unifying results across many environments, e.g., with a `pyproject.toml` |
respect-gitignore | boolean | null | Whether to automatically exclude files that are ignored by `.ignore`, `.gitignore`, `.git/info/exclude`, and global `gitignore` files. Enabled by default. |
selectdeprecated | array | null | A list of rule codes or prefixes to enable. Prefixes can specify exact rules (like `F841`), entire groups (like `F`), or anything in between. When breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively) |
show-fixes | boolean | null | Whether to show an enumeration of all fixed lint violations (overridden by the `--show-fixes` command-line flag). |
src | array | null | The directories to consider when resolving first- vs. third-party imports. When omitted, the `src` directory will typically default to including both: 1. The directory containing the nearest `pyproject.toml`, `ruff.toml`, or `.ruff.toml` |
target-version | anyOf | The minimum Python version to target, e.g., when considering automatic code upgrades, like rewriting type annotations. Ruff will not propose changes using features that are not available in the given version. For example, to represent |
task-tagsdeprecated | array | null | A list of task tags to recognize (e.g., "TODO", "FIXME", "XXX"). Comments starting with these tags will be ignored by commented-out code detection (`ERA`), and skipped by line-length rules (`E501`) if |
typing-modulesdeprecated | array | null | A list of modules whose exports should be treated equivalently to members of the `typing` module. This is useful for ensuring proper type annotation inference for projects that re-export `typing` and `typing_extensions` members from a |
unfixabledeprecated | array | null | A list of rule codes or prefixes to consider non-fixable. |
unsafe-fixes | boolean | null | Enable application of unsafe fixes. If excluded, a hint will be displayed when unsafe fixes are available. If set to false, the hint will be hidden. |
Audit
What we found in this schema
- Declared draft: draft-07
- Validates cleanly against its own meta-schema.
- 271 properties, 95% carrying a description, max nesting depth 8.
Standards
Specification sections for the keywords in this schema
| Keyword | Document | Section |
|---|---|---|
$ref | JSON Schema Core, draft 2020-12 | §8.2.3.1 — Direct References with "$ref" |
additionalProperties | JSON Schema Core, draft 2020-12 | §10.3.2.3 — "additionalProperties" |
anyOf | JSON Schema Core, draft 2020-12 | §10.2.1.2 — "anyOf" |
const | JSON Schema Validation, draft 2020-12 | §6.1.3 — "const" |
deprecated | JSON Schema Validation, draft 2020-12 | §9.3 — "deprecated" |
description | JSON Schema Validation, draft 2020-12 | §9.1 — "title" and "description" |
enum | JSON Schema Validation, draft 2020-12 | §6.1.2 — "enum" |
format | JSON Schema Validation, draft 2020-12 | §7 — Vocabularies for Semantic Content With "format" |
items | JSON Schema Core, draft 2020-12 | §10.3.1.2 — "items" |
maximum | JSON Schema Validation, draft 2020-12 | §6.2.2 — "maximum" |
minimum | JSON Schema Validation, draft 2020-12 | §6.2.4 — "minimum" |
oneOf | JSON Schema Core, draft 2020-12 | §10.2.1.3 — "oneOf" |
properties | JSON Schema Core, draft 2020-12 | §10.3.2.1 — "properties" |
type | JSON Schema Validation, draft 2020-12 | §6.1.1 — "type" |
Documents
- JSON Schema Core, draft 2020-12 — JSON Schema: A Media Type for Describing JSON Documents, A. Wright, H. Andrews, B. Hutton, G. Dennis, Eds., 2022. draft-bhutton-json-schema-01. An expired Internet-Draft with no formal standing in the IETF standards process; it is nonetheless the specification of record for JSON Schema 2020-12, published by json-schema.org.
- JSON Schema Validation, draft 2020-12 — JSON Schema Validation: A Vocabulary for Structural Validation of JSON, A. Wright, H. Andrews, B. Hutton, Eds., 2022.
- RFC 8259 (STD 90) — The JavaScript Object Notation (JSON) Data Interchange Format, T. Bray, Ed., 2017. The format a schema describes.
- RFC 6901 — JavaScript Object Notation (JSON) Pointer. Defines the pointer syntax used by $ref fragments and the ~0 / ~1 escapes.
Source
Attribution
This schema comes from SchemaStore, distributed under the Apache License 2.0. Copyright 2015–present Mads Kristensen and contributors. View the original file. The field table and audit on this page are generated by JSONTools.tools; the schema itself is unmodified.