mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
Update insta snapshots (#14366)
This commit is contained in:
parent
81e5830585
commit
c847cad389
2595 changed files with 3052 additions and 2578 deletions
|
@ -459,11 +459,11 @@ foo: 3.8- # trailing comment
|
|||
";
|
||||
let parsed_versions = TypeshedVersions::from_str(VERSIONS).unwrap();
|
||||
assert_eq!(parsed_versions.len(), 3);
|
||||
assert_snapshot!(parsed_versions.to_string(), @r###"
|
||||
assert_snapshot!(parsed_versions.to_string(), @r"
|
||||
bar: 2.7-3.10
|
||||
bar.baz: 3.1-3.9
|
||||
foo: 3.8-
|
||||
"###
|
||||
"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff/src/version.rs
|
||||
expression: version
|
||||
snapshot_kind: text
|
||||
---
|
||||
0.0.0
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff/src/version.rs
|
||||
expression: version
|
||||
snapshot_kind: text
|
||||
---
|
||||
0.0.0 (53b0f5d92 2023-10-19)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff/src/version.rs
|
||||
expression: version
|
||||
snapshot_kind: text
|
||||
---
|
||||
0.0.0+24 (53b0f5d92 2023-10-19)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff/src/version.rs
|
||||
expression: version
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"version": "0.0.0",
|
||||
|
|
|
@ -8,7 +8,7 @@ const BIN_NAME: &str = "ruff";
|
|||
#[test]
|
||||
fn lint_select() {
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("config").arg("lint.select"), @r###"
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("config").arg("lint.select"), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -29,14 +29,14 @@ fn lint_select() {
|
|||
```
|
||||
|
||||
----- stderr -----
|
||||
"###
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lint_select_json() {
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("config").arg("lint.select").arg("--output-format").arg("json"), @r###"
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("config").arg("lint.select").arg("--output-format").arg("json"), @r##"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -50,6 +50,6 @@ fn lint_select_json() {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"###
|
||||
"##
|
||||
);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ if condition:
|
|||
|
||||
print('Hy "Micha"') # Should not change quotes
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -45,7 +45,7 @@ if condition:
|
|||
print('Hy "Micha"') # Should not change quotes
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -65,7 +65,7 @@ bar = "needs formatting"
|
|||
)?;
|
||||
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--isolated", "--no-cache", "--check"]).current_dir(tempdir.path()), @r###"
|
||||
.args(["format", "--isolated", "--no-cache", "--check"]).current_dir(tempdir.path()), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -74,7 +74,7 @@ bar = "needs formatting"
|
|||
2 files would be reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ fn format_warn_stdin_filename_with_files() {
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--isolated", "--stdin-filename", "foo.py"])
|
||||
.arg("foo.py")
|
||||
.pass_stdin("foo = 1"), @r###"
|
||||
.pass_stdin("foo = 1"), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -92,13 +92,13 @@ fn format_warn_stdin_filename_with_files() {
|
|||
|
||||
----- stderr -----
|
||||
warning: Ignoring file foo.py in favor of standard input.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nonexistent_config_file() {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--config", "foo.toml", "."]), @r###"
|
||||
.args(["format", "--config", "foo.toml", "."]), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -114,13 +114,13 @@ fn nonexistent_config_file() {
|
|||
The path `foo.toml` does not point to a configuration file
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_override_rejected_if_invalid_toml() {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--config", "foo = bar", "."]), @r###"
|
||||
.args(["format", "--config", "foo = bar", "."]), @r#"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -142,7 +142,7 @@ fn config_override_rejected_if_invalid_toml() {
|
|||
expected `"`, `'`
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -161,19 +161,18 @@ fn too_many_config_files() -> Result<()> {
|
|||
.arg(&ruff_dot_toml)
|
||||
.arg("--config")
|
||||
.arg(&ruff2_dot_toml)
|
||||
.arg("."), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: You cannot specify more than one configuration file on the command line.
|
||||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: You cannot specify more than one configuration file on the command line.
|
||||
|
||||
tip: remove either `--config=[TMP]/ruff.toml` or `--config=[TMP]/ruff2.toml`.
|
||||
For more information, try `--help`.
|
||||
|
||||
"###);
|
||||
tip: remove either `--config=[TMP]/ruff.toml` or `--config=[TMP]/ruff2.toml`.
|
||||
For more information, try `--help`.
|
||||
");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -191,7 +190,7 @@ fn config_file_and_isolated() -> Result<()> {
|
|||
.arg("--config")
|
||||
.arg(&ruff_dot_toml)
|
||||
.arg("--isolated")
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -203,8 +202,7 @@ fn config_file_and_isolated() -> Result<()> {
|
|||
tip: You cannot specify a configuration file and also specify `--isolated`,
|
||||
as `--isolated` causes ruff to ignore all configuration files.
|
||||
For more information, try `--help`.
|
||||
|
||||
"###);
|
||||
");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -226,7 +224,7 @@ def foo():
|
|||
// This overrides the long line length set in the config file
|
||||
.args(["--config", "line-length=80"])
|
||||
.arg("-")
|
||||
.pass_stdin(fixture), @r###"
|
||||
.pass_stdin(fixture), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -236,7 +234,7 @@ def foo():
|
|||
)
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -259,7 +257,7 @@ def foo():
|
|||
// ...but this overrides them both:
|
||||
.args(["--line-length", "100"])
|
||||
.arg("-")
|
||||
.pass_stdin(fixture), @r###"
|
||||
.pass_stdin(fixture), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -267,7 +265,7 @@ def foo():
|
|||
print("looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong string")
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -302,7 +300,7 @@ if condition:
|
|||
|
||||
print("Should change quotes")
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -316,7 +314,7 @@ if condition:
|
|||
print('Should change quotes')
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -357,7 +355,7 @@ def f(x):
|
|||
>>> foo, bar, quux = this_is_a_long_line(lion, hippo, lemur, bear)
|
||||
'''
|
||||
pass
|
||||
"), @r###"
|
||||
"), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -403,7 +401,7 @@ def f(x):
|
|||
pass
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -424,14 +422,14 @@ fn mixed_line_endings() -> Result<()> {
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(tempdir.path())
|
||||
.args(["format", "--no-cache", "--diff", "--isolated"])
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
2 files already formatted
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -490,7 +488,7 @@ OTHER = "OTHER"
|
|||
// Explicitly pass test.py, should be formatted regardless of it being excluded by format.exclude
|
||||
.arg(test_path.file_name().unwrap())
|
||||
// Format all other files in the directory, should respect the `exclude` and `format.exclude` options
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -499,7 +497,7 @@ OTHER = "OTHER"
|
|||
2 files would be reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -517,14 +515,14 @@ from module import =
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(tempdir.path())
|
||||
.args(["format", "--no-cache", "--isolated", "--check"])
|
||||
.arg("main.py"), @r###"
|
||||
.arg("main.py"), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: Failed to parse main.py:2:20: Expected an import name
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -546,7 +544,7 @@ if __name__ == "__main__":
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(tempdir.path())
|
||||
.args(["format", "--no-cache", "--isolated", "--check"])
|
||||
.arg("main.py"), @r###"
|
||||
.arg("main.py"), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -554,31 +552,31 @@ if __name__ == "__main__":
|
|||
1 file would be reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(tempdir.path())
|
||||
.args(["format", "--no-cache", "--isolated"])
|
||||
.arg("main.py"), @r###"
|
||||
.arg("main.py"), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
1 file reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(tempdir.path())
|
||||
.args(["format", "--no-cache", "--isolated"])
|
||||
.arg("main.py"), @r###"
|
||||
.arg("main.py"), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
1 file left unchanged
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -638,7 +636,7 @@ OTHER = "OTHER"
|
|||
// Explicitly pass test.py, should be respect the `format.exclude` when `--force-exclude` is present
|
||||
.arg(test_path.file_name().unwrap())
|
||||
// Format all other files in the directory, should respect the `exclude` and `format.exclude` options
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -646,7 +644,7 @@ OTHER = "OTHER"
|
|||
1 file would be reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -673,7 +671,7 @@ from test import say_hy
|
|||
|
||||
if __name__ == '__main__':
|
||||
say_hy("dear Ruff contributor")
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -686,7 +684,7 @@ if __name__ == '__main__':
|
|||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
- 'ignore' -> 'lint.ignore'
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -713,7 +711,7 @@ from test import say_hy
|
|||
|
||||
if __name__ == '__main__':
|
||||
say_hy("dear Ruff contributor")
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -727,7 +725,7 @@ if __name__ == '__main__':
|
|||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
- 'ignore' -> 'lint.ignore'
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -770,7 +768,7 @@ if condition:
|
|||
|
||||
print("Should change quotes")
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -786,7 +784,7 @@ if condition:
|
|||
|
||||
----- stderr -----
|
||||
warning: The following rule may cause conflicts when used with the formatter: `COM812`. To avoid unexpected behavior, we recommend disabling this rule, either by removing it from the `select` or `extend-select` configuration, or adding it to the `ignore` configuration.
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -811,7 +809,7 @@ tab-size = 2
|
|||
.pass_stdin(r"
|
||||
if True:
|
||||
pass
|
||||
"), @r###"
|
||||
"), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -824,8 +822,7 @@ if True:
|
|||
1 |
|
||||
| ^
|
||||
unknown field `tab-size`
|
||||
|
||||
"###);
|
||||
");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -851,7 +848,7 @@ format = "json"
|
|||
.arg("-")
|
||||
.pass_stdin(r"
|
||||
import os
|
||||
"), @r###"
|
||||
"), @r#"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -864,8 +861,7 @@ format = "json"
|
|||
2 | format = "json"
|
||||
| ^^^^^^
|
||||
invalid type: string "json", expected struct FormatOptions
|
||||
|
||||
"###);
|
||||
"#);
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -912,7 +908,7 @@ def say_hy(name: str):
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--no-cache", "--config"])
|
||||
.arg(&ruff_toml)
|
||||
.arg(test_path), @r###"
|
||||
.arg(test_path), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -929,7 +925,7 @@ def say_hy(name: str):
|
|||
warning: The isort option `isort.lines-between-types` with a value greater than 1 is incompatible with the formatter. To avoid unexpected behavior, we recommend setting the option to one of: `1` or `0` (default).
|
||||
warning: The isort option `isort.force-wrap-aliases` is incompatible with the formatter `format.skip-magic-trailing-comma=true` option. To avoid unexpected behavior, we recommend either setting `isort.force-wrap-aliases=false` or `format.skip-magic-trailing-comma=false`.
|
||||
warning: The isort option `isort.split-on-trailing-comma` is incompatible with the formatter `format.skip-magic-trailing-comma=true` option. To avoid unexpected behavior, we recommend either setting `isort.split-on-trailing-comma=false` or `format.skip-magic-trailing-comma=false`.
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -970,7 +966,7 @@ indent-style = "tab"
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
def say_hy(name: str):
|
||||
print(f"Hy {name}")"#), @r###"
|
||||
print(f"Hy {name}")"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -988,7 +984,7 @@ def say_hy(name: str):
|
|||
warning: The isort option `isort.lines-between-types` with a value greater than 1 is incompatible with the formatter. To avoid unexpected behavior, we recommend setting the option to one of: `1` or `0` (default).
|
||||
warning: The isort option `isort.force-wrap-aliases` is incompatible with the formatter `format.skip-magic-trailing-comma=true` option. To avoid unexpected behavior, we recommend either setting `isort.force-wrap-aliases=false` or `format.skip-magic-trailing-comma=false`.
|
||||
warning: The isort option `isort.split-on-trailing-comma` is incompatible with the formatter `format.skip-magic-trailing-comma=true` option. To avoid unexpected behavior, we recommend either setting `isort.split-on-trailing-comma=false` or `format.skip-magic-trailing-comma=false`.
|
||||
"###);
|
||||
"#);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1032,14 +1028,14 @@ def say_hy(name: str):
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--no-cache", "--config"])
|
||||
.arg(&ruff_toml)
|
||||
.arg(test_path), @r###"
|
||||
.arg(test_path), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
1 file reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1074,14 +1070,14 @@ def say_hy(name: str):
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--no-cache", "--config"])
|
||||
.arg(&ruff_toml)
|
||||
.arg(test_path), @r###"
|
||||
.arg(test_path), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
1 file reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1109,7 +1105,7 @@ def say_hy(name: str):
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--no-cache", "--config"])
|
||||
.arg(&ruff_toml)
|
||||
.arg(test_path), @r###"
|
||||
.arg(test_path), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1119,7 +1115,7 @@ def say_hy(name: str):
|
|||
warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
|
||||
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
|
||||
warning: The following rules may cause conflicts when used with the formatter: `COM812`, `ISC001`. To avoid unexpected behavior, we recommend disabling these rules, either by removing them from the `select` or `extend-select` configuration, or adding them to the `ignore` configuration.
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1138,7 +1134,7 @@ fn test_diff() {
|
|||
]}, {
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).args(args).args(paths),
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1186,7 +1182,7 @@ fn test_diff() {
|
|||
|
||||
----- stderr -----
|
||||
2 files would be reformatted, 1 file already formatted
|
||||
"###);
|
||||
");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1201,7 +1197,7 @@ fn test_diff_no_change() {
|
|||
]}, {
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).args(args).args(paths),
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1216,7 +1212,7 @@ fn test_diff_no_change() {
|
|||
|
||||
----- stderr -----
|
||||
1 file would be reformatted
|
||||
"###
|
||||
"
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -1235,7 +1231,7 @@ fn test_diff_stdin_unformatted() {
|
|||
let unformatted = fs::read(fixtures.join("unformatted.py")).unwrap();
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).args(args).pass_stdin(unformatted),
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1249,7 +1245,7 @@ fn test_diff_stdin_unformatted() {
|
|||
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1259,13 +1255,13 @@ fn test_diff_stdin_formatted() {
|
|||
let unformatted = fs::read(fixtures.join("formatted.py")).unwrap();
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).args(args).pass_stdin(unformatted),
|
||||
@r###"
|
||||
@r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1275,7 +1271,7 @@ fn test_notebook_trailing_semicolon() {
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--isolated", "--stdin-filename", "test.ipynb"])
|
||||
.arg("-")
|
||||
.pass_stdin(unformatted), @r###"
|
||||
.pass_stdin(unformatted), @r##"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1694,7 +1690,7 @@ fn test_notebook_trailing_semicolon() {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"##);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1756,14 +1752,14 @@ include = ["*.ipy"]
|
|||
.arg("--no-cache")
|
||||
.args(["--config", &ruff_toml.file_name().unwrap().to_string_lossy()])
|
||||
.args(["--extension", "ipy:ipynb"])
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
1 file reformatted
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1776,7 +1772,7 @@ fn range_formatting() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Shouldn't format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1789,7 +1785,7 @@ def foo(arg1, arg2,):
|
|||
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1799,7 +1795,7 @@ fn range_formatting_unicode() {
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
def foo(arg1="👋🏽" ): print("Format this" )
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1808,7 +1804,7 @@ def foo(arg1="👋🏽" ): print("Format this" )
|
|||
print("Format this")
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1839,7 +1835,7 @@ def file2(arg1, arg2,):
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["format", "--isolated", "--range=1:8-1:15"])
|
||||
.arg(file1)
|
||||
.arg(file2), @r###"
|
||||
.arg(file2), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1847,7 +1843,7 @@ def file2(arg1, arg2,):
|
|||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: The `--range` option is only supported when formatting a single file but the specified paths resolve to 2 files.
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1861,7 +1857,7 @@ fn range_formatting_out_of_bounds() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Shouldn't format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1871,7 +1867,7 @@ def foo(arg1, arg2,):
|
|||
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1883,7 +1879,7 @@ fn range_start_larger_than_end() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Shouldn't format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1893,7 +1889,7 @@ def foo(arg1, arg2,):
|
|||
tip: Try switching start and end: '50:1-90:1'
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1905,7 +1901,7 @@ fn range_line_numbers_only() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Shouldn't format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1918,7 +1914,7 @@ def foo(arg1, arg2,):
|
|||
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1930,7 +1926,7 @@ fn range_start_only() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Should format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1939,7 +1935,7 @@ def foo(arg1, arg2,):
|
|||
print("Should format this")
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1975,7 +1971,7 @@ fn range_missing_line() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Should format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1985,7 +1981,7 @@ def foo(arg1, arg2,):
|
|||
tip: The format is 'line:column'.
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1997,7 +1993,7 @@ fn zero_line_number() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Should format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -2008,7 +2004,7 @@ def foo(arg1, arg2,):
|
|||
tip: Try 1:2 instead.
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2020,7 +2016,7 @@ fn column_and_line_zero() {
|
|||
def foo(arg1, arg2,):
|
||||
print("Should format this" )
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -2031,7 +2027,7 @@ def foo(arg1, arg2,):
|
|||
tip: Try 1:1 instead.
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2075,12 +2071,12 @@ fn range_formatting_notebook() {
|
|||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: Failed to format main.ipynb: Range formatting isn't supported for notebooks.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -42,7 +42,7 @@ inline-quotes = "single"
|
|||
.arg(&ruff_toml)
|
||||
.args(["--stdin-filename", "test.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r###"
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -56,7 +56,7 @@ inline-quotes = "single"
|
|||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `[TMP]/ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
- 'flake8-quotes' -> 'lint.flake8-quotes'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -85,7 +85,7 @@ inline-quotes = "single"
|
|||
.arg("--config")
|
||||
.arg(&ruff_toml)
|
||||
.arg("-")
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r###"
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -96,7 +96,7 @@ inline-quotes = "single"
|
|||
[*] 2 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -125,7 +125,7 @@ inline-quotes = "single"
|
|||
.arg("--config")
|
||||
.arg(&ruff_toml)
|
||||
.arg("-")
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r###"
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -138,7 +138,7 @@ inline-quotes = "single"
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `[TMP]/ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -171,7 +171,7 @@ inline-quotes = "single"
|
|||
.arg("--config")
|
||||
.arg(&ruff_toml)
|
||||
.arg("-")
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r###"
|
||||
.pass_stdin(r#"a = "abcba".strip("aba")"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -184,7 +184,7 @@ inline-quotes = "single"
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `[TMP]/ruff.toml`:
|
||||
- 'flake8-quotes' -> 'lint.flake8-quotes'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -252,7 +252,7 @@ OTHER = "OTHER"
|
|||
// Explicitly pass test.py, should be linted regardless of it being excluded by lint.exclude
|
||||
.arg(test_path.file_name().unwrap())
|
||||
// Lint all other files in the directory, should respect the `exclude` and `lint.exclude` options
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -265,7 +265,7 @@ OTHER = "OTHER"
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -302,7 +302,7 @@ from test import say_hy
|
|||
|
||||
if __name__ == "__main__":
|
||||
say_hy("dear Ruff contributor")
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -314,7 +314,7 @@ if __name__ == "__main__":
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -349,7 +349,7 @@ max-line-length = 100
|
|||
_ = "---------------------------------------------------------------------------亜亜亜亜亜亜"
|
||||
# longer than 100
|
||||
_ = "---------------------------------------------------------------------------亜亜亜亜亜亜亜亜亜亜亜亜亜亜"
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -360,7 +360,7 @@ _ = "---------------------------------------------------------------------------
|
|||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `[TMP]/ruff.toml`:
|
||||
- 'select' -> 'lint.select'
|
||||
- 'pycodestyle' -> 'lint.pycodestyle'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -397,7 +397,7 @@ from test import say_hy
|
|||
|
||||
if __name__ == "__main__":
|
||||
say_hy("dear Ruff contributor")
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -408,7 +408,7 @@ if __name__ == "__main__":
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -445,7 +445,7 @@ from test import say_hy
|
|||
|
||||
if __name__ == "__main__":
|
||||
say_hy("dear Ruff contributor")
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -456,7 +456,7 @@ if __name__ == "__main__":
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `ruff.toml`:
|
||||
- 'extend-select' -> 'lint.extend-select'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -493,7 +493,7 @@ ignore = ["D203", "D212"]
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(sub_dir)
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -501,7 +501,7 @@ ignore = ["D203", "D212"]
|
|||
|
||||
----- stderr -----
|
||||
warning: No Python files found under the given path(s)
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -511,7 +511,7 @@ ignore = ["D203", "D212"]
|
|||
fn nonexistent_config_file() {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
.args(["--config", "foo.toml", "."]), @r###"
|
||||
.args(["--config", "foo.toml", "."]), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -527,14 +527,14 @@ fn nonexistent_config_file() {
|
|||
The path `foo.toml` does not point to a configuration file
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_override_rejected_if_invalid_toml() {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
.args(["--config", "foo = bar", "."]), @r###"
|
||||
.args(["--config", "foo = bar", "."]), @r#"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -556,7 +556,7 @@ fn config_override_rejected_if_invalid_toml() {
|
|||
expected `"`, `'`
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -575,19 +575,18 @@ fn too_many_config_files() -> Result<()> {
|
|||
.arg(&ruff_dot_toml)
|
||||
.arg("--config")
|
||||
.arg(&ruff2_dot_toml)
|
||||
.arg("."), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: You cannot specify more than one configuration file on the command line.
|
||||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: You cannot specify more than one configuration file on the command line.
|
||||
|
||||
tip: remove either `--config=[TMP]/ruff.toml` or `--config=[TMP]/ruff2.toml`.
|
||||
For more information, try `--help`.
|
||||
|
||||
"###);
|
||||
tip: remove either `--config=[TMP]/ruff.toml` or `--config=[TMP]/ruff2.toml`.
|
||||
For more information, try `--help`.
|
||||
");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -596,7 +595,7 @@ fn too_many_config_files() -> Result<()> {
|
|||
fn extend_passed_via_config_argument() {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
.args(["--config", "extend = 'foo.toml'", "."]), @r###"
|
||||
.args(["--config", "extend = 'foo.toml'", "."]), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -607,7 +606,7 @@ fn extend_passed_via_config_argument() {
|
|||
tip: Cannot include `extend` in a --config flag value
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -623,20 +622,19 @@ fn config_file_and_isolated() -> Result<()> {
|
|||
.arg("--config")
|
||||
.arg(&ruff_dot_toml)
|
||||
.arg("--isolated")
|
||||
.arg("."), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: The argument `--config=[TMP]/ruff.toml` cannot be used with `--isolated`
|
||||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: The argument `--config=[TMP]/ruff.toml` cannot be used with `--isolated`
|
||||
|
||||
tip: You cannot specify a configuration file and also specify `--isolated`,
|
||||
as `--isolated` causes ruff to ignore all configuration files.
|
||||
For more information, try `--help`.
|
||||
|
||||
"###);
|
||||
tip: You cannot specify a configuration file and also specify `--isolated`,
|
||||
as `--isolated` causes ruff to ignore all configuration files.
|
||||
For more information, try `--help`.
|
||||
");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -681,7 +679,7 @@ x = "longer_than_90_charactersssssssssssssssssssssssssssssssssssssssssssssssssss
|
|||
.args(["--config", "lint.extend-select=['E501', 'F841']"])
|
||||
.args(["--config", "lint.isort.combine-as-imports = false"])
|
||||
.arg("-")
|
||||
.pass_stdin(fixture), @r###"
|
||||
.pass_stdin(fixture), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -691,7 +689,7 @@ x = "longer_than_90_charactersssssssssssssssssssssssssssssssssssssssssssssssssss
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -700,7 +698,7 @@ fn valid_toml_but_nonexistent_option_provided_via_config_argument() {
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
.args([".", "--config", "extend-select=['F481']"]), // No such code as F481!
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -717,7 +715,7 @@ fn valid_toml_but_nonexistent_option_provided_via_config_argument() {
|
|||
Unknown rule selector: `F481`
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -727,7 +725,7 @@ fn each_toml_option_requires_a_new_flag_1() {
|
|||
// commas can't be used to delimit different config overrides;
|
||||
// you need a new --config flag for each override
|
||||
.args([".", "--config", "extend-select=['F841'], line-length=90"]),
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -748,7 +746,7 @@ fn each_toml_option_requires_a_new_flag_1() {
|
|||
expected newline, `#`
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -758,7 +756,7 @@ fn each_toml_option_requires_a_new_flag_2() {
|
|||
// spaces *also* can't be used to delimit different config overrides;
|
||||
// you need a new --config flag for each override
|
||||
.args([".", "--config", "extend-select=['F841'] line-length=90"]),
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -779,7 +777,7 @@ fn each_toml_option_requires_a_new_flag_2() {
|
|||
expected newline, `#`
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -806,7 +804,7 @@ select=["E501"]
|
|||
.arg(&ruff_toml)
|
||||
.args(["--config", "line-length=110"])
|
||||
.arg("-")
|
||||
.pass_stdin(fixture), @r###"
|
||||
.pass_stdin(fixture), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -814,7 +812,7 @@ select=["E501"]
|
|||
Found 1 error.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -831,14 +829,14 @@ fn complex_config_setting_overridden_via_cli() -> Result<()> {
|
|||
.args(["--config", "lint.per-file-ignores = {'generated.py' = ['N801']}"])
|
||||
.args(["--stdin-filename", "generated.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(fixture), @r###"
|
||||
.pass_stdin(fixture), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
All checks passed!
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -848,7 +846,7 @@ fn deprecated_config_option_overridden_via_cli() {
|
|||
.args(STDIN_BASE_OPTIONS)
|
||||
.args(["--config", "select=['N801']", "-"])
|
||||
.pass_stdin("class lowercase: ..."),
|
||||
@r###"
|
||||
@r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -858,7 +856,7 @@ fn deprecated_config_option_overridden_via_cli() {
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in your `--config` CLI arguments:
|
||||
- 'select' -> 'lint.select'
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -922,7 +920,7 @@ include = ["*.ipy"]
|
|||
.args(STDIN_BASE_OPTIONS)
|
||||
.args(["--config", &ruff_toml.file_name().unwrap().to_string_lossy()])
|
||||
.args(["--extension", "ipy:ipynb"])
|
||||
.arg("."), @r###"
|
||||
.arg("."), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -931,7 +929,7 @@ include = ["*.ipy"]
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -960,7 +958,7 @@ external = ["AAA"]
|
|||
.pass_stdin(r#"
|
||||
# flake8: noqa: AAA101, BBB102
|
||||
import os
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -970,7 +968,7 @@ import os
|
|||
|
||||
----- stderr -----
|
||||
warning: Invalid rule code provided to `# ruff: noqa` at -:2: BBB102
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -999,7 +997,7 @@ required-version = "0.1.0"
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
import os
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1007,7 +1005,7 @@ import os
|
|||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: Required version `==0.1.0` does not match the running version `[VERSION]`
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1038,7 +1036,7 @@ required-version = "{version}"
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
import os
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1047,7 +1045,7 @@ import os
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1078,7 +1076,7 @@ required-version = ">{version}"
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
import os
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1086,7 +1084,7 @@ import os
|
|||
----- stderr -----
|
||||
ruff failed
|
||||
Cause: Required version `>[VERSION]` does not match the running version `[VERSION]`
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1115,7 +1113,7 @@ required-version = ">=0.1.0"
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
import os
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1124,7 +1122,7 @@ import os
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1156,7 +1154,7 @@ import os
|
|||
|
||||
def func():
|
||||
x = 1
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1165,7 +1163,7 @@ def func():
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1194,7 +1192,7 @@ fn negated_per_file_ignores() -> Result<()> {
|
|||
.arg("--select")
|
||||
.arg("RUF901")
|
||||
.current_dir(&tempdir)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1203,7 +1201,7 @@ fn negated_per_file_ignores() -> Result<()> {
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1233,7 +1231,7 @@ fn negated_per_file_ignores_absolute() -> Result<()> {
|
|||
.arg("--select")
|
||||
.arg("RUF901")
|
||||
.current_dir(&tempdir)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1242,7 +1240,7 @@ fn negated_per_file_ignores_absolute() -> Result<()> {
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1272,14 +1270,14 @@ fn negated_per_file_ignores_overlap() -> Result<()> {
|
|||
.arg("--select")
|
||||
.arg("RUF901")
|
||||
.current_dir(&tempdir)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
All checks passed!
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1309,7 @@ import os # F401
|
|||
def function():
|
||||
import os # F811
|
||||
print(os.name)
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1323,7 +1321,7 @@ def function():
|
|||
|
||||
----- stderr -----
|
||||
Found 1 error (1 fixed, 0 remaining).
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1363,22 +1361,22 @@ def first_square():
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Added 1 noqa directive.
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
let test_code = std::fs::read_to_string(&test_path).expect("should read test file");
|
||||
|
||||
insta::assert_snapshot!(test_code, @r###"
|
||||
insta::assert_snapshot!(test_code, @r"
|
||||
def first_square():
|
||||
return [x * x for x in range(20)][0] # noqa: RUF015
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1418,23 +1416,22 @@ def unused(x):
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Added 1 noqa directive.
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
let test_code = std::fs::read_to_string(&test_path).expect("should read test file");
|
||||
|
||||
insta::assert_snapshot!(test_code, @r###"
|
||||
|
||||
insta::assert_snapshot!(test_code, @r"
|
||||
def unused(x): # noqa: ANN001, ANN201, D103
|
||||
pass
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1474,24 +1471,23 @@ import a
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Added 1 noqa directive.
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
let test_code = std::fs::read_to_string(&test_path).expect("should read test file");
|
||||
|
||||
insta::assert_snapshot!(test_code, @r###"
|
||||
|
||||
insta::assert_snapshot!(test_code, @r"
|
||||
import z # noqa: I001
|
||||
import c
|
||||
import a
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1531,23 +1527,22 @@ def unused(x): # noqa: ANN001, ARG001, D103
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Added 1 noqa directive.
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
let test_code = std::fs::read_to_string(&test_path).expect("should read test file");
|
||||
|
||||
insta::assert_snapshot!(test_code, @r###"
|
||||
|
||||
insta::assert_snapshot!(test_code, @r"
|
||||
def unused(x): # noqa: ANN001, ANN201, ARG001, D103
|
||||
pass
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1592,19 +1587,19 @@ print(
|
|||
.arg("-")
|
||||
.pass_stdin(r#"
|
||||
|
||||
"#), @r###"
|
||||
"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Added 1 noqa directive.
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
let test_code = std::fs::read_to_string(&test_path).expect("should read test file");
|
||||
|
||||
insta::assert_snapshot!(test_code, @r###"
|
||||
insta::assert_snapshot!(test_code, @r#"
|
||||
print(
|
||||
"""First line
|
||||
second line
|
||||
|
@ -1612,7 +1607,7 @@ print(
|
|||
%s""" # noqa: UP031
|
||||
% name
|
||||
)
|
||||
"###);
|
||||
"#);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1656,14 +1651,14 @@ def first_square():
|
|||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.current_dir(tempdir.path())
|
||||
.args(STDIN_BASE_OPTIONS)
|
||||
.args(["--add-noqa"]), @r###"
|
||||
.args(["--add-noqa"]), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Added 1 noqa directive.
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1693,7 +1688,7 @@ select = ["UP006"]
|
|||
.arg(&ruff_toml)
|
||||
.args(["--stdin-filename", "test.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r###"
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1702,7 +1697,7 @@ select = ["UP006"]
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
let pyproject_toml = tempdir.path().join("pyproject.toml");
|
||||
|
@ -1725,14 +1720,14 @@ select = ["UP006"]
|
|||
.arg(&pyproject_toml)
|
||||
.args(["--stdin-filename", "test.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r###"
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
All checks passed!
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1762,7 +1757,7 @@ select = ["UP006"]
|
|||
.arg(&pyproject_toml)
|
||||
.args(["--stdin-filename", "test.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r###"
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1771,7 +1766,7 @@ select = ["UP006"]
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1801,7 +1796,7 @@ select = ["UP006"]
|
|||
.arg(&pyproject_toml)
|
||||
.args(["--stdin-filename", "test.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r###"
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1810,7 +1805,7 @@ select = ["UP006"]
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1840,7 +1835,7 @@ select = ["UP006"]
|
|||
.arg(&pyproject_toml)
|
||||
.args(["--stdin-filename", "test.py"])
|
||||
.arg("-")
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r###"
|
||||
.pass_stdin(r#"from typing import List; foo: List[int]"#), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1849,7 +1844,7 @@ select = ["UP006"]
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -1904,7 +1899,7 @@ fn checks_notebooks_in_stable() -> anyhow::Result<()> {
|
|||
.arg("--select")
|
||||
.arg("F401")
|
||||
.current_dir(&tempdir)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1913,7 +1908,7 @@ fn checks_notebooks_in_stable() -> anyhow::Result<()> {
|
|||
[*] 1 fixable with the `--fix` option.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1942,14 +1937,14 @@ fn nested_implicit_namespace_package() -> Result<()> {
|
|||
.arg("--select")
|
||||
.arg("INP")
|
||||
.current_dir(&tempdir)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
All checks passed!
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
|
||||
insta::with_settings!({filters => vec![(r"\\", "/")]}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
|
@ -1958,7 +1953,7 @@ fn nested_implicit_namespace_package() -> Result<()> {
|
|||
.arg("INP")
|
||||
.arg("--preview")
|
||||
.current_dir(&tempdir)
|
||||
, @r###"
|
||||
, @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1966,7 +1961,7 @@ fn nested_implicit_namespace_package() -> Result<()> {
|
|||
Found 1 error.
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -29,7 +29,7 @@ fn check_project_include_defaults() {
|
|||
filters => TEST_FILTERS.to_vec()
|
||||
}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["check", "--show-files"]).current_dir(Path::new("./resources/test/fixtures/include-test")), @r###"
|
||||
.args(["check", "--show-files"]).current_dir(Path::new("./resources/test/fixtures/include-test")), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -41,7 +41,7 @@ fn check_project_include_defaults() {
|
|||
----- stderr -----
|
||||
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `nested-project/pyproject.toml`:
|
||||
- 'select' -> 'lint.select'
|
||||
"###);
|
||||
");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,14 @@ fn check_project_respects_direct_paths() {
|
|||
filters => TEST_FILTERS.to_vec()
|
||||
}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["check", "--show-files", "b.py"]).current_dir(Path::new("./resources/test/fixtures/include-test")), @r###"
|
||||
.args(["check", "--show-files", "b.py"]).current_dir(Path::new("./resources/test/fixtures/include-test")), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
[BASEPATH]/include-test/b.py
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -72,14 +72,14 @@ fn check_project_respects_subdirectory_includes() {
|
|||
filters => TEST_FILTERS.to_vec()
|
||||
}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["check", "--show-files", "subdirectory"]).current_dir(Path::new("./resources/test/fixtures/include-test")), @r###"
|
||||
.args(["check", "--show-files", "subdirectory"]).current_dir(Path::new("./resources/test/fixtures/include-test")), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
[BASEPATH]/include-test/subdirectory/c.py
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,13 @@ fn check_project_from_project_subdirectory_respects_includes() {
|
|||
filters => TEST_FILTERS.to_vec()
|
||||
}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.args(["check", "--show-files"]).current_dir(Path::new("./resources/test/fixtures/include-test/subdirectory")), @r###"
|
||||
.args(["check", "--show-files"]).current_dir(Path::new("./resources/test/fixtures/include-test/subdirectory")), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
[BASEPATH]/include-test/subdirectory/c.py
|
||||
|
||||
----- stderr -----
|
||||
"###);
|
||||
");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ info:
|
|||
args:
|
||||
- rule
|
||||
- F401
|
||||
snapshot_kind: text
|
||||
---
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
|
|
@ -6,6 +6,7 @@ info:
|
|||
- check
|
||||
- "--show-settings"
|
||||
- unformatted.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
|
|
@ -16,14 +16,14 @@ const VERSION_FILTER: [(&str, &str); 1] = [(
|
|||
fn version_basics() {
|
||||
insta::with_settings!({filters => VERSION_FILTER.to_vec()}, {
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("version"), @r###"
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("version"), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
ruff [VERSION]
|
||||
|
||||
----- stderr -----
|
||||
"###
|
||||
"
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ fn config_option_allowed_but_ignored() -> Result<()> {
|
|||
.arg("version")
|
||||
.arg("--config")
|
||||
.arg(&ruff_dot_toml)
|
||||
.args(["--config", "lint.isort.extra-standard-library = ['foo', 'bar']"]), @r###"
|
||||
.args(["--config", "lint.isort.extra-standard-library = ['foo', 'bar']"]), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
ruff [VERSION]
|
||||
|
||||
----- stderr -----
|
||||
"###
|
||||
"
|
||||
);
|
||||
});
|
||||
Ok(())
|
||||
|
@ -60,7 +60,7 @@ fn config_option_ignored_but_validated() {
|
|||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME))
|
||||
.arg("version")
|
||||
.args(["--config", "foo = bar"]), @r###"
|
||||
.args(["--config", "foo = bar"]), @r#"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -82,7 +82,7 @@ fn config_option_ignored_but_validated() {
|
|||
expected `"`, `'`
|
||||
|
||||
For more information, try '--help'.
|
||||
"###
|
||||
"#
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -92,14 +92,14 @@ fn config_option_ignored_but_validated() {
|
|||
fn isolated_option_allowed() {
|
||||
insta::with_settings!({filters => VERSION_FILTER.to_vec()}, {
|
||||
assert_cmd_snapshot!(
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("version").arg("--isolated"), @r###"
|
||||
Command::new(get_cargo_bin(BIN_NAME)).arg("version").arg("--isolated"), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
ruff [VERSION]
|
||||
|
||||
----- stderr -----
|
||||
"###
|
||||
"
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -418,7 +418,7 @@ pub(crate) mod tests {
|
|||
|
||||
#[test]
|
||||
fn filesystem_debug_implementation_alternate() {
|
||||
assert_snapshot!(format!("{:#?}", mock_typeshed()), @r###"
|
||||
assert_snapshot!(format!("{:#?}", mock_typeshed()), @r#"
|
||||
VendoredFileSystem {
|
||||
inner_mutex_poisoned: false,
|
||||
paths: [
|
||||
|
@ -454,7 +454,7 @@ pub(crate) mod tests {
|
|||
},
|
||||
},
|
||||
}
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
fn test_directory(dirname: &str) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
snapshot_kind: text
|
||||
---
|
||||
None
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
snapshot_kind: text
|
||||
---
|
||||
None
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
snapshot_kind: text
|
||||
---
|
||||
Some(
|
||||
ShebangDirective(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
snapshot_kind: text
|
||||
---
|
||||
Some(
|
||||
ShebangDirective(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/comments/shebang.rs
|
||||
expression: "ShebangDirective::try_extract(source)"
|
||||
snapshot_kind: text
|
||||
---
|
||||
None
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/azure.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
##vso[task.logissue type=error;sourcepath=fib.py;linenumber=1;columnnumber=8;code=F401;]`os` imported but unused
|
||||
##vso[task.logissue type=error;sourcepath=fib.py;linenumber=6;columnnumber=5;code=F841;]Local variable `x` is assigned to but never used
|
||||
##vso[task.logissue type=error;sourcepath=undef.py;linenumber=1;columnnumber=4;code=F821;]Undefined name `a`
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/azure.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=1;columnnumber=15;]SyntaxError: Expected one or more symbol names after import
|
||||
##vso[task.logissue type=error;sourcepath=syntax_errors.py;linenumber=3;columnnumber=12;]SyntaxError: Expected ')', found newline
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/github.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
::error title=Ruff (F401),file=fib.py,line=1,col=8,endLine=1,endColumn=10::fib.py:1:8: F401 `os` imported but unused
|
||||
::error title=Ruff (F841),file=fib.py,line=6,col=5,endLine=6,endColumn=6::fib.py:6:5: F841 Local variable `x` is assigned to but never used
|
||||
::error title=Ruff (F821),file=undef.py,line=1,col=4,endLine=1,endColumn=5::undef.py:1:4: F821 Undefined name `a`
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/github.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
::error title=Ruff,file=syntax_errors.py,line=1,col=15,endLine=2,endColumn=1::syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import
|
||||
::error title=Ruff,file=syntax_errors.py,line=3,col=12,endLine=4,endColumn=1::syntax_errors.py:3:12: SyntaxError: Expected ')', found newline
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/gitlab.rs
|
||||
expression: redact_fingerprint(&content)
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/gitlab.rs
|
||||
expression: redact_fingerprint(&content)
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/grouped.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:
|
||||
1:8 F401 `os` imported but unused
|
||||
|
@ -8,5 +9,3 @@ fib.py:
|
|||
|
||||
undef.py:
|
||||
1:4 F821 Undefined name `a`
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/grouped.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:
|
||||
1:8 F401 `os` imported but unused
|
||||
|
@ -27,5 +28,3 @@ undef.py:
|
|||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/grouped.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:
|
||||
1:8 F401 [*] `os` imported but unused
|
||||
|
@ -27,5 +28,3 @@ undef.py:
|
|||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/grouped.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:
|
||||
1:8 F401 `os` imported but unused
|
||||
|
@ -27,5 +28,3 @@ undef.py:
|
|||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/grouped.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
syntax_errors.py:
|
||||
1:15 SyntaxError: Expected one or more symbol names after import
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/json.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/json.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/json.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/json_lines.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
{"cell":1,"code":"F401","end_location":{"column":10,"row":2},"filename":"notebook.ipynb","fix":{"applicability":"safe","edits":[{"content":"","end_location":{"column":10,"row":2},"location":{"column":1,"row":2}}],"message":"Remove unused import: `os`"},"location":{"column":8,"row":2},"message":"`os` imported but unused","noqa_row":2,"url":"https://docs.astral.sh/ruff/rules/unused-import"}
|
||||
{"cell":2,"code":"F401","end_location":{"column":12,"row":2},"filename":"notebook.ipynb","fix":{"applicability":"safe","edits":[{"content":"","end_location":{"column":1,"row":3},"location":{"column":1,"row":2}}],"message":"Remove unused import: `math`"},"location":{"column":8,"row":2},"message":"`math` imported but unused","noqa_row":2,"url":"https://docs.astral.sh/ruff/rules/unused-import"}
|
||||
{"cell":3,"code":"F841","end_location":{"column":6,"row":4},"filename":"notebook.ipynb","fix":{"applicability":"unsafe","edits":[{"content":"","end_location":{"column":10,"row":4},"location":{"column":1,"row":4}}],"message":"Remove assignment to unused variable `x`"},"location":{"column":5,"row":4},"message":"Local variable `x` is assigned to but never used","noqa_row":4,"url":"https://docs.astral.sh/ruff/rules/unused-variable"}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/json_lines.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
{"cell":null,"code":"F401","end_location":{"column":10,"row":1},"filename":"fib.py","fix":{"applicability":"unsafe","edits":[{"content":"","end_location":{"column":1,"row":2},"location":{"column":1,"row":1}}],"message":"Remove unused import: `os`"},"location":{"column":8,"row":1},"message":"`os` imported but unused","noqa_row":1,"url":"https://docs.astral.sh/ruff/rules/unused-import"}
|
||||
{"cell":null,"code":"F841","end_location":{"column":6,"row":6},"filename":"fib.py","fix":{"applicability":"unsafe","edits":[{"content":"","end_location":{"column":10,"row":6},"location":{"column":5,"row":6}}],"message":"Remove assignment to unused variable `x`"},"location":{"column":5,"row":6},"message":"Local variable `x` is assigned to but never used","noqa_row":6,"url":"https://docs.astral.sh/ruff/rules/unused-variable"}
|
||||
{"cell":null,"code":"F821","end_location":{"column":5,"row":1},"filename":"undef.py","fix":null,"location":{"column":4,"row":1},"message":"Undefined name `a`","noqa_row":1,"url":"https://docs.astral.sh/ruff/rules/undefined-name"}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/json_lines.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
{"cell":null,"code":null,"end_location":{"column":1,"row":2},"filename":"syntax_errors.py","fix":null,"location":{"column":15,"row":1},"message":"SyntaxError: Expected one or more symbol names after import","noqa_row":null,"url":null}
|
||||
{"cell":null,"code":null,"end_location":{"column":1,"row":4},"filename":"syntax_errors.py","fix":null,"location":{"column":12,"row":3},"message":"SyntaxError: Expected ')', found newline","noqa_row":null,"url":null}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/junit.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="ruff" tests="3" failures="3" errors="0">
|
||||
|
@ -18,4 +19,3 @@ expression: content
|
|||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/junit.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites name="ruff" tests="2" failures="2" errors="0">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/pylint.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:1: [F401] `os` imported but unused
|
||||
fib.py:6: [F841] Local variable `x` is assigned to but never used
|
||||
undef.py:1: [F821] Undefined name `a`
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/pylint.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
syntax_errors.py:1: SyntaxError: Expected one or more symbol names after import
|
||||
syntax_errors.py:3: SyntaxError: Expected ')', found newline
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/rdjson.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"diagnostics": [
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/rdjson.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"diagnostics": [
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/sarif.rs
|
||||
expression: value
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/text.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:1:8: F401 `os` imported but unused
|
||||
|
|
||||
|
@ -25,5 +26,3 @@ undef.py:1:4: F821 Undefined name `a`
|
|||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/text.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:1:8: F401 `os` imported but unused
|
||||
|
|
||||
|
@ -25,5 +26,3 @@ undef.py:1:4: F821 Undefined name `a`
|
|||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/text.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
fib.py:1:8: F401 [*] `os` imported but unused
|
||||
|
|
||||
|
@ -25,5 +26,3 @@ undef.py:1:4: F821 Undefined name `a`
|
|||
1 | if a == 1: pass
|
||||
| ^ F821
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/text.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
notebook.ipynb:cell 1:2:8: F401 [*] `os` imported but unused
|
||||
|
|
||||
|
@ -28,5 +29,3 @@ notebook.ipynb:cell 3:4:5: F841 [*] Local variable `x` is assigned to but never
|
|||
| ^ F841
|
||||
|
|
||||
= help: Remove assignment to unused variable `x`
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/message/text.rs
|
||||
expression: content
|
||||
snapshot_kind: text
|
||||
---
|
||||
syntax_errors.py:1:15: SyntaxError: Expected one or more symbol names after import
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
AIR001.py:11:1: AIR001 Task variable name should match the `task_id`: "my_task"
|
||||
|
|
||||
|
@ -18,5 +19,3 @@ AIR001.py:12:1: AIR001 Task variable name should match the `task_id`: "my_task_2
|
|||
13 |
|
||||
14 | from my_module import MyClass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/eradicate/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ERA001.py:1:1: ERA001 Found commented-out code
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/fastapi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated`
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/fastapi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/fastapi/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
FAST003.py:9:19: FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT101.py:6:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
|
@ -28,5 +29,3 @@ YTT101.py:8:7: YTT101 `sys.version[:3]` referenced (python3.10), use `sys.versio
|
|||
9 |
|
||||
10 | # the tool is timid and only flags certain numeric slices
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT102.py:4:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.version_info`
|
||||
|
|
||||
|
@ -16,5 +17,3 @@ YTT102.py:5:12: YTT102 `sys.version[2]` referenced (python3.10), use `sys.versio
|
|||
5 | py_minor = version[2]
|
||||
| ^^^^^^^ YTT102
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT103.py:4:1: YTT103 `sys.version` compared to string (python3.10), use `sys.version_info`
|
||||
|
|
||||
|
@ -46,5 +47,3 @@ YTT103.py:8:1: YTT103 `sys.version` compared to string (python3.10), use `sys.ve
|
|||
8 | sys.version >= "3.5"
|
||||
| ^^^^^^^^^^^ YTT103
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT201.py:7:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
||||
|
|
||||
|
@ -36,5 +37,3 @@ YTT201.py:10:7: YTT201 `sys.version_info[0] == 3` referenced (python4), use `>=`
|
|||
10 | PY2 = version_info[0] != 3
|
||||
| ^^^^^^^^^^^^^^^ YTT201
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT202.py:4:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
||||
|
|
||||
|
@ -19,5 +20,3 @@ YTT202.py:6:4: YTT202 `six.PY3` referenced (python4), use `not six.PY2`
|
|||
| ^^^ YTT202
|
||||
7 | print("3")
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT203.py:4:1: YTT203 `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
|
||||
|
|
||||
|
@ -16,5 +17,3 @@ YTT203.py:5:1: YTT203 `sys.version_info[1]` compared to integer (python4), compa
|
|||
5 | version_info[1] < 6
|
||||
| ^^^^^^^^^^^^^^^ YTT203
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT204.py:4:1: YTT204 `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
|
||||
|
|
||||
|
@ -16,5 +17,3 @@ YTT204.py:5:1: YTT204 `sys.version_info.minor` compared to integer (python4), co
|
|||
5 | version_info.minor > 8
|
||||
| ^^^^^^^^^^^^^^^^^^ YTT204
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT301.py:4:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
|
@ -16,5 +17,3 @@ YTT301.py:5:12: YTT301 `sys.version[0]` referenced (python10), use `sys.version_
|
|||
5 | py_major = version[0]
|
||||
| ^^^^^^^ YTT301
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT302.py:4:1: YTT302 `sys.version` compared to string (python10), use `sys.version_info`
|
||||
|
|
||||
|
@ -46,5 +47,3 @@ YTT302.py:8:1: YTT302 `sys.version` compared to string (python10), use `sys.vers
|
|||
8 | sys.version >= "3"
|
||||
| ^^^^^^^^^^^ YTT302
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_2020/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
YTT303.py:4:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_info`
|
||||
|
|
||||
|
@ -16,5 +17,3 @@ YTT303.py:5:7: YTT303 `sys.version[:1]` referenced (python10), use `sys.version_
|
|||
5 | print(version[:1])
|
||||
| ^^^^^^^ YTT303
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
allow_overload.py:29:9: ANN201 Missing return type annotation for public function `bar`
|
||||
|
|
||||
|
@ -9,5 +10,3 @@ allow_overload.py:29:9: ANN201 Missing return type annotation for public functio
|
|||
30 | return i
|
||||
|
|
||||
= help: Add return type annotation
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
allow_star_arg_any.py:10:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
|
|
||||
|
@ -32,5 +33,3 @@ allow_star_arg_any.py:44:67: ANN401 Dynamically typed expressions (typing.Any) a
|
|||
| ^^^ ANN401
|
||||
45 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public function `func`
|
||||
|
|
||||
|
@ -768,5 +769,3 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public
|
|||
300 300 | match x:
|
||||
301 301 | case [1, 2, 3]:
|
||||
302 302 | return 1
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public function `func`
|
||||
|
|
||||
|
@ -872,5 +873,3 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public
|
|||
300 300 | match x:
|
||||
301 301 | case [1, 2, 3]:
|
||||
302 302 | return 1
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public function `foo`
|
||||
|
|
||||
|
@ -332,5 +333,3 @@ annotation_presence.py:165:18: ANN101 Missing type annotation for `self` in meth
|
|||
| ^^^^ ANN101
|
||||
166 | print(f"{self.attr=}")
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for public function `error_partially_typed_1`
|
||||
|
|
||||
|
@ -68,5 +69,3 @@ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for publ
|
|||
43 |- def error_typed_self(self: X):
|
||||
43 |+ def error_typed_self(self: X) -> None:
|
||||
44 44 | pass
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
|
|
||||
|
@ -77,5 +78,3 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special
|
|||
47 |- def __init__(self, *arg):
|
||||
47 |+ def __init__(self, *arg) -> None:
|
||||
48 48 | ...
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__`
|
||||
|
|
||||
|
@ -275,5 +276,3 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec
|
|||
41 |- def __index__(self):
|
||||
41 |+ def __index__(self) -> int:
|
||||
42 42 | ...
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for public function `foo`
|
||||
|
|
||||
|
@ -47,5 +48,3 @@ suppress_none_returning.py:59:9: ANN001 Missing type annotation for function arg
|
|||
| ^ ANN001
|
||||
60 | a = 2 + 2
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC100.py:8:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediately awaited
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC109_0.py:8:16: ASYNC109 Async function definition with a `timeout` parameter
|
||||
|
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC109_0.py:8:16: ASYNC109 Async function definition with a `timeout` parameter
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC109_1.py:5:16: ASYNC109 Async function definition with a `timeout` parameter
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC110.py:7:5: ASYNC110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC210.py:8:5: ASYNC210 Async functions should not call blocking HTTP methods
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC22x.py:31:5: ASYNC220 Async functions should not create subprocesses with blocking methods
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC22x.py:8:5: ASYNC221 Async functions should not run processes with blocking methods
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC22x.py:20:5: ASYNC222 Async functions should not wait on processes with blocking methods
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC230.py:6:5: ASYNC230 Async functions should not open files with blocking methods like `open`
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
ASYNC251.py:6:5: ASYNC251 Async functions should not call `time.sleep`
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S101.py:1:1: S101 Use of `assert` detected
|
||||
|
|
||||
|
@ -23,5 +24,3 @@ S101.py:7:5: S101 Use of `assert` detected
|
|||
7 | assert x == 2 # S101
|
||||
| ^^^^^^ S101
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S102.py:3:5: S102 Use of `exec` detected
|
||||
|
|
||||
|
@ -18,5 +19,3 @@ S102.py:5:1: S102 Use of `exec` detected
|
|||
5 | exec('y = 3')
|
||||
| ^^^^ S102
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S103.py:6:25: S103 `os.chmod` setting a permissive mask `0o227` on file or directory
|
||||
|
|
||||
|
@ -136,5 +137,3 @@ S103.py:23:25: S103 `os.chmod` setting an invalid mask on file or directory
|
|||
23 | os.chmod("/etc/passwd", 0o100000000) # Error
|
||||
| ^^^^^^^^^^^ S103
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S104.py:9:1: S104 Possible binding to all interfaces
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S105.py:13:12: S105 Possible hardcoded password assigned to: "password"
|
||||
|
|
||||
|
@ -373,5 +374,3 @@ S105.py:64:13: S105 Possible hardcoded password assigned to: "token"
|
|||
| ^^^^^^ S105
|
||||
65 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S106.py:14:9: S106 Possible hardcoded password assigned to argument: "password"
|
||||
|
|
||||
|
@ -7,5 +8,3 @@ S106.py:14:9: S106 Possible hardcoded password assigned to argument: "password"
|
|||
14 | func(1, password="s3cr3t")
|
||||
| ^^^^^^^^^^^^^^^^^ S106
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S107.py:5:29: S107 Possible hardcoded password assigned to function default: "password"
|
||||
|
|
||||
|
@ -35,5 +36,3 @@ S107.py:29:62: S107 Possible hardcoded password assigned to function default: "p
|
|||
| ^^^^^^^^ S107
|
||||
30 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S108.py:5:11: S108 Probable insecure usage of temporary file or directory: "/tmp/abc"
|
||||
|
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
|
@ -22,5 +23,3 @@ S110.py:8:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
|||
10 |
|
||||
11 | try:
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
S110.py:3:1: S110 `try`-`except`-`pass` detected, consider logging the exception
|
||||
|
|
||||
|
@ -31,5 +32,3 @@ S110.py:13:1: S110 `try`-`except`-`pass` detected, consider logging the exceptio
|
|||
14 | | pass
|
||||
| |________^ S110
|
||||
|
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue