@@ -5891,3 +5891,113 @@ fn show_fixes_in_full_output_with_preview_enabled() {
58915891 " ,
58925892 ) ;
58935893}
5894+
5895+ #[ test]
5896+ fn rule_panic_mixed_results_concise ( ) -> Result < ( ) > {
5897+ let tempdir = TempDir :: new ( ) ?;
5898+
5899+ // Create python files
5900+ let file_a_path = tempdir. path ( ) . join ( "normal.py" ) ;
5901+ let file_b_path = tempdir. path ( ) . join ( "panic.py" ) ;
5902+ fs:: write ( & file_a_path, b"import os" ) ?;
5903+ fs:: write ( & file_b_path, b"print('hello, world!')" ) ?;
5904+
5905+ insta:: with_settings!( {
5906+ filters => vec![
5907+ ( tempdir_filter( & tempdir) . as_str( ) , "[TMP]/" ) ,
5908+ ( r"\\" , r"/" ) ,
5909+ ]
5910+ } , {
5911+ assert_cmd_snapshot!(
5912+ Command :: new( get_cargo_bin( BIN_NAME ) )
5913+ . args( [ "check" , "--select" , "RUF9" , "--preview" , "--output-format=concise" , "--no-cache" ] )
5914+ . args( [ file_a_path, file_b_path] ) ,
5915+ @r"
5916+ success: false
5917+ exit_code: 2
5918+ ----- stdout -----
5919+ [TMP]/normal.py:1:1: RUF900 Hey this is a stable test rule.
5920+ [TMP]/normal.py:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix.
5921+ [TMP]/normal.py:1:1: RUF902 Hey this is a stable test rule with an unsafe fix.
5922+ [TMP]/normal.py:1:1: RUF903 Hey this is a stable test rule with a display only fix.
5923+ [TMP]/normal.py:1:1: RUF911 Hey this is a preview test rule.
5924+ [TMP]/normal.py:1:1: RUF950 Hey this is a test rule that was redirected from another.
5925+ [TMP]/panic.py: panic: Fatal error while linting: This is a fake panic for testing.
5926+ Found 7 errors.
5927+ [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
5928+
5929+ ----- stderr -----
5930+ error: Panic during linting indicates a bug in Ruff. If you could open an issue at:
5931+
5932+ https://github.com/astral-sh/ruff/issues/new?title=%5BLinter%20panic%5D
5933+
5934+ ...with the relevant file contents, the `pyproject.toml` settings, and the stack trace above, we'd be very appreciative!
5935+ " ) ;
5936+ } ) ;
5937+ Ok ( ( ) )
5938+ }
5939+
5940+ #[ test]
5941+ fn rule_panic_mixed_results_full ( ) -> Result < ( ) > {
5942+ let tempdir = TempDir :: new ( ) ?;
5943+
5944+ // Create python files
5945+ let file_a_path = tempdir. path ( ) . join ( "normal.py" ) ;
5946+ let file_b_path = tempdir. path ( ) . join ( "panic.py" ) ;
5947+ fs:: write ( & file_a_path, b"import os" ) ?;
5948+ fs:: write ( & file_b_path, b"print('hello, world!')" ) ?;
5949+
5950+ insta:: with_settings!( {
5951+ filters => vec![
5952+ ( tempdir_filter( & tempdir) . as_str( ) , "[TMP]/" ) ,
5953+ ( r"\\" , r"/" ) ,
5954+ ]
5955+ } , {
5956+ assert_cmd_snapshot!(
5957+ Command :: new( get_cargo_bin( BIN_NAME ) )
5958+ . args( [ "check" , "--select" , "RUF9" , "--preview" , "--output-format=full" , "--no-cache" ] )
5959+ . args( [ file_a_path, file_b_path] ) ,
5960+ @r"
5961+ success: false
5962+ exit_code: 2
5963+ ----- stdout -----
5964+ RUF900 Hey this is a stable test rule.
5965+ --> [TMP]/normal.py:1:1
5966+
5967+ RUF901 [*] Hey this is a stable test rule with a safe fix.
5968+ --> [TMP]/normal.py:1:1
5969+ 1 + # fix from stable-test-rule-safe-fix
5970+ 2 | import os
5971+
5972+ RUF902 Hey this is a stable test rule with an unsafe fix.
5973+ --> [TMP]/normal.py:1:1
5974+
5975+ RUF903 Hey this is a stable test rule with a display only fix.
5976+ --> [TMP]/normal.py:1:1
5977+
5978+ RUF911 Hey this is a preview test rule.
5979+ --> [TMP]/normal.py:1:1
5980+
5981+ RUF950 Hey this is a test rule that was redirected from another.
5982+ --> [TMP]/normal.py:1:1
5983+
5984+ panic: Fatal error while linting: This is a fake panic for testing.
5985+ --> [TMP]/panic.py:1:1
5986+ info: panicked at crates/ruff_linter/src/rules/ruff/rules/test_rules.rs:511:9:
5987+ This is a fake panic for testing.
5988+ run with `RUST_BACKTRACE=1` environment variable to display a backtrace
5989+
5990+
5991+ Found 7 errors.
5992+ [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
5993+
5994+ ----- stderr -----
5995+ error: Panic during linting indicates a bug in Ruff. If you could open an issue at:
5996+
5997+ https://github.com/astral-sh/ruff/issues/new?title=%5BLinter%20panic%5D
5998+
5999+ ...with the relevant file contents, the `pyproject.toml` settings, and the stack trace above, we'd be very appreciative!
6000+ " ) ;
6001+ } ) ;
6002+ Ok ( ( ) )
6003+ }
0 commit comments