ruff/crates/ruff_cli/tests
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
..
snapshots Add cell field to JSON output format (#7664) 2023-10-13 01:06:02 +00:00
format.rs Respect --force-exclude for lint.exclude and format.exclude (#8393) 2023-10-31 17:45:48 -04:00
integration_test.rs Account for selector specificity when merging extend_unsafe_fixes and override extend_safe_fixes (#8444) 2023-11-07 10:33:40 -06:00
lint.rs Respect --force-exclude for lint.exclude and format.exclude (#8393) 2023-10-31 17:45:48 -04:00