ruff/crates/ruff_cli
Lukasz Piatkowski 03303a9edd
Account for selector specificity when merging extend_unsafe_fixes and override extend_safe_fixes (#8444)
## Summary

Prior to this change `extend_unsafe_fixes` took precedence over
`extend_safe_fixes` selectors, so any conflicts were resolved in favour
of `extend_unsafe_fixes`. Thanks to that ruff were conservatively
assuming that if configs conlict the fix corresponding to selected rule
will be treated as unsafe.

After this change we take into account Specificity of the selectors. For
conflicts between selectors of the same Specificity we will treat the
corresponding fixes as unsafe. But if the conflicting selectors are of
different specificity the more specific one will win.

## Test Plan

Tests were added for the `FixSafetyTable` struct. The
`check_extend_unsafe_fixes_conflict_with_extend_safe_fixes_by_specificity`
integration test was added to test conflicting rules of different
specificity.

Fixes #8404

---------

Co-authored-by: Zanie <contact@zanie.dev>
2023-11-07 10:33:40 -06:00
..
resources/test/fixtures Formatter parentheses support for IpyEscapeCommand (#8207) 2023-10-25 14:01:50 +00:00
src Allow RUFF_NO_CACHE environment variable (like RUFF_CACHE_DIR) (#8538) 2023-11-07 08:35:28 -06:00
tests Account for selector specificity when merging extend_unsafe_fixes and override extend_safe_fixes (#8444) 2023-11-07 10:33:40 -06:00
build.rs Add ruff version with long version display (#8034) 2023-10-20 14:07:41 -05:00
Cargo.toml Bump version to v0.1.4 (#8477) 2023-11-03 14:52:56 -04:00