diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5dadaa830f..708ec3c696 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -434,7 +434,7 @@ screenshots or recordings of your change in action.
After opening the PR, an ecosystem report will be run as part of CI. This shows
a diff of linter and formatter behavior before and after the changes in your PR.
Going through these changes and reporting your findings in the PR summary or an
-additional comment help us to review your PR more efficiently. It's also a great
+additional comment helps us review your PR more efficiently. It's also a great
way to find new test cases to incorporate into your PR if you identify any
issues.
@@ -472,12 +472,11 @@ The documentation should then be available locally at
## Release Process
-As of now, Ruff has an ad hoc release process: releases are cut with high frequency via GitHub
+As of now, Ruff has an ad hoc release process: releases are cut frequently via GitHub
Actions, which automatically generates the appropriate wheels across architectures and publishes
them to [PyPI](https://pypi.org/project/ruff/).
-Ruff follows the [semver](https://semver.org/) versioning standard. However, as pre-1.0 software,
-even patch releases may contain [non-backwards-compatible changes](https://semver.org/#spec-item-4).
+See Ruff's [versioning policy](https://docs.astral.sh/ruff/versioning/).
### Installing tools
@@ -506,7 +505,7 @@ review and remaining preparation steps below. To prepare the release locally, st
1. The changelog should then be editorialized for consistency
- - Often labels will be missing from pull requests they will need to be manually organized into the proper section
+ - Pull requests often lack labels and will need to be manually organized into the proper section
- Changes should be edited to be user-facing descriptions, avoiding internal details
- Square brackets (eg, `[ruff]` project name) will be automatically escaped by `prek`
@@ -1110,8 +1109,8 @@ The project root does not have a significant impact beyond that all relative pat
configuration file are resolved relative to the project root.
For example, to indicate that `bar` above is a namespace package (it isn't, but let's run with it),
-the `pyproject.toml` would list `namespace-packages = ["./src/bar"]`, which would resolve
-to `my_project/src/bar`.
+the `pyproject.toml` would list `namespace-packages = ["./src/foo/bar"]`, which would resolve
+to `my_project/src/foo/bar`.
The same logic applies when providing a configuration file via `--config`. In that case, the
_current working directory_ is used as the project root, and so all paths in that configuration file
@@ -1180,5 +1179,5 @@ There are three ways in which an import can be categorized as "first-party":
the `src` setting and, for each directory, check for the existence of a subdirectory `foo` or a
file `foo.py`.
-By default, `src` is set to the project root, along with `"src"` subdirectory in the project root.
+By default, `src` is set to the project root, along with the `"src"` subdirectory in the project root.
This ensures that Ruff supports both flat and "src" layouts out of the box.
diff --git a/README.md b/README.md
index 2c7b5d001a..925c4337b5 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ Ruff can be used to replace [Flake8](https://pypi.org/project/flake8/) (plus doz
[autoflake](https://pypi.org/project/autoflake/), and more, all while executing tens or hundreds of
times faster than any individual tool.
-Ruff is extremely actively developed and used in major open-source projects like:
+Ruff is actively developed and used in major open-source projects like:
- [Apache Airflow](https://github.com/apache/airflow)
- [Apache Superset](https://github.com/apache/superset)
@@ -381,7 +381,7 @@ quality tools, including:
- [tryceratops](https://pypi.org/project/tryceratops/)
- [yesqa](https://pypi.org/project/yesqa/)
-For a complete enumeration of the supported rules, see [_Rules_](https://docs.astral.sh/ruff/rules/).
+For the complete list of supported rules, see [_Rules_](https://docs.astral.sh/ruff/rules/).
## Contributing
diff --git a/docs/configuration.md b/docs/configuration.md
index aaf4cd21b3..35191ea79c 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -251,10 +251,9 @@ For a complete enumeration of the available configuration options, see [_Setting
## Config file discovery
Similar to [ESLint](https://eslint.org/docs/latest/use/configure/configuration-files#cascading-configuration-objects),
-Ruff supports hierarchical configuration, such that the "closest" config file in the
-directory hierarchy is used for every individual file, with all paths in the config file
-(e.g., `exclude` globs, `src` paths) being resolved relative to the directory containing that
-config file.
+Ruff supports hierarchical configuration. For each file, Ruff uses the "closest" config file in the
+directory hierarchy. Paths in that config file (e.g., `exclude` globs and `src` paths) are resolved
+relative to the directory containing it.
There are a few exceptions to these rules:
@@ -264,9 +263,11 @@ There are a few exceptions to these rules:
analyzed files, and any relative paths in that configuration file (like `exclude` globs or
`src` paths) are resolved relative to the _current_ working directory.
1. If no config file is found in the filesystem hierarchy, Ruff will fall back to using
- a default configuration. If a user-specific configuration file exists
- at `${config_dir}/ruff/pyproject.toml`, that file will be used instead of the default
- configuration, with `${config_dir}` being determined via [`etcetera`'s base strategy](https://docs.rs/etcetera/latest/etcetera/#native-strategy),
+ a default configuration. If a user-specific configuration file exists at
+ `${config_dir}/ruff/.ruff.toml`, `${config_dir}/ruff/ruff.toml`, or
+ `${config_dir}/ruff/pyproject.toml` (checked in that order), the first such file will be used
+ instead of the default configuration, with `${config_dir}` being determined via
+ [`etcetera`'s base strategy](https://docs.rs/etcetera/latest/etcetera/#native-strategy),
and all relative paths being again resolved relative to the _current working directory_.
1. Any config-file-supported settings that are provided on the command-line (e.g., via
`--select`) will override the settings in _every_ resolved configuration file.
@@ -347,7 +348,8 @@ For example, without `force-exclude` enabled, `ruff check /path/to/excluded/file
### Default inclusions
-By default, Ruff will discover files matching `*.py`, `*.pyi`, `*.ipynb`, or `pyproject.toml`.
+By default, Ruff will discover files matching `*.py`, `*.pyi`, `*.ipynb`, `*.md`, `pyproject.toml`,
+`ruff.toml`, or `.ruff.toml`.
In [preview](preview.md) mode, Ruff will also discover `*.pyw` by default.
To lint or format files with additional file extensions, use the [`extend-include`](settings.md#extend-include) setting.
@@ -446,7 +448,7 @@ using the [`per-file-ignores`](settings.md#per-file-ignores) setting:
Some rules have different behavior when applied to Jupyter Notebook files. For
example, when applied to `.py` files the
[`module-import-not-at-top-of-file` (`E402`)](rules/module-import-not-at-top-of-file.md)
-rule detect imports at the top of a file, but for notebooks it detects imports at the top of a
+rule detects imports that are not at the top of a file. In notebooks, it applies that check to each
**cell**. For a given rule, the rule's documentation will always specify if it has different
behavior when applied to Jupyter Notebook files.
@@ -520,7 +522,7 @@ Ruff supports reading command-line arguments from a file, which is especially us
$ ruff check @path/to/args.txt
```
-The arguments in the file must all be written on their own line. For example, `args.txt` might contain:
+Each argument in the file must be written on its own line. For example, `args.txt` might contain:
```text
--select
diff --git a/docs/editors/features.md b/docs/editors/features.md
index 164d049594..1d0482f04a 100644
--- a/docs/editors/features.md
+++ b/docs/editors/features.md
@@ -4,7 +4,7 @@ This section provides a detailed overview of the features provided by the Ruff L
## Diagnostic Highlighting
-Provide diagnostics for your Python code in real-time.
+The server provides diagnostics for your Python code in real time.
= 0.8.13)
@@ -1114,9 +1112,9 @@ automatically decide between the two based on the Ruff version and extension set
### `path`
-A list of path to `ruff` executables.
+A list of paths to `ruff` executables.
-The first executable in the list which is exists is used. This setting takes precedence over the
+The first executable in the list that exists is used. This setting takes precedence over the
[`ruff.importStrategy`](#importstrategy) setting.
**Default value**: `[]`
diff --git a/docs/editors/setup.md b/docs/editors/setup.md
index 97adb09e6d..37489c698a 100644
--- a/docs/editors/setup.md
+++ b/docs/editors/setup.md
@@ -10,7 +10,7 @@ the [migration guide](./migration.md) for more.
!!! note
The setup instructions provided below are on a best-effort basis. If you encounter any issues
- while setting up the Ruff in an editor, please [open an issue](https://github.com/astral-sh/ruff/issues/new)
+ while setting up Ruff in an editor, please [open an issue](https://github.com/astral-sh/ruff/issues/new)
for assistance and help in improving this documentation.
## VS Code
@@ -25,11 +25,11 @@ For more documentation on the Ruff extension, refer to the
## Neovim
-The Ruff language server can be setup in Neovim using the built-in LSP client either via
+The Ruff language server can be set up in Neovim using the built-in LSP client either via
[`vim.lsp.config`]() (Neovim 0.11+) or the
[`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig) plugin (Neovim 0.10 and earlier).
-To setup using [`vim.lsp.config`](), you can
+To set up using [`vim.lsp.config`](), you can
either use the [default configuration provided in
`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/lsp/ruff.lua) or configure
the server without any external dependencies.
@@ -433,7 +433,7 @@ IntelliJ Marketplace (maintained by [@koxudaxi](https://github.com/koxudaxi)).
## Emacs
-Ruff can be utilized as a language server via [`Eglot`](https://github.com/joaotavora/eglot), which is in Emacs's core.
+Ruff can be used as a language server via [`Eglot`](https://github.com/joaotavora/eglot), which is in Emacs's core.
To enable Ruff with automatic formatting on save, use the following configuration:
```elisp
diff --git a/docs/faq.md b/docs/faq.md
index 1446e9a19f..9ba2592913 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -11,8 +11,10 @@ such, will defer implementing stylistic rules that are obviated by automated for
Note that Ruff's linter and Black treat line-length enforcement a little differently. Black, like
Ruff's formatter, makes a best-effort attempt to adhere to the
[`line-length`](settings.md#line-length), but avoids automatic line-wrapping in some cases (e.g.,
-within comments). Ruff, on the other hand, will flag [`line-too-long`](rules/line-too-long.md)
-(`E501`) for any line that exceeds the [`line-length`](settings.md#line-length) setting. As such, if
+within comments). Ruff's [`line-too-long`](rules/line-too-long.md) (`E501`) rule checks lines against
+[`line-length`](settings.md#line-length), subject to the rule's documented exceptions. You can
+override this limit for the linter with
+[`lint.pycodestyle.max-line-length`](settings.md#lint_pycodestyle_max-line-length). As such, if
[`line-too-long`](rules/line-too-long.md) (`E501`) is enabled, Ruff can still trigger line-length
violations even when Black or `ruff format` is enabled.
@@ -65,7 +67,7 @@ natively, including:
- [flake8-gettext](https://pypi.org/project/flake8-gettext/)
- [flake8-implicit-str-concat](https://pypi.org/project/flake8-implicit-str-concat/)
- [flake8-import-conventions](https://pypi.org/project/flake8-import-conventions/)
-- [flake8-logging](https://pypi.org/project/flake8-logging-format/)
+- [flake8-logging](https://pypi.org/project/flake8-logging/)
- [flake8-logging-format](https://pypi.org/project/flake8-logging-format/)
- [flake8-no-pep420](https://pypi.org/project/flake8-no-pep420)
- [flake8-pie](https://pypi.org/project/flake8-pie/)
@@ -290,9 +292,8 @@ Like isort, Ruff's import sorting is compatible with Black.
## How does Ruff determine which of my imports are first-party, third-party, etc.?
-Ruff accepts a `src` option that in your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` file,
-specifies the directories that Ruff should consider when determining whether an import is
-first-party.
+The `src` option in your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` file specifies the
+directories Ruff considers when determining whether an import is first-party.
For example, if you have a project with the following structure:
@@ -362,7 +363,7 @@ explicit, exclusive first-party source like so:
If your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` extends another configuration file, Ruff
will still use the directory containing your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` file as
-the project root (as opposed to the directory of the file pointed to via the `extends` option).
+the project root (as opposed to the directory of the file pointed to via the `extend` option).
For example, if you add a configuration file to the `tests` directory in the above example, you'll
want to explicitly set the `src` option in the extended configuration file:
@@ -460,8 +461,8 @@ Found 3 errors.
## Does Ruff support NumPy- or Google-style docstrings?
-Yes! To enforce a docstring convention, add a [`convention`](settings.md#lint_pydocstyle_convention)
-setting following to your configuration file:
+Yes! To enforce a docstring convention, add the following [`convention`](settings.md#lint_pydocstyle_convention)
+setting to your configuration file:
=== "pyproject.toml"
@@ -588,8 +589,8 @@ Ruff doesn't currently support INI files, like `setup.cfg` or `tox.ini`.
## How can I change Ruff's default configuration?
-When no configuration file is found, Ruff will look for a user-specific `ruff.toml` file as a
-last resort. This behavior is similar to Flake8's `~/.config/flake8`.
+When no project configuration file is found, Ruff looks for a user-specific `.ruff.toml`,
+`ruff.toml`, or `pyproject.toml`, in that order. The examples below use `ruff.toml`.
On macOS and Linux, Ruff expects that file to be located at `~/.config/ruff/ruff.toml`,
and respects the `XDG_CONFIG_HOME` specification.
@@ -631,7 +632,7 @@ Ruff does not support `source.organizeImports` and `source.fixAll` code actions
actions for the same such as `notebook.source.organizeImports` and `notebook.source.fixAll`
respectively.
-Ruff requires to have a full view of the notebook to provide accurate diagnostics and fixes. For
+Ruff requires a full view of the notebook to provide accurate diagnostics and fixes. For
example, if you have a cell that imports a module and another cell that uses that module, Ruff
needs to see both cells to mark the import as used. If Ruff were to only see one cell at a time,
it would incorrectly mark the import as unused.
diff --git a/docs/formatter.md b/docs/formatter.md
index 2ed29c8a6e..2c400f2947 100644
--- a/docs/formatter.md
+++ b/docs/formatter.md
@@ -269,8 +269,8 @@ print( 'hello' )
````
Any number of code blocks may be contained within a matching pair of `off` and
-`on` HTML comments, and any `off` comment *without* a matching `on` comment
-will implicitly cover the remaining portion of the document.
+`on` HTML comments. An `off` comment *without* a matching `on` comment covers
+the rest of the document.
The Ruff formatter will also recognize HTML comments from [blacken-docs][],
`` and ``, which are equivalent
@@ -661,7 +661,7 @@ while the stable formatting breaks _after_ the call or subscript.
## Sorting imports
-Currently, the Ruff formatter does not sort imports. In order to both sort imports and format,
+Currently, the Ruff formatter does not sort imports. To sort imports and format,
call the Ruff linter and then the formatter:
```shell
diff --git a/docs/formatter/black.md b/docs/formatter/black.md
index 7b160a0e07..a1b86861d2 100644
--- a/docs/formatter/black.md
+++ b/docs/formatter/black.md
@@ -244,8 +244,8 @@ def test(max_history):
Black's unstable style applies the same formatting.
-There are few rare cases where Ruff can't merge the implicitly concatenated strings automatically.
-In those cases, Ruff preserves if the implicit concatenated strings are formatted over multiple lines:
+In a few rare cases, Ruff can't merge implicitly concatenated strings automatically. In those
+cases, Ruff keeps the strings on multiple lines if they were written that way:
```python
# Input
@@ -346,7 +346,7 @@ Ruff will instead remove them:
await [1, 2, 3]
```
-This is more consistent to the formatting of other awaited expressions: Ruff and Black both
+This is more consistent with the formatting of other awaited expressions: Ruff and Black both
remove parentheses around, e.g., `await (1)`, only retaining them when syntactically required,
as in, e.g., `await (x := 1)`.
diff --git a/docs/integrations.md b/docs/integrations.md
index a5f741199b..887279f072 100644
--- a/docs/integrations.md
+++ b/docs/integrations.md
@@ -73,7 +73,8 @@ For example, to run `ruff check --select B ./src` using Ruff version `0.8.0`:
## GitLab CI/CD
-You can add the following configuration to `.gitlab-ci.yml` to run a `ruff format` in parallel with a `ruff check` compatible with GitLab's codequality report.
+Add the following configuration to `.gitlab-ci.yml` to run `ruff format` in parallel with
+`ruff check`, which produces a report compatible with GitLab's code quality report.
```yaml
.base_ruff:
diff --git a/docs/linter.md b/docs/linter.md
index 064ae8c8ab..857335f6b7 100644
--- a/docs/linter.md
+++ b/docs/linter.md
@@ -26,8 +26,8 @@ For the full list of supported options, run `ruff check --help`.
The set of enabled rules is controlled via the [`lint.select`](settings.md#lint_select),
[`lint.extend-select`](settings.md#lint_extend-select), and [`lint.ignore`](settings.md#lint_ignore) settings.
-Ruff's linter mirrors Flake8's rule code system, in which each rule code consists of a one-to-three
-letter prefix, followed by three digits (e.g., `F401`). The prefix indicates that "source" of the rule
+Ruff's linter uses Flake8-style rule codes: an alphabetic prefix followed by digits (e.g., `F401`).
+The prefix indicates the source of the rule
(e.g., `F` for Pyflakes, `E` for pycodestyle, `ANN` for flake8-annotations).
Rule selectors like [`lint.select`](settings.md#lint_select) and [`lint.ignore`](settings.md#lint_ignore) accept either
@@ -356,7 +356,7 @@ $ python -m timeit "head = next(iter(range(99999999)))"
5000000 loops, best of 5: 70.8 nsec per loop
```
-However, when the collection is empty, this raised exception changes from an `IndexError` to `StopIteration`:
+However, when the collection is empty, the raised exception changes from an `IndexError` to `StopIteration`:
```console
$ python -c 'list(range(0))[0]'
@@ -620,7 +620,7 @@ def foo():
foo()
```
-It is strongly suggested to use explicit range suppressions, in order to prevent
+We strongly suggest using explicit range suppressions to prevent
accidental suppressions of violations, especially at global module scope.
For this reason, a `RUF104` diagnostic will also be produced for any implicit range.
If implicit range suppressions are desired, the `RUF104` rule can be disabled,
@@ -679,7 +679,7 @@ line, at global module scope, and preferably near the top of the file:
# ruff: file-ignore[F401, ARG001]
```
-The full-level suppression comment specification is as follows:
+The file-level suppression comment specification is as follows:
- An own-line comment starting with case sensitive `#ruff:`, with optional whitespace
after the `#` symbol and `:` symbol, followed by `file-ignore[`, any rules to
diff --git a/docs/rule-proposals.md b/docs/rule-proposals.md
index 9f1fdbce8a..78d7e21a69 100644
--- a/docs/rule-proposals.md
+++ b/docs/rule-proposals.md
@@ -132,9 +132,9 @@ suppression comments should essentially never be reasonable for a `correctness`
for `suspicious` lints. The `suspicious` category also includes deprecations, which aren't incorrect
today but will cause errors in the future.
-The final branch of the flow chart deals with stylistic lints, which are again somewhat subjective
-to differentiate between changes that make code simpler often also make the code faster and
-more idiomatic. Thus, the question prompts you to consider the _primary_ improvement. Rules that
+The final branch of the flow chart deals with stylistic lints. These can be subjective to categorize:
+changes that make code simpler often also make it faster and more idiomatic. The question therefore
+prompts you to consider the _primary_ improvement. Rules that
primarily make code simpler are `complexity` lints, those that primarily make code faster or use
less memory are `performance` lints, and those that primarily make code more idiomatic are `style`.
diff --git a/docs/tutorial.md b/docs/tutorial.md
index 7b07c6744c..a7e079d195 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -23,6 +23,12 @@ numbers
└── py.typed
```
+Change into the project directory:
+
+```console
+$ cd numbers
+```
+
We'll then clear out the auto-generated content in `src/numbers/__init__.py`
and create `src/numbers/calculate.py` with the following code:
@@ -163,7 +169,7 @@ src/numbers/calculate.py:5:80: E501 Line too long (90 > 79)
Found 1 error.
```
-For a full enumeration of the supported settings, see [_Settings_](settings.md). For our project
+For the full list of supported settings, see [_Settings_](settings.md). For our project
specifically, we'll want to make note of the minimum supported Python version:
=== "pyproject.toml"