Skip to content

Commit

Permalink
Add an FAQ on autofix (#2163)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 25, 2023
1 parent 0e6f513 commit 6978dcf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,25 @@ matter how they're provided, which avoids accidental incompatibilities and simpl

Run `ruff /path/to/code.py --show-settings` to view the resolved settings for a given file.

### Ruff tried to fix something, but it broke my code. What should I do?

Ruff's autofix is a best-effort mechanism. Given the dynamic nature of Python, it's difficult to
have _complete_ certainty when making changes to code, even for the seemingly trivial fixes.

In the future, Ruff will support enabling autofix behavior based on the safety of the patch.

In the meantime, if you find that the autofix is too aggressive, you can disable it on a per-rule or
per-category basis using the [`unfixable`](#unfixable) mechanic. For example, to disable autofix
for some possibly-unsafe rules, you could add the following to your `pyproject.toml`:

```toml
[tool.ruff]
unfixable = ["B", "SIM", "TRY", "RUF"]
```

If you find a case where Ruff's autofix breaks your code, please file an Issue!


## Contributing

Contributions are welcome and hugely appreciated. To get started, check out the
Expand Down

0 comments on commit 6978dcf

Please sign in to comment.