ruff/crates/ruff_workspace/src
plredmond 7225732859
F401 - update documentation and deprecate `ignore_init_module_imports` (#11436)
## Summary

* Update documentation for F401 following recent PRs
  * #11168
  * #11314
* Deprecate `ignore_init_module_imports`
* Add a deprecation pragma to the option and a "warn user once" message
when the option is used.
* Restore the old behavior for stable (non-preview) mode:
* When `ignore_init_module_imports` is set to `true` (default) there are
no `__init_.py` fixes (but we get nice fix titles!).
* When `ignore_init_module_imports` is set to `false` there are unsafe
`__init__.py` fixes to remove unused imports.
* When preview mode is enabled, it overrides
`ignore_init_module_imports`.
* Fixed a bug in fix titles where `import foo as bar` would recommend
reexporting `bar as bar`. It now says to reexport `foo as foo`. (In this
case we don't issue a fix, fwiw; it was just a fix title bug.)

## Test plan

Added new fixture tests that reuse the existing fixtures for
`__init__.py` files. Each of the three situations listed above has
fixture tests. The F401 "stable" tests cover:

> * When `ignore_init_module_imports` is set to `true` (default) there
are no `__init_.py` fixes (but we get nice fix titles!).

The F401 "deprecated option" tests cover:

> * When `ignore_init_module_imports` is set to `false` there are unsafe
`__init__.py` fixes to remove unused imports.

These complement existing "preview" tests that show the new behavior
which recommends fixes in `__init__.py` according to whether the import
is 1st party and other circumstances (for more on that behavior see:
#11314).
2024-05-21 09:23:45 -07:00
..
configuration.rs F401 - update documentation and deprecate `ignore_init_module_imports` (#11436) 2024-05-21 09:23:45 -07:00
lib.rs Add most formatter options to `ruff.toml` / `pyproject.toml` (#7566) 2023-09-22 15:47:57 +00:00
options.rs F401 - update documentation and deprecate `ignore_init_module_imports` (#11436) 2024-05-21 09:23:45 -07:00
options_base.rs Add `--output-format` to `ruff config` CLI (#11438) 2024-05-15 22:17:33 -04:00
pyproject.rs [`pycodestyle`] Implement `redundant-backslash` (`E502`) (#10292) 2024-03-11 21:15:06 -04:00
resolver.rs Avoid parsing the root configuration twice (#10625) 2024-05-01 09:28:30 +00:00
settings.rs Remove `build` from the default exclusion list (#10093) 2024-02-28 16:30:38 +00:00