ruff/crates/ruff_linter/src
Bohdan b45fd61ec5
[pyupgrade] Replace str, Enum with StrEnum (UP042) (#10713)
## Summary

Add new rule `pyupgrade - UP042` (I picked next available number).
Closes https://github.com/astral-sh/ruff/discussions/3867
Closes https://github.com/astral-sh/ruff/issues/9569

It should warn + provide a fix `class A(str, Enum)` -> `class
A(StrEnum)` for py311+.

## Test Plan

Added UP042.py test.

## Notes

I did not find a way to call `remove_argument` 2 times consecutively, so
the automatic fixing works only for classes that inherit exactly `str,
Enum` (regardless of the order).

I also plan to extend this rule to support IntEnum in next PR.
2024-04-06 01:56:28 +00:00
..
checkers [pyupgrade] Replace str, Enum with StrEnum (UP042) (#10713) 2024-04-06 01:56:28 +00:00
comments Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
cst Wrap expressions in parentheses when negating (#10346) 2024-03-11 18:20:55 -04:00
docstrings [pydocstyle-D405] Allow using parameters as a sub-section header (#9894) 2024-02-08 21:54:32 -05:00
fix [ruff] Fix panic in unused # noqa removal with multi-byte space (RUF100) (#10682) 2024-04-01 01:00:37 +00:00
importer Update Rust to v1.77 (#10510) 2024-03-21 12:10:33 -04:00
lex Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
message Feature: Add SARIF output support (#9078) 2023-12-13 00:33:19 -05:00
registry --show-settings displays active settings in a far more readable format (#9464) 2024-01-12 14:30:29 -05:00
rules [pyupgrade] Replace str, Enum with StrEnum (UP042) (#10713) 2024-04-06 01:56:28 +00:00
settings ruff server now supports the source.organizeImports source action (#10652) 2024-04-04 22:20:50 +00:00
snapshots Detect automagic-like assignments in notebooks (#9653) 2024-01-29 12:55:44 +00:00
codes.rs [pyupgrade] Replace str, Enum with StrEnum (UP042) (#10713) 2024-04-06 01:56:28 +00:00
directives.rs Track quoting style in the tokenizer (#10256) 2024-03-08 08:40:06 +00:00
doc_lines.rs Split Constant to individual literal nodes (#8064) 2023-10-30 12:13:23 +05:30
fs.rs Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
lib.rs Rename Autofix to Fix (#7657) 2023-09-28 10:53:05 +00:00
line_width.rs --show-settings displays active settings in a far more readable format (#9464) 2024-01-12 14:30:29 -05:00
linter.rs [pycodestyle] Implement redundant-backslash (E502) (#10292) 2024-03-11 21:15:06 -04:00
logging.rs Make --config and --isolated global flags (#10150) 2024-03-04 11:19:40 +00:00
noqa.rs Respect external codes in file-level exemptions (#10203) 2024-03-03 00:20:36 +00:00
packaging.rs Nested namespace packages support (#10541) 2024-03-24 22:53:32 -04:00
pyproject_toml.rs Update pyproject-toml to 0.8 (#8351) 2023-10-30 10:05:37 +00:00
registry.rs Put flake8-logging next to the other flake8 plugins in registry (#10587) 2024-03-25 20:23:31 +00:00
renamer.rs Correctly handle references in __all__ definitions when renaming symbols in autofixes (#10527) 2024-03-22 20:06:35 +00:00
rule_redirects.rs Bump version to 0.2.0 (#9762) 2024-02-01 17:10:33 -06:00
rule_selector.rs Fix clippy unused variable warning (#9902) 2024-02-08 22:13:31 +00:00
source_kind.rs CLI: Color entire line in Diffs (#10183) 2024-03-01 13:53:45 +01:00
test.rs Update Rust to v1.77 (#10510) 2024-03-21 12:10:33 -04:00
upstream_categories.rs Fix pylint upstream categories not showing in docs (#10441) 2024-03-18 01:27:39 +00:00