@@ -826,7 +826,8 @@ fn nursery_prefix() {
826826 -:1:1: RUF903 Hey this is a stable test rule with a display only fix.
827827 -:1:1: RUF920 Hey this is a deprecated test rule.
828828 -:1:1: RUF921 Hey this is another deprecated test rule.
829- Found 6 errors.
829+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
830+ Found 7 errors.
830831 [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
831832
832833 ----- stderr -----
@@ -850,7 +851,8 @@ fn nursery_all() {
850851 -:1:1: RUF903 Hey this is a stable test rule with a display only fix.
851852 -:1:1: RUF920 Hey this is a deprecated test rule.
852853 -:1:1: RUF921 Hey this is another deprecated test rule.
853- Found 7 errors.
854+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
855+ Found 8 errors.
854856 [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
855857
856858 ----- stderr -----
@@ -929,7 +931,8 @@ fn preview_enabled_prefix() {
929931 -:1:1: RUF903 Hey this is a stable test rule with a display only fix.
930932 -:1:1: RUF911 Hey this is a preview test rule.
931933 -:1:1: RUF912 Hey this is a nursery test rule.
932- Found 6 errors.
934+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
935+ Found 7 errors.
933936 [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
934937
935938 ----- stderr -----
@@ -953,7 +956,8 @@ fn preview_enabled_all() {
953956 -:1:1: RUF903 Hey this is a stable test rule with a display only fix.
954957 -:1:1: RUF911 Hey this is a preview test rule.
955958 -:1:1: RUF912 Hey this is a nursery test rule.
956- Found 8 errors.
959+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
960+ Found 9 errors.
957961 [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
958962
959963 ----- stderr -----
@@ -1088,7 +1092,8 @@ fn preview_enabled_group_ignore() {
10881092 -:1:1: RUF903 Hey this is a stable test rule with a display only fix.
10891093 -:1:1: RUF911 Hey this is a preview test rule.
10901094 -:1:1: RUF912 Hey this is a nursery test rule.
1091- Found 6 errors.
1095+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
1096+ Found 7 errors.
10921097 [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
10931098
10941099 ----- stderr -----
@@ -1145,6 +1150,53 @@ fn removed_indirect() {
11451150 "### ) ;
11461151}
11471152
1153+ #[ test]
1154+ fn redirect_direct ( ) {
1155+ // Selection of a redirected rule directly should use the new rule and warn
1156+ let mut cmd = RuffCheck :: default ( ) . args ( [ "--select" , "RUF940" ] ) . build ( ) ;
1157+ assert_cmd_snapshot ! ( cmd, @r###"
1158+ success: false
1159+ exit_code: 1
1160+ ----- stdout -----
1161+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
1162+ Found 1 error.
1163+
1164+ ----- stderr -----
1165+ warning: `RUF940` has been remapped to `RUF950`.
1166+ "### ) ;
1167+ }
1168+
1169+ #[ test]
1170+ fn redirect_indirect ( ) {
1171+ // Selection _including_ a redirected rule without matching should not fail
1172+ // nor should the rule be used
1173+ let mut cmd = RuffCheck :: default ( ) . args ( [ "--select" , "RUF94" ] ) . build ( ) ;
1174+ assert_cmd_snapshot ! ( cmd, @r###"
1175+ success: true
1176+ exit_code: 0
1177+ ----- stdout -----
1178+
1179+ ----- stderr -----
1180+ "### ) ;
1181+ }
1182+
1183+ #[ test]
1184+ fn redirect_prefix ( ) {
1185+ // Selection using a redirected prefix should switch to all rules in the
1186+ // new prefix
1187+ let mut cmd = RuffCheck :: default ( ) . args ( [ "--select" , "RUF96" ] ) . build ( ) ;
1188+ assert_cmd_snapshot ! ( cmd, @r###"
1189+ success: false
1190+ exit_code: 1
1191+ ----- stdout -----
1192+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
1193+ Found 1 error.
1194+
1195+ ----- stderr -----
1196+ warning: `RUF96` has been remapped to `RUF95`.
1197+ "### ) ;
1198+ }
1199+
11481200#[ test]
11491201fn deprecated_direct ( ) {
11501202 // Selection of a deprecated rule without preview enabled should still work
@@ -1770,7 +1822,8 @@ extend-safe-fixes = ["RUF9"]
17701822 -:1:1: RUF903 Hey this is a stable test rule with a display only fix.
17711823 -:1:1: RUF920 Hey this is a deprecated test rule.
17721824 -:1:1: RUF921 Hey this is another deprecated test rule.
1773- Found 6 errors.
1825+ -:1:1: RUF950 Hey this is a test rule that was redirected from another.
1826+ Found 7 errors.
17741827 [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
17751828
17761829 ----- stderr -----
0 commit comments