chore: Use LF on all platforms (#3005)

I worked on #2993 and ran into issues that the formatter tests are failing on Windows because `writeln!` emits `\n` as line terminator on all platforms, but `git` on Windows converted the line endings in the snapshots to `\r\n`.

I then tried to replicate the issue on my Windows machine and was surprised that all linter snapshot tests are failing on my machine. I figured out after some time that it is due to my global git config keeping the input line endings rather than converting to `\r\n`. 

Luckily, I've been made aware of #2033 which introduced an "override" for the `assert_yaml_snapshot` macro that normalizes new lines, by splitting the formatted string using the platform-specific newline character. This is a clever approach and gives nice diffs for multiline fixes but makes assumptions about the setup contributors use and requires special care whenever we use line endings inside of tests. 

I recommend that we remove the special new line handling and use `.gitattributes` to enforce the use of `LF` on all platforms [guide](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings). This gives us platform agnostic tests without having to worry about line endings in our tests or different git configurations.

## Note

It may be necessary for Windows contributors to run the following command to update the line endings of their files

```bash
git rm --cached -r .
git reset --hard
```
This commit is contained in:
Micha Reiser 2023-02-20 21:13:37 +01:00 committed by GitHub
parent 7e9dea0027
commit f72ed255e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
323 changed files with 1722 additions and 3954 deletions

6
.gitattributes vendored Normal file
View file

@ -0,0 +1,6 @@
* text=auto eol=lf
crates/ruff/resources/test/fixtures/isort/line_ending_crlf.py text eol=crlf
crates/ruff/resources/test/fixtures/pycodestyle/W605_1.py text eol=crlf
ruff.schema.json linguist-generated=true text=auto eol=lf

View file

@ -1,2 +1,2 @@
from long_module_name import member_one, member_two, member_three, member_four, member_five from long_module_name import member_one, member_two, member_three, member_four, member_five

View file

@ -1,35 +1,35 @@
#: W605:1:10 #: W605:1:10
regex = '\.png$' regex = '\.png$'
#: W605:2:1 #: W605:2:1
regex = ''' regex = '''
\.png$ \.png$
''' '''
#: W605:2:6 #: W605:2:6
f( f(
'\_' '\_'
) )
#: W605:4:6 #: W605:4:6
""" """
multi-line multi-line
literal literal
with \_ somewhere with \_ somewhere
in the middle in the middle
""" """
#: Okay #: Okay
regex = r'\.png$' regex = r'\.png$'
regex = '\\.png$' regex = '\\.png$'
regex = r''' regex = r'''
\.png$ \.png$
''' '''
regex = r''' regex = r'''
\\.png$ \\.png$
''' '''
s = '\\' s = '\\'
regex = '\w' # noqa regex = '\w' # noqa
regex = ''' regex = '''
\w \w
''' # noqa ''' # noqa

View file

@ -1,18 +0,0 @@
/// Platform-independent snapshot assertion
#[macro_export]
macro_rules! assert_yaml_snapshot {
( $($args: expr),+) => {
let line_sep = if cfg!(windows) { "\r\n" } else { "\n" };
// adjust snapshot file for platform
let mut settings = insta::Settings::clone_current();
settings.add_redaction("[].fix.content", insta::dynamic_redaction(move |value, _path| {
insta::internals::Content::Seq(
value.as_str().unwrap().split(line_sep).map(|line| line.into()).collect()
)
}));
settings.bind(|| {
insta::assert_yaml_snapshot!($($args),+);
});
};
}

View file

@ -11,7 +11,6 @@ pub use rule_selector::RuleSelector;
pub use rules::pycodestyle::rules::IOError; pub use rules::pycodestyle::rules::IOError;
pub use violation::{AutofixKind, Availability as AutofixAvailability}; pub use violation::{AutofixKind, Availability as AutofixAvailability};
mod assert_yaml_snapshot;
mod ast; mod ast;
mod autofix; mod autofix;
pub mod cache; pub mod cache;

View file

@ -7,11 +7,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::CommentedOutCode, Path::new("ERA001.py"); "ERA001")] #[test_case(Rule::CommentedOutCode, Path::new("ERA001.py"); "ERA001")]
fn rules(rule_code: Rule, path: &Path) -> Result<()> { fn rules(rule_code: Rule, path: &Path) -> Result<()> {

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/eradicate/mod.rs source: crates/ruff/src/rules/eradicate/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 10 column: 10
fix: fix:
content: content: ""
- ""
location: location:
row: 1 row: 1
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 2 row: 2
column: 22 column: 22
fix: fix:
content: content: ""
- ""
location: location:
row: 2 row: 2
column: 0 column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 3 row: 3
column: 6 column: 6
fix: fix:
content: content: ""
- ""
location: location:
row: 3 row: 3
column: 0 column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 5 row: 5
column: 13 column: 13
fix: fix:
content: content: ""
- ""
location: location:
row: 5 row: 5
column: 0 column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 12 row: 12
column: 16 column: 16
fix: fix:
content: content: ""
- ""
location: location:
row: 12 row: 12
column: 0 column: 0

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::SysVersionSlice3Referenced, Path::new("YTT101.py"); "YTT101")] #[test_case(Rule::SysVersionSlice3Referenced, Path::new("YTT101.py"); "YTT101")]
#[test_case(Rule::SysVersion2Referenced, Path::new("YTT102.py"); "YTT102")] #[test_case(Rule::SysVersion2Referenced, Path::new("YTT102.py"); "YTT102")]

View file

@ -9,8 +9,8 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;

View file

@ -8,9 +8,9 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::BlindExcept, Path::new("BLE.py"); "BLE001")] #[test_case(Rule::BlindExcept, Path::new("BLE.py"); "BLE001")]
fn rules(rule_code: Rule, path: &Path) -> Result<()> { fn rules(rule_code: Rule, path: &Path) -> Result<()> {

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::BooleanPositionalArgInFunctionDefinition, Path::new("FBT.py"); "FBT001")] #[test_case(Rule::BooleanPositionalArgInFunctionDefinition, Path::new("FBT.py"); "FBT001")]
#[test_case(Rule::BooleanDefaultValueInFunctionDefinition, Path::new("FBT.py"); "FBT002")] #[test_case(Rule::BooleanDefaultValueInFunctionDefinition, Path::new("FBT.py"); "FBT002")]

View file

@ -7,9 +7,9 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_bugbear/mod.rs source: crates/ruff/src/rules/flake8_bugbear/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -27,8 +27,7 @@ expression: diagnostics
row: 18 row: 18
column: 13 column: 13
fix: fix:
content: content: _k
- _k
location: location:
row: 18 row: 18
column: 12 column: 12
@ -61,8 +60,7 @@ expression: diagnostics
row: 30 row: 30
column: 13 column: 13
fix: fix:
content: content: _k
- _k
location: location:
row: 30 row: 30
column: 12 column: 12
@ -134,8 +132,7 @@ expression: diagnostics
row: 52 row: 52
column: 16 column: 16
fix: fix:
content: content: _bar
- _bar
location: location:
row: 52 row: 52
column: 13 column: 13
@ -168,8 +165,7 @@ expression: diagnostics
row: 68 row: 68
column: 16 column: 16
fix: fix:
content: content: _bar
- _bar
location: location:
row: 68 row: 68
column: 13 column: 13
@ -189,8 +185,7 @@ expression: diagnostics
row: 77 row: 77
column: 16 column: 16
fix: fix:
content: content: _bar
- _bar
location: location:
row: 77 row: 77
column: 13 column: 13

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_bugbear/mod.rs source: crates/ruff/src/rules/flake8_bugbear/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 19 row: 19
column: 19 column: 19
fix: fix:
content: content: foo.bar
- foo.bar
location: location:
row: 19 row: 19
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 20 row: 20
column: 23 column: 23
fix: fix:
content: content: foo._123abc
- foo._123abc
location: location:
row: 20 row: 20
column: 0 column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 21 row: 21
column: 26 column: 26
fix: fix:
content: content: foo.__123abc__
- foo.__123abc__
location: location:
row: 21 row: 21
column: 0 column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 22 row: 22
column: 22 column: 22
fix: fix:
content: content: foo.abc123
- foo.abc123
location: location:
row: 22 row: 22
column: 0 column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 23 row: 23
column: 23 column: 23
fix: fix:
content: content: foo.abc123
- foo.abc123
location: location:
row: 23 row: 23
column: 0 column: 0
@ -101,8 +96,7 @@ expression: diagnostics
row: 24 row: 24
column: 31 column: 31
fix: fix:
content: content: x.bar
- x.bar
location: location:
row: 24 row: 24
column: 14 column: 14
@ -119,8 +113,7 @@ expression: diagnostics
row: 25 row: 25
column: 20 column: 20
fix: fix:
content: content: x.bar
- x.bar
location: location:
row: 25 row: 25
column: 3 column: 3

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_bugbear/mod.rs source: crates/ruff/src/rules/flake8_bugbear/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 40 row: 40
column: 25 column: 25
fix: fix:
content: content: foo.bar = None
- foo.bar = None
location: location:
row: 40 row: 40
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 41 row: 41
column: 29 column: 29
fix: fix:
content: content: foo._123abc = None
- foo._123abc = None
location: location:
row: 41 row: 41
column: 0 column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 42 row: 42
column: 32 column: 32
fix: fix:
content: content: foo.__123abc__ = None
- foo.__123abc__ = None
location: location:
row: 42 row: 42
column: 0 column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 43 row: 43
column: 28 column: 28
fix: fix:
content: content: foo.abc123 = None
- foo.abc123 = None
location: location:
row: 43 row: 43
column: 0 column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 44 row: 44
column: 29 column: 29
fix: fix:
content: content: foo.abc123 = None
- foo.abc123 = None
location: location:
row: 44 row: 44
column: 0 column: 0
@ -101,8 +96,7 @@ expression: diagnostics
row: 45 row: 45
column: 30 column: 30
fix: fix:
content: content: foo.bar.baz = None
- foo.bar.baz = None
location: location:
row: 45 row: 45
column: 0 column: 0

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 8 row: 8
column: 12 column: 12
fix: fix:
content: content: raise AssertionError()
- raise AssertionError()
location: location:
row: 8 row: 8
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 10 row: 10
column: 12 column: 12
fix: fix:
content: content: "raise AssertionError(\"message\")"
- "raise AssertionError(\"message\")"
location: location:
row: 10 row: 10
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_bugbear/mod.rs source: crates/ruff/src/rules/flake8_bugbear/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 20 column: 20
fix: fix:
content: content: ValueError
- ValueError
location: location:
row: 3 row: 3
column: 7 column: 7

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_bugbear/mod.rs source: crates/ruff/src/rules/flake8_bugbear/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -13,8 +13,7 @@ expression: diagnostics
row: 17 row: 17
column: 25 column: 25
fix: fix:
content: content: OSError
- OSError
location: location:
row: 17 row: 17
column: 7 column: 7
@ -33,8 +32,7 @@ expression: diagnostics
row: 28 row: 28
column: 25 column: 25
fix: fix:
content: content: MyError
- MyError
location: location:
row: 28 row: 28
column: 7 column: 7
@ -53,8 +51,7 @@ expression: diagnostics
row: 49 row: 49
column: 27 column: 27
fix: fix:
content: content: re.error
- re.error
location: location:
row: 49 row: 49
column: 7 column: 7

View file

@ -8,9 +8,9 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Path::new("COM81.py"); "COM81")] #[test_case(Path::new("COM81.py"); "COM81")]
fn rules(path: &Path) -> Result<()> { fn rules(path: &Path) -> Result<()> {

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_commas/mod.rs source: crates/ruff/src/rules/flake8_commas/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 4 row: 4
column: 17 column: 17
fix: fix:
content: content: ","
- ","
location: location:
row: 4 row: 4
column: 17 column: 17
@ -29,8 +28,7 @@ expression: diagnostics
row: 10 row: 10
column: 5 column: 5
fix: fix:
content: content: ","
- ","
location: location:
row: 10 row: 10
column: 5 column: 5
@ -47,8 +45,7 @@ expression: diagnostics
row: 16 row: 16
column: 5 column: 5
fix: fix:
content: content: ","
- ","
location: location:
row: 16 row: 16
column: 5 column: 5
@ -65,8 +62,7 @@ expression: diagnostics
row: 23 row: 23
column: 5 column: 5
fix: fix:
content: content: ","
- ","
location: location:
row: 23 row: 23
column: 5 column: 5
@ -153,8 +149,7 @@ expression: diagnostics
row: 70 row: 70
column: 7 column: 7
fix: fix:
content: content: ","
- ","
location: location:
row: 70 row: 70
column: 7 column: 7
@ -171,8 +166,7 @@ expression: diagnostics
row: 78 row: 78
column: 7 column: 7
fix: fix:
content: content: ","
- ","
location: location:
row: 78 row: 78
column: 7 column: 7
@ -189,8 +183,7 @@ expression: diagnostics
row: 86 row: 86
column: 7 column: 7
fix: fix:
content: content: ","
- ","
location: location:
row: 86 row: 86
column: 7 column: 7
@ -207,8 +200,7 @@ expression: diagnostics
row: 152 row: 152
column: 5 column: 5
fix: fix:
content: content: ","
- ","
location: location:
row: 152 row: 152
column: 5 column: 5
@ -225,8 +217,7 @@ expression: diagnostics
row: 158 row: 158
column: 10 column: 10
fix: fix:
content: content: ","
- ","
location: location:
row: 158 row: 158
column: 10 column: 10
@ -243,8 +234,7 @@ expression: diagnostics
row: 293 row: 293
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 293 row: 293
column: 14 column: 14
@ -261,8 +251,7 @@ expression: diagnostics
row: 304 row: 304
column: 13 column: 13
fix: fix:
content: content: ","
- ","
location: location:
row: 304 row: 304
column: 13 column: 13
@ -279,8 +268,7 @@ expression: diagnostics
row: 310 row: 310
column: 13 column: 13
fix: fix:
content: content: ","
- ","
location: location:
row: 310 row: 310
column: 13 column: 13
@ -297,8 +285,7 @@ expression: diagnostics
row: 316 row: 316
column: 9 column: 9
fix: fix:
content: content: ","
- ","
location: location:
row: 316 row: 316
column: 9 column: 9
@ -315,8 +302,7 @@ expression: diagnostics
row: 322 row: 322
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 322 row: 322
column: 14 column: 14
@ -333,8 +319,7 @@ expression: diagnostics
row: 368 row: 368
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 368 row: 368
column: 14 column: 14
@ -351,8 +336,7 @@ expression: diagnostics
row: 375 row: 375
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 375 row: 375
column: 14 column: 14
@ -369,8 +353,7 @@ expression: diagnostics
row: 404 row: 404
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 404 row: 404
column: 14 column: 14
@ -387,8 +370,7 @@ expression: diagnostics
row: 432 row: 432
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 432 row: 432
column: 14 column: 14
@ -405,8 +387,7 @@ expression: diagnostics
row: 485 row: 485
column: 21 column: 21
fix: fix:
content: content: ""
- ""
location: location:
row: 485 row: 485
column: 20 column: 20
@ -423,8 +404,7 @@ expression: diagnostics
row: 487 row: 487
column: 13 column: 13
fix: fix:
content: content: ""
- ""
location: location:
row: 487 row: 487
column: 12 column: 12
@ -441,8 +421,7 @@ expression: diagnostics
row: 489 row: 489
column: 18 column: 18
fix: fix:
content: content: ""
- ""
location: location:
row: 489 row: 489
column: 17 column: 17
@ -459,8 +438,7 @@ expression: diagnostics
row: 494 row: 494
column: 6 column: 6
fix: fix:
content: content: ""
- ""
location: location:
row: 494 row: 494
column: 5 column: 5
@ -477,8 +455,7 @@ expression: diagnostics
row: 496 row: 496
column: 21 column: 21
fix: fix:
content: content: ""
- ""
location: location:
row: 496 row: 496
column: 20 column: 20
@ -495,8 +472,7 @@ expression: diagnostics
row: 498 row: 498
column: 13 column: 13
fix: fix:
content: content: ""
- ""
location: location:
row: 498 row: 498
column: 12 column: 12
@ -513,8 +489,7 @@ expression: diagnostics
row: 500 row: 500
column: 18 column: 18
fix: fix:
content: content: ""
- ""
location: location:
row: 500 row: 500
column: 17 column: 17
@ -531,8 +506,7 @@ expression: diagnostics
row: 505 row: 505
column: 6 column: 6
fix: fix:
content: content: ""
- ""
location: location:
row: 505 row: 505
column: 5 column: 5
@ -549,8 +523,7 @@ expression: diagnostics
row: 511 row: 511
column: 10 column: 10
fix: fix:
content: content: ""
- ""
location: location:
row: 511 row: 511
column: 9 column: 9
@ -567,8 +540,7 @@ expression: diagnostics
row: 513 row: 513
column: 9 column: 9
fix: fix:
content: content: ""
- ""
location: location:
row: 513 row: 513
column: 8 column: 8
@ -585,8 +557,7 @@ expression: diagnostics
row: 519 row: 519
column: 12 column: 12
fix: fix:
content: content: ","
- ","
location: location:
row: 519 row: 519
column: 12 column: 12
@ -603,8 +574,7 @@ expression: diagnostics
row: 526 row: 526
column: 9 column: 9
fix: fix:
content: content: ","
- ","
location: location:
row: 526 row: 526
column: 9 column: 9
@ -621,8 +591,7 @@ expression: diagnostics
row: 534 row: 534
column: 15 column: 15
fix: fix:
content: content: ","
- ","
location: location:
row: 534 row: 534
column: 15 column: 15
@ -639,8 +608,7 @@ expression: diagnostics
row: 541 row: 541
column: 12 column: 12
fix: fix:
content: content: ","
- ","
location: location:
row: 541 row: 541
column: 12 column: 12
@ -657,8 +625,7 @@ expression: diagnostics
row: 547 row: 547
column: 23 column: 23
fix: fix:
content: content: ","
- ","
location: location:
row: 547 row: 547
column: 23 column: 23
@ -675,8 +642,7 @@ expression: diagnostics
row: 554 row: 554
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 554 row: 554
column: 14 column: 14
@ -693,8 +659,7 @@ expression: diagnostics
row: 561 row: 561
column: 12 column: 12
fix: fix:
content: content: ","
- ","
location: location:
row: 561 row: 561
column: 12 column: 12
@ -711,8 +676,7 @@ expression: diagnostics
row: 565 row: 565
column: 12 column: 12
fix: fix:
content: content: ","
- ","
location: location:
row: 565 row: 565
column: 12 column: 12
@ -729,8 +693,7 @@ expression: diagnostics
row: 573 row: 573
column: 9 column: 9
fix: fix:
content: content: ","
- ","
location: location:
row: 573 row: 573
column: 9 column: 9
@ -747,8 +710,7 @@ expression: diagnostics
row: 577 row: 577
column: 9 column: 9
fix: fix:
content: content: ","
- ","
location: location:
row: 577 row: 577
column: 9 column: 9
@ -765,8 +727,7 @@ expression: diagnostics
row: 583 row: 583
column: 9 column: 9
fix: fix:
content: content: ","
- ","
location: location:
row: 583 row: 583
column: 9 column: 9
@ -783,8 +744,7 @@ expression: diagnostics
row: 590 row: 590
column: 12 column: 12
fix: fix:
content: content: ","
- ","
location: location:
row: 590 row: 590
column: 12 column: 12
@ -801,8 +761,7 @@ expression: diagnostics
row: 598 row: 598
column: 14 column: 14
fix: fix:
content: content: ","
- ","
location: location:
row: 598 row: 598
column: 14 column: 14
@ -819,8 +778,7 @@ expression: diagnostics
row: 627 row: 627
column: 19 column: 19
fix: fix:
content: content: ","
- ","
location: location:
row: 627 row: 627
column: 19 column: 19

View file

@ -8,9 +8,9 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;
@ -31,7 +31,6 @@ mod tests {
#[test_case(Rule::UnnecessarySubscriptReversal, Path::new("C415.py"); "C415")] #[test_case(Rule::UnnecessarySubscriptReversal, Path::new("C415.py"); "C415")]
#[test_case(Rule::UnnecessaryComprehension, Path::new("C416.py"); "C416")] #[test_case(Rule::UnnecessaryComprehension, Path::new("C416.py"); "C416")]
#[test_case(Rule::UnnecessaryMap, Path::new("C417.py"); "C417")] #[test_case(Rule::UnnecessaryMap, Path::new("C417.py"); "C417")]
fn rules(rule_code: Rule, path: &Path) -> Result<()> { fn rules(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy()); let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
let diagnostics = test_path( let diagnostics = test_path(

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 29 column: 29
fix: fix:
content: content: "[x for x in range(3)]"
- "[x for x in range(3)]"
location: location:
row: 1 row: 1
column: 4 column: 4
@ -29,10 +28,7 @@ expression: diagnostics
row: 4 row: 4
column: 1 column: 1
fix: fix:
content: content: "[\n x for x in range(3)\n]"
- "["
- " x for x in range(3)"
- "]"
location: location:
row: 2 row: 2
column: 4 column: 4

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 28 column: 28
fix: fix:
content: content: "{x for x in range(3)}"
- "{x for x in range(3)}"
location: location:
row: 1 row: 1
column: 4 column: 4
@ -29,10 +28,7 @@ expression: diagnostics
row: 4 row: 4
column: 1 column: 1
fix: fix:
content: content: "{\n x for x in range(3)\n}"
- "{"
- " x for x in range(3)"
- "}"
location: location:
row: 2 row: 2
column: 4 column: 4
@ -49,8 +45,7 @@ expression: diagnostics
row: 5 row: 5
column: 48 column: 48
fix: fix:
content: content: " {a if a < 6 else 0 for a in range(3)} "
- " {a if a < 6 else 0 for a in range(3)} "
location: location:
row: 5 row: 5
column: 7 column: 7
@ -67,8 +62,7 @@ expression: diagnostics
row: 6 row: 6
column: 57 column: 57
fix: fix:
content: content: "{a if a < 6 else 0 for a in range(3)}"
- "{a if a < 6 else 0 for a in range(3)}"
location: location:
row: 6 row: 6
column: 16 column: 16
@ -85,8 +79,7 @@ expression: diagnostics
row: 7 row: 7
column: 39 column: 39
fix: fix:
content: content: " {a for a in range(3)} "
- " {a for a in range(3)} "
location: location:
row: 7 row: 7
column: 15 column: 15

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 30 column: 30
fix: fix:
content: content: "{x: x for x in range(3)}"
- "{x: x for x in range(3)}"
location: location:
row: 1 row: 1
column: 0 column: 0
@ -29,10 +28,7 @@ expression: diagnostics
row: 4 row: 4
column: 1 column: 1
fix: fix:
content: content: "{\n x: x for x in range(3)\n}"
- "{"
- " x: x for x in range(3)"
- "}"
location: location:
row: 2 row: 2
column: 0 column: 0
@ -49,8 +45,7 @@ expression: diagnostics
row: 6 row: 6
column: 37 column: 37
fix: fix:
content: content: " {x: x for x in range(3)} "
- " {x: x for x in range(3)} "
location: location:
row: 6 row: 6
column: 7 column: 7
@ -67,8 +62,7 @@ expression: diagnostics
row: 7 row: 7
column: 45 column: 45
fix: fix:
content: content: " {x: x for x in range(3)} "
- " {x: x for x in range(3)} "
location: location:
row: 7 row: 7
column: 15 column: 15

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 30 column: 30
fix: fix:
content: content: "{x for x in range(3)}"
- "{x for x in range(3)}"
location: location:
row: 1 row: 1
column: 4 column: 4
@ -29,10 +28,7 @@ expression: diagnostics
row: 4 row: 4
column: 1 column: 1
fix: fix:
content: content: "{\n x for x in range(3)\n}"
- "{"
- " x for x in range(3)"
- "}"
location: location:
row: 2 row: 2
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 32 column: 32
fix: fix:
content: content: "{i: i for i in range(3)}"
- "{i: i for i in range(3)}"
location: location:
row: 1 row: 1
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 11 column: 11
fix: fix:
content: content: "{1, 2}"
- "{1, 2}"
location: location:
row: 1 row: 1
column: 0 column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 11 column: 11
fix: fix:
content: content: "{1, 2}"
- "{1, 2}"
location: location:
row: 2 row: 2
column: 0 column: 0
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 7 column: 7
fix: fix:
content: content: set()
- set()
location: location:
row: 3 row: 3
column: 0 column: 0
@ -69,8 +66,7 @@ expression: diagnostics
row: 4 row: 4
column: 7 column: 7
fix: fix:
content: content: set()
- set()
location: location:
row: 4 row: 4
column: 0 column: 0
@ -88,8 +84,7 @@ expression: diagnostics
row: 6 row: 6
column: 9 column: 9
fix: fix:
content: content: "{1}"
- "{1}"
location: location:
row: 6 row: 6
column: 0 column: 0
@ -107,10 +102,7 @@ expression: diagnostics
row: 9 row: 9
column: 2 column: 2
fix: fix:
content: content: "{\n 1,\n}"
- "{"
- " 1,"
- "}"
location: location:
row: 7 row: 7
column: 0 column: 0
@ -128,10 +120,7 @@ expression: diagnostics
row: 12 row: 12
column: 2 column: 2
fix: fix:
content: content: "{\n 1,\n}"
- "{"
- " 1,"
- "}"
location: location:
row: 10 row: 10
column: 0 column: 0
@ -149,8 +138,7 @@ expression: diagnostics
row: 15 row: 15
column: 1 column: 1
fix: fix:
content: content: "{1}"
- "{1}"
location: location:
row: 13 row: 13
column: 0 column: 0
@ -168,8 +156,7 @@ expression: diagnostics
row: 18 row: 18
column: 1 column: 1
fix: fix:
content: content: "{1,}"
- "{1,}"
location: location:
row: 16 row: 16
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 19 column: 19
fix: fix:
content: content: "{1: 2}"
- "{1: 2}"
location: location:
row: 1 row: 1
column: 5 column: 5
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 20 column: 20
fix: fix:
content: content: "{1: 2,}"
- "{1: 2,}"
location: location:
row: 2 row: 2
column: 5 column: 5
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 13 column: 13
fix: fix:
content: content: "{}"
- "{}"
location: location:
row: 3 row: 3
column: 5 column: 5
@ -69,8 +66,7 @@ expression: diagnostics
row: 4 row: 4
column: 13 column: 13
fix: fix:
content: content: "{}"
- "{}"
location: location:
row: 4 row: 4
column: 5 column: 5

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 11 column: 11
fix: fix:
content: content: ()
- ()
location: location:
row: 1 row: 1
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 10 column: 10
fix: fix:
content: content: "[]"
- "[]"
location: location:
row: 2 row: 2
column: 4 column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 11 column: 11
fix: fix:
content: content: "{}"
- "{}"
location: location:
row: 3 row: 3
column: 5 column: 5
@ -69,8 +66,7 @@ expression: diagnostics
row: 4 row: 4
column: 14 column: 14
fix: fix:
content: content: "{\"a\": 1}"
- "{\"a\": 1}"
location: location:
row: 4 row: 4
column: 5 column: 5

View file

@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 11 column: 11
fix: fix:
content: content: ()
- ()
location: location:
row: 1 row: 1
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 10 column: 10
fix: fix:
content: content: "[]"
- "[]"
location: location:
row: 2 row: 2
column: 4 column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 11 column: 11
fix: fix:
content: content: "{}"
- "{}"
location: location:
row: 3 row: 3
column: 5 column: 5

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 14 column: 14
fix: fix:
content: content: ()
- ()
location: location:
row: 1 row: 1
column: 5 column: 5
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 18 column: 18
fix: fix:
content: content: "(1, 2)"
- "(1, 2)"
location: location:
row: 2 row: 2
column: 5 column: 5
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 18 column: 18
fix: fix:
content: content: "(1, 2)"
- "(1, 2)"
location: location:
row: 3 row: 3
column: 5 column: 5
@ -69,11 +66,7 @@ expression: diagnostics
row: 7 row: 7
column: 2 column: 2
fix: fix:
content: content: "(\n 1,\n 2\n)"
- (
- " 1,"
- " 2"
- )
location: location:
row: 4 row: 4
column: 5 column: 5
@ -91,8 +84,7 @@ expression: diagnostics
row: 10 row: 10
column: 1 column: 1
fix: fix:
content: content: "(1, 2)"
- "(1, 2)"
location: location:
row: 8 row: 8
column: 5 column: 5

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 17 column: 17
fix: fix:
content: content: "[1, 2]"
- "[1, 2]"
location: location:
row: 1 row: 1
column: 5 column: 5
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 17 column: 17
fix: fix:
content: content: "[1, 2]"
- "[1, 2]"
location: location:
row: 2 row: 2
column: 5 column: 5
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 13 column: 13
fix: fix:
content: content: "[]"
- "[]"
location: location:
row: 3 row: 3
column: 5 column: 5
@ -69,8 +66,7 @@ expression: diagnostics
row: 4 row: 4
column: 13 column: 13
fix: fix:
content: content: "[]"
- "[]"
location: location:
row: 4 row: 4
column: 5 column: 5

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 2 row: 2
column: 20 column: 20
fix: fix:
content: content: "[i for i in x]"
- "[i for i in x]"
location: location:
row: 2 row: 2
column: 0 column: 0

View file

@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 15 column: 15
fix: fix:
content: content: sorted(x)
- sorted(x)
location: location:
row: 3 row: 3
column: 0 column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 4 row: 4
column: 19 column: 19
fix: fix:
content: content: "sorted(x, reverse=True)"
- "sorted(x, reverse=True)"
location: location:
row: 4 row: 4
column: 0 column: 0
@ -50,8 +48,7 @@ expression: diagnostics
row: 5 row: 5
column: 36 column: 36
fix: fix:
content: content: "sorted(x, key=lambda e: e, reverse=True)"
- "sorted(x, key=lambda e: e, reverse=True)"
location: location:
row: 5 row: 5
column: 0 column: 0
@ -69,8 +66,7 @@ expression: diagnostics
row: 6 row: 6
column: 33 column: 33
fix: fix:
content: content: "sorted(x, reverse=False)"
- "sorted(x, reverse=False)"
location: location:
row: 6 row: 6
column: 0 column: 0
@ -88,8 +84,7 @@ expression: diagnostics
row: 7 row: 7
column: 50 column: 50
fix: fix:
content: content: "sorted(x, key=lambda e: e, reverse=False)"
- "sorted(x, key=lambda e: e, reverse=False)"
location: location:
row: 7 row: 7
column: 0 column: 0
@ -107,8 +102,7 @@ expression: diagnostics
row: 8 row: 8
column: 50 column: 50
fix: fix:
content: content: "sorted(x, reverse=False, key=lambda e: e)"
- "sorted(x, reverse=False, key=lambda e: e)"
location: location:
row: 8 row: 8
column: 0 column: 0
@ -126,8 +120,7 @@ expression: diagnostics
row: 9 row: 9
column: 34 column: 34
fix: fix:
content: content: "sorted(x, reverse=True)"
- "sorted(x, reverse=True)"
location: location:
row: 9 row: 9
column: 0 column: 0

View file

@ -13,8 +13,7 @@ expression: diagnostics
row: 2 row: 2
column: 13 column: 13
fix: fix:
content: content: list(x)
- list(x)
location: location:
row: 2 row: 2
column: 0 column: 0
@ -33,8 +32,7 @@ expression: diagnostics
row: 3 row: 3
column: 14 column: 14
fix: fix:
content: content: list(x)
- list(x)
location: location:
row: 3 row: 3
column: 0 column: 0
@ -53,8 +51,7 @@ expression: diagnostics
row: 4 row: 4
column: 14 column: 14
fix: fix:
content: content: tuple(x)
- tuple(x)
location: location:
row: 4 row: 4
column: 0 column: 0
@ -73,8 +70,7 @@ expression: diagnostics
row: 5 row: 5
column: 15 column: 15
fix: fix:
content: content: tuple(x)
- tuple(x)
location: location:
row: 5 row: 5
column: 0 column: 0
@ -93,8 +89,7 @@ expression: diagnostics
row: 6 row: 6
column: 11 column: 11
fix: fix:
content: content: set(x)
- set(x)
location: location:
row: 6 row: 6
column: 0 column: 0
@ -113,8 +108,7 @@ expression: diagnostics
row: 7 row: 7
column: 12 column: 12
fix: fix:
content: content: set(x)
- set(x)
location: location:
row: 7 row: 7
column: 0 column: 0
@ -133,8 +127,7 @@ expression: diagnostics
row: 8 row: 8
column: 13 column: 13
fix: fix:
content: content: set(x)
- set(x)
location: location:
row: 8 row: 8
column: 0 column: 0
@ -153,8 +146,7 @@ expression: diagnostics
row: 9 row: 9
column: 14 column: 14
fix: fix:
content: content: set(x)
- set(x)
location: location:
row: 9 row: 9
column: 0 column: 0
@ -173,8 +165,7 @@ expression: diagnostics
row: 10 row: 10
column: 16 column: 16
fix: fix:
content: content: set(x)
- set(x)
location: location:
row: 10 row: 10
column: 0 column: 0
@ -193,8 +184,7 @@ expression: diagnostics
row: 11 row: 11
column: 15 column: 15
fix: fix:
content: content: sorted(x)
- sorted(x)
location: location:
row: 11 row: 11
column: 0 column: 0
@ -213,8 +203,7 @@ expression: diagnostics
row: 12 row: 12
column: 16 column: 16
fix: fix:
content: content: sorted(x)
- sorted(x)
location: location:
row: 12 row: 12
column: 0 column: 0
@ -233,8 +222,7 @@ expression: diagnostics
row: 13 row: 13
column: 17 column: 17
fix: fix:
content: content: sorted(x)
- sorted(x)
location: location:
row: 13 row: 13
column: 0 column: 0
@ -253,8 +241,7 @@ expression: diagnostics
row: 14 row: 14
column: 19 column: 19
fix: fix:
content: content: sorted(x)
- sorted(x)
location: location:
row: 14 row: 14
column: 0 column: 0
@ -273,11 +260,7 @@ expression: diagnostics
row: 20 row: 20
column: 1 column: 1
fix: fix:
content: content: "tuple(\n [x, 3, \"hell\"\\\n \"o\"]\n )"
- tuple(
- " [x, 3, \"hell\"\\"
- " \"o\"]"
- " )"
location: location:
row: 15 row: 15
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_comprehensions/mod.rs source: crates/ruff/src/rules/flake8_comprehensions/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 14 column: 14
fix: fix:
content: content: list(x)
- list(x)
location: location:
row: 2 row: 2
column: 0 column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 3 row: 3
column: 14 column: 14
fix: fix:
content: content: set(x)
- set(x)
location: location:
row: 3 row: 3
column: 0 column: 0

View file

@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 26 column: 26
fix: fix:
content: content: (x + 1 for x in nums)
- (x + 1 for x in nums)
location: location:
row: 3 row: 3
column: 0 column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 4 row: 4
column: 27 column: 27
fix: fix:
content: content: (str(x) for x in nums)
- (str(x) for x in nums)
location: location:
row: 4 row: 4
column: 0 column: 0
@ -50,8 +48,7 @@ expression: diagnostics
row: 5 row: 5
column: 32 column: 32
fix: fix:
content: content: "[x * 2 for x in nums]"
- "[x * 2 for x in nums]"
location: location:
row: 5 row: 5
column: 0 column: 0
@ -69,8 +66,7 @@ expression: diagnostics
row: 6 row: 6
column: 36 column: 36
fix: fix:
content: content: "{x % 2 == 0 for x in nums}"
- "{x % 2 == 0 for x in nums}"
location: location:
row: 6 row: 6
column: 0 column: 0
@ -88,8 +84,7 @@ expression: diagnostics
row: 7 row: 7
column: 36 column: 36
fix: fix:
content: content: "{v: v**2 for v in nums}"
- "{v: v**2 for v in nums}"
location: location:
row: 7 row: 7
column: 0 column: 0
@ -107,8 +102,7 @@ expression: diagnostics
row: 8 row: 8
column: 26 column: 26
fix: fix:
content: content: "(\"const\" for _ in nums)"
- "(\"const\" for _ in nums)"
location: location:
row: 8 row: 8
column: 0 column: 0
@ -126,8 +120,7 @@ expression: diagnostics
row: 9 row: 9
column: 24 column: 24
fix: fix:
content: content: (3.0 for _ in nums)
- (3.0 for _ in nums)
location: location:
row: 9 row: 9
column: 0 column: 0
@ -145,8 +138,7 @@ expression: diagnostics
row: 10 row: 10
column: 63 column: 63
fix: fix:
content: content: "(x in nums and \"1\" or \"0\" for x in range(123))"
- "(x in nums and \"1\" or \"0\" for x in range(123))"
location: location:
row: 10 row: 10
column: 12 column: 12
@ -164,8 +156,7 @@ expression: diagnostics
row: 11 row: 11
column: 44 column: 44
fix: fix:
content: content: "(isinstance(v, dict) for v in nums)"
- "(isinstance(v, dict) for v in nums)"
location: location:
row: 11 row: 11
column: 4 column: 4
@ -183,8 +174,7 @@ expression: diagnostics
row: 12 row: 12
column: 35 column: 35
fix: fix:
content: content: (v for v in nums)
- (v for v in nums)
location: location:
row: 12 row: 12
column: 13 column: 13
@ -202,8 +192,7 @@ expression: diagnostics
row: 15 row: 15
column: 43 column: 43
fix: fix:
content: content: " {x % 2 == 0 for x in nums} "
- " {x % 2 == 0 for x in nums} "
location: location:
row: 15 row: 15
column: 7 column: 7
@ -221,8 +210,7 @@ expression: diagnostics
row: 16 row: 16
column: 43 column: 43
fix: fix:
content: content: " {v: v**2 for v in nums} "
- " {v: v**2 for v in nums} "
location: location:
row: 16 row: 16
column: 7 column: 7

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::CallDatetimeWithoutTzinfo, Path::new("DTZ001.py"); "DTZ001")] #[test_case(Rule::CallDatetimeWithoutTzinfo, Path::new("DTZ001.py"); "DTZ001")]
#[test_case(Rule::CallDatetimeToday, Path::new("DTZ002.py"); "DTZ002")] #[test_case(Rule::CallDatetimeToday, Path::new("DTZ002.py"); "DTZ002")]

View file

@ -7,11 +7,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::Debugger, Path::new("T100.py"); "T100")] #[test_case(Rule::Debugger, Path::new("T100.py"); "T100")]
fn rules(rule_code: Rule, path: &Path) -> Result<()> { fn rules(rule_code: Rule, path: &Path) -> Result<()> {

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::NullableModelStringField, Path::new("DJ001.py"); "DJ001")] #[test_case(Rule::NullableModelStringField, Path::new("DJ001.py"); "DJ001")]
#[test_case(Rule::ModelWithoutDunderStr, Path::new("DJ008.py"); "DJ008")] #[test_case(Rule::ModelWithoutDunderStr, Path::new("DJ008.py"); "DJ008")]

View file

@ -7,10 +7,11 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test] #[test]
fn defaults() -> Result<()> { fn defaults() -> Result<()> {

View file

@ -8,11 +8,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Path::new("EXE001_1.py"); "EXE001_1")] #[test_case(Path::new("EXE001_1.py"); "EXE001_1")]
#[test_case(Path::new("EXE001_2.py"); "EXE001_2")] #[test_case(Path::new("EXE001_2.py"); "EXE001_2")]

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_executable/mod.rs source: crates/ruff/src/rules/flake8_executable/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 4 column: 4
fix: fix:
content: content: ""
- ""
location: location:
row: 1 row: 1
column: 0 column: 0

View file

@ -7,11 +7,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::SingleLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC001")] #[test_case(Rule::SingleLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC001")]
#[test_case(Rule::MultiLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC002")] #[test_case(Rule::MultiLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC002")]

View file

@ -7,9 +7,9 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;

View file

@ -6,9 +6,9 @@ mod tests {
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::{test_path, test_resource_path}; use crate::test::{test_path, test_resource_path};

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::DupeClassFieldDefinitions, Path::new("PIE794.py"); "PIE794")] #[test_case(Rule::DupeClassFieldDefinitions, Path::new("PIE794.py"); "PIE794")]
#[test_case(Rule::UnnecessaryDictKwargs, Path::new("PIE804.py"); "PIE804")] #[test_case(Rule::UnnecessaryDictKwargs, Path::new("PIE804.py"); "PIE804")]

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 4 row: 4
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 4 row: 4
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 9 row: 9
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 9 row: 9
column: 0 column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 14 row: 14
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 14 row: 14
column: 4 column: 4
@ -65,8 +62,7 @@ expression: diagnostics
row: 21 row: 21
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 21 row: 21
column: 0 column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 28 row: 28
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 28 row: 28
column: 0 column: 0
@ -101,8 +96,7 @@ expression: diagnostics
row: 35 row: 35
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 35 row: 35
column: 0 column: 0
@ -119,8 +113,7 @@ expression: diagnostics
row: 42 row: 42
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 42 row: 42
column: 0 column: 0
@ -137,8 +130,7 @@ expression: diagnostics
row: 50 row: 50
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 50 row: 50
column: 0 column: 0
@ -155,8 +147,7 @@ expression: diagnostics
row: 58 row: 58
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 58 row: 58
column: 0 column: 0
@ -173,8 +164,7 @@ expression: diagnostics
row: 65 row: 65
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 65 row: 65
column: 0 column: 0
@ -191,8 +181,7 @@ expression: diagnostics
row: 74 row: 74
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 74 row: 74
column: 0 column: 0
@ -209,8 +198,7 @@ expression: diagnostics
row: 79 row: 79
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 79 row: 79
column: 0 column: 0
@ -227,8 +215,7 @@ expression: diagnostics
row: 83 row: 83
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 83 row: 83
column: 0 column: 0
@ -245,8 +232,7 @@ expression: diagnostics
row: 87 row: 87
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 87 row: 87
column: 0 column: 0
@ -263,8 +249,7 @@ expression: diagnostics
row: 92 row: 92
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 92 row: 92
column: 0 column: 0
@ -281,8 +266,7 @@ expression: diagnostics
row: 96 row: 96
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 96 row: 96
column: 0 column: 0
@ -299,8 +283,7 @@ expression: diagnostics
row: 101 row: 101
column: 8 column: 8
fix: fix:
content: content: ""
- ""
location: location:
row: 101 row: 101
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pie/mod.rs source: crates/ruff/src/rules/flake8_pie/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 4 row: 4
column: 24 column: 24
fix: fix:
content: content: ""
- ""
location: location:
row: 4 row: 4
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 13 row: 13
column: 24 column: 24
fix: fix:
content: content: ""
- ""
location: location:
row: 13 row: 13
column: 0 column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 23 row: 23
column: 23 column: 23
fix: fix:
content: content: ""
- ""
location: location:
row: 23 row: 23
column: 0 column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 40 row: 40
column: 23 column: 23
fix: fix:
content: content: ""
- ""
location: location:
row: 40 row: 40
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pie/mod.rs source: crates/ruff/src/rules/flake8_pie/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 3 row: 3
column: 53 column: 53
fix: fix:
content: content: list
- list
location: location:
row: 3 row: 3
column: 43 column: 43
@ -29,8 +28,7 @@ expression: diagnostics
row: 7 row: 7
column: 45 column: 45
fix: fix:
content: content: list
- list
location: location:
row: 7 row: 7
column: 35 column: 35
@ -47,8 +45,7 @@ expression: diagnostics
row: 11 row: 11
column: 37 column: 37
fix: fix:
content: content: list
- list
location: location:
row: 11 row: 11
column: 27 column: 27

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::PrintFound, Path::new("T201.py"); "T201")] #[test_case(Rule::PrintFound, Path::new("T201.py"); "T201")]
#[test_case(Rule::PPrintFound, Path::new("T203.py"); "T203")] #[test_case(Rule::PPrintFound, Path::new("T203.py"); "T203")]

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::PrefixTypeParams, Path::new("PYI001.pyi"))] #[test_case(Rule::PrefixTypeParams, Path::new("PYI001.pyi"))]
#[test_case(Rule::PrefixTypeParams, Path::new("PYI001.py"))] #[test_case(Rule::PrefixTypeParams, Path::new("PYI001.py"))]

View file

@ -8,13 +8,14 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use super::settings::Settings; use super::settings::Settings;
use super::types; use super::types;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::IncorrectFixtureParenthesesStyle, Path::new("PT001.py"), Settings::default(), "PT001_default"; "PT001_0")] #[test_case(Rule::IncorrectFixtureParenthesesStyle, Path::new("PT001.py"), Settings::default(), "PT001_default"; "PT001_0")]
#[test_case( #[test_case(

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -13,8 +13,7 @@ expression: diagnostics
row: 9 row: 9
column: 15 column: 15
fix: fix:
content: content: ()
- ()
location: location:
row: 9 row: 9
column: 15 column: 15
@ -33,8 +32,7 @@ expression: diagnostics
row: 34 row: 34
column: 8 column: 8
fix: fix:
content: content: ()
- ()
location: location:
row: 34 row: 34
column: 8 column: 8
@ -53,8 +51,7 @@ expression: diagnostics
row: 59 row: 59
column: 8 column: 8
fix: fix:
content: content: ()
- ()
location: location:
row: 59 row: 59
column: 8 column: 8

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -13,8 +13,7 @@ expression: diagnostics
row: 14 row: 14
column: 17 column: 17
fix: fix:
content: content: ""
- ""
location: location:
row: 14 row: 14
column: 15 column: 15
@ -33,8 +32,7 @@ expression: diagnostics
row: 26 row: 26
column: 1 column: 1
fix: fix:
content: content: ""
- ""
location: location:
row: 24 row: 24
column: 15 column: 15
@ -53,8 +51,7 @@ expression: diagnostics
row: 39 row: 39
column: 10 column: 10
fix: fix:
content: content: ""
- ""
location: location:
row: 39 row: 39
column: 8 column: 8
@ -73,8 +70,7 @@ expression: diagnostics
row: 51 row: 51
column: 1 column: 1
fix: fix:
content: content: ""
- ""
location: location:
row: 49 row: 49
column: 8 column: 8
@ -93,8 +89,7 @@ expression: diagnostics
row: 64 row: 64
column: 10 column: 10
fix: fix:
content: content: ""
- ""
location: location:
row: 64 row: 64
column: 8 column: 8
@ -113,8 +108,7 @@ expression: diagnostics
row: 76 row: 76
column: 1 column: 1
fix: fix:
content: content: ""
- ""
location: location:
row: 74 row: 74
column: 8 column: 8

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 14 row: 14
column: 32 column: 32
fix: fix:
content: content: ""
- ""
location: location:
row: 14 row: 14
column: 16 column: 16
@ -29,8 +28,7 @@ expression: diagnostics
row: 19 row: 19
column: 32 column: 32
fix: fix:
content: content: ""
- ""
location: location:
row: 19 row: 19
column: 16 column: 16
@ -47,8 +45,7 @@ expression: diagnostics
row: 24 row: 24
column: 51 column: 51
fix: fix:
content: content: ""
- ""
location: location:
row: 24 row: 24
column: 33 column: 33
@ -65,8 +62,7 @@ expression: diagnostics
row: 29 row: 29
column: 51 column: 51
fix: fix:
content: content: ""
- ""
location: location:
row: 29 row: 29
column: 35 column: 35
@ -83,8 +79,7 @@ expression: diagnostics
row: 37 row: 37
column: 46 column: 46
fix: fix:
content: content: ""
- ""
location: location:
row: 37 row: 37
column: 28 column: 28
@ -101,8 +96,7 @@ expression: diagnostics
row: 43 row: 43
column: 20 column: 20
fix: fix:
content: content: ""
- ""
location: location:
row: 43 row: 43
column: 4 column: 4
@ -119,8 +113,7 @@ expression: diagnostics
row: 52 row: 52
column: 20 column: 20
fix: fix:
content: content: ""
- ""
location: location:
row: 51 row: 51
column: 21 column: 21
@ -137,8 +130,7 @@ expression: diagnostics
row: 67 row: 67
column: 18 column: 18
fix: fix:
content: content: ""
- ""
location: location:
row: 66 row: 66
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 24 row: 24
column: 45 column: 45
fix: fix:
content: content: "\"param1,param2\""
- "\"param1,param2\""
location: location:
row: 24 row: 24
column: 25 column: 25
@ -31,8 +30,7 @@ expression: diagnostics
row: 29 row: 29
column: 36 column: 36
fix: fix:
content: content: "\"param1\""
- "\"param1\""
location: location:
row: 29 row: 29
column: 25 column: 25
@ -50,8 +48,7 @@ expression: diagnostics
row: 34 row: 34
column: 45 column: 45
fix: fix:
content: content: "\"param1,param2\""
- "\"param1,param2\""
location: location:
row: 34 row: 34
column: 25 column: 25
@ -69,8 +66,7 @@ expression: diagnostics
row: 39 row: 39
column: 35 column: 35
fix: fix:
content: content: "\"param1\""
- "\"param1\""
location: location:
row: 39 row: 39
column: 25 column: 25

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 9 row: 9
column: 40 column: 40
fix: fix:
content: content: "(\"param1\", \"param2\")"
- "(\"param1\", \"param2\")"
location: location:
row: 9 row: 9
column: 25 column: 25
@ -31,8 +30,7 @@ expression: diagnostics
row: 14 row: 14
column: 56 column: 56
fix: fix:
content: content: "(\"param1\", \"param2\")"
- "(\"param1\", \"param2\")"
location: location:
row: 14 row: 14
column: 25 column: 25
@ -50,8 +48,7 @@ expression: diagnostics
row: 19 row: 19
column: 40 column: 40
fix: fix:
content: content: "(\"param1\", \"param2\")"
- "(\"param1\", \"param2\")"
location: location:
row: 19 row: 19
column: 25 column: 25
@ -69,8 +66,7 @@ expression: diagnostics
row: 29 row: 29
column: 36 column: 36
fix: fix:
content: content: "\"param1\""
- "\"param1\""
location: location:
row: 29 row: 29
column: 25 column: 25
@ -88,8 +84,7 @@ expression: diagnostics
row: 34 row: 34
column: 45 column: 45
fix: fix:
content: content: "(\"param1\", \"param2\")"
- "(\"param1\", \"param2\")"
location: location:
row: 34 row: 34
column: 25 column: 25
@ -107,8 +102,7 @@ expression: diagnostics
row: 39 row: 39
column: 35 column: 35
fix: fix:
content: content: "\"param1\""
- "\"param1\""
location: location:
row: 39 row: 39
column: 25 column: 25
@ -126,8 +120,7 @@ expression: diagnostics
row: 44 row: 44
column: 50 column: 50
fix: fix:
content: content: "(some_expr, another_expr)"
- "(some_expr, another_expr)"
location: location:
row: 44 row: 44
column: 25 column: 25
@ -145,8 +138,7 @@ expression: diagnostics
row: 49 row: 49
column: 46 column: 46
fix: fix:
content: content: "(some_expr, \"param2\")"
- "(some_expr, \"param2\")"
location: location:
row: 49 row: 49
column: 25 column: 25

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 9 row: 9
column: 40 column: 40
fix: fix:
content: content: "[\"param1\", \"param2\"]"
- "[\"param1\", \"param2\"]"
location: location:
row: 9 row: 9
column: 25 column: 25
@ -31,8 +30,7 @@ expression: diagnostics
row: 14 row: 14
column: 56 column: 56
fix: fix:
content: content: "[\"param1\", \"param2\"]"
- "[\"param1\", \"param2\"]"
location: location:
row: 14 row: 14
column: 25 column: 25
@ -50,8 +48,7 @@ expression: diagnostics
row: 19 row: 19
column: 40 column: 40
fix: fix:
content: content: "[\"param1\", \"param2\"]"
- "[\"param1\", \"param2\"]"
location: location:
row: 19 row: 19
column: 25 column: 25
@ -69,8 +66,7 @@ expression: diagnostics
row: 24 row: 24
column: 45 column: 45
fix: fix:
content: content: "[\"param1\", \"param2\"]"
- "[\"param1\", \"param2\"]"
location: location:
row: 24 row: 24
column: 25 column: 25
@ -88,8 +84,7 @@ expression: diagnostics
row: 29 row: 29
column: 36 column: 36
fix: fix:
content: content: "\"param1\""
- "\"param1\""
location: location:
row: 29 row: 29
column: 25 column: 25
@ -107,8 +102,7 @@ expression: diagnostics
row: 39 row: 39
column: 35 column: 35
fix: fix:
content: content: "\"param1\""
- "\"param1\""
location: location:
row: 39 row: 39
column: 25 column: 25

View file

@ -13,8 +13,7 @@ expression: diagnostics
row: 11 row: 11
column: 23 column: 23
fix: fix:
content: content: assert expr
- assert expr
location: location:
row: 11 row: 11
column: 8 column: 8
@ -33,8 +32,7 @@ expression: diagnostics
row: 12 row: 12
column: 23 column: 23
fix: fix:
content: content: assert expr
- assert expr
location: location:
row: 12 row: 12
column: 8 column: 8
@ -53,8 +51,7 @@ expression: diagnostics
row: 13 row: 13
column: 23 column: 23
fix: fix:
content: content: "assert expr, msg"
- "assert expr, msg"
location: location:
row: 13 row: 13
column: 8 column: 8
@ -73,8 +70,7 @@ expression: diagnostics
row: 14 row: 14
column: 23 column: 23
fix: fix:
content: content: "assert expr, msg"
- "assert expr, msg"
location: location:
row: 14 row: 14
column: 8 column: 8
@ -93,8 +89,7 @@ expression: diagnostics
row: 15 row: 15
column: 23 column: 23
fix: fix:
content: content: "assert expr, msg"
- "assert expr, msg"
location: location:
row: 15 row: 15
column: 8 column: 8
@ -197,8 +192,7 @@ expression: diagnostics
row: 28 row: 28
column: 24 column: 24
fix: fix:
content: content: assert not True
- assert not True
location: location:
row: 28 row: 28
column: 8 column: 8
@ -217,8 +211,7 @@ expression: diagnostics
row: 31 row: 31
column: 24 column: 24
fix: fix:
content: content: assert 1 == 2
- assert 1 == 2
location: location:
row: 31 row: 31
column: 8 column: 8
@ -237,8 +230,7 @@ expression: diagnostics
row: 34 row: 34
column: 27 column: 27
fix: fix:
content: content: assert 1 != 1
- assert 1 != 1
location: location:
row: 34 row: 34
column: 8 column: 8
@ -257,8 +249,7 @@ expression: diagnostics
row: 37 row: 37
column: 26 column: 26
fix: fix:
content: content: assert 1 > 2
- assert 1 > 2
location: location:
row: 37 row: 37
column: 8 column: 8
@ -277,8 +268,7 @@ expression: diagnostics
row: 40 row: 40
column: 31 column: 31
fix: fix:
content: content: assert 1 >= 2
- assert 1 >= 2
location: location:
row: 40 row: 40
column: 8 column: 8
@ -297,8 +287,7 @@ expression: diagnostics
row: 43 row: 43
column: 23 column: 23
fix: fix:
content: content: assert 2 < 1
- assert 2 < 1
location: location:
row: 43 row: 43
column: 8 column: 8
@ -317,8 +306,7 @@ expression: diagnostics
row: 46 row: 46
column: 28 column: 28
fix: fix:
content: content: assert 1 <= 2
- assert 1 <= 2
location: location:
row: 46 row: 46
column: 8 column: 8
@ -337,8 +325,7 @@ expression: diagnostics
row: 49 row: 49
column: 21 column: 21
fix: fix:
content: content: "assert 1 in [2, 3]"
- "assert 1 in [2, 3]"
location: location:
row: 49 row: 49
column: 8 column: 8
@ -357,8 +344,7 @@ expression: diagnostics
row: 52 row: 52
column: 24 column: 24
fix: fix:
content: content: "assert 2 not in [2, 3]"
- "assert 2 not in [2, 3]"
location: location:
row: 52 row: 52
column: 8 column: 8
@ -377,8 +363,7 @@ expression: diagnostics
row: 55 row: 55
column: 25 column: 25
fix: fix:
content: content: assert 0 is None
- assert 0 is None
location: location:
row: 55 row: 55
column: 8 column: 8
@ -397,8 +382,7 @@ expression: diagnostics
row: 58 row: 58
column: 28 column: 28
fix: fix:
content: content: assert 0 is not None
- assert 0 is not None
location: location:
row: 58 row: 58
column: 8 column: 8
@ -417,8 +401,7 @@ expression: diagnostics
row: 61 row: 61
column: 21 column: 21
fix: fix:
content: content: "assert [] is []"
- "assert [] is []"
location: location:
row: 61 row: 61
column: 8 column: 8
@ -437,8 +420,7 @@ expression: diagnostics
row: 64 row: 64
column: 24 column: 24
fix: fix:
content: content: assert 1 is not 1
- assert 1 is not 1
location: location:
row: 64 row: 64
column: 8 column: 8
@ -457,8 +439,7 @@ expression: diagnostics
row: 67 row: 67
column: 29 column: 29
fix: fix:
content: content: "assert isinstance(1, str)"
- "assert isinstance(1, str)"
location: location:
row: 67 row: 67
column: 8 column: 8
@ -477,8 +458,7 @@ expression: diagnostics
row: 70 row: 70
column: 32 column: 32
fix: fix:
content: content: "assert not isinstance(1, int)"
- "assert not isinstance(1, int)"
location: location:
row: 70 row: 70
column: 8 column: 8
@ -497,8 +477,7 @@ expression: diagnostics
row: 73 row: 73
column: 24 column: 24
fix: fix:
content: content: "assert re.search(\"def\", \"abc\")"
- "assert re.search(\"def\", \"abc\")"
location: location:
row: 73 row: 73
column: 8 column: 8
@ -517,8 +496,7 @@ expression: diagnostics
row: 76 row: 76
column: 27 column: 27
fix: fix:
content: content: "assert not re.search(\"abc\", \"abc\")"
- "assert not re.search(\"abc\", \"abc\")"
location: location:
row: 76 row: 76
column: 8 column: 8
@ -537,8 +515,7 @@ expression: diagnostics
row: 79 row: 79
column: 32 column: 32
fix: fix:
content: content: "assert re.search(\"def\", \"abc\")"
- "assert re.search(\"def\", \"abc\")"
location: location:
row: 79 row: 79
column: 8 column: 8
@ -557,8 +534,7 @@ expression: diagnostics
row: 82 row: 82
column: 27 column: 27
fix: fix:
content: content: "assert not re.search(\"abc\", \"abc\")"
- "assert not re.search(\"abc\", \"abc\")"
location: location:
row: 82 row: 82
column: 8 column: 8

View file

@ -12,9 +12,7 @@ expression: diagnostics
row: 13 row: 13
column: 39 column: 39
fix: fix:
content: content: "assert something\nassert something_else"
- assert something
- assert something_else
location: location:
row: 13 row: 13
column: 4 column: 4
@ -32,10 +30,7 @@ expression: diagnostics
row: 14 row: 14
column: 59 column: 59
fix: fix:
content: content: "assert something\nassert something_else\nassert something_third"
- assert something
- assert something_else
- assert something_third
location: location:
row: 14 row: 14
column: 4 column: 4
@ -53,9 +48,7 @@ expression: diagnostics
row: 15 row: 15
column: 43 column: 43
fix: fix:
content: content: "assert something\nassert not something_else"
- assert something
- assert not something_else
location: location:
row: 15 row: 15
column: 4 column: 4
@ -73,9 +66,7 @@ expression: diagnostics
row: 16 row: 16
column: 60 column: 60
fix: fix:
content: content: "assert something\nassert something_else or something_third"
- assert something
- assert something_else or something_third
location: location:
row: 16 row: 16
column: 4 column: 4
@ -93,9 +84,7 @@ expression: diagnostics
row: 17 row: 17
column: 43 column: 43
fix: fix:
content: content: "assert not something\nassert something_else"
- assert not something
- assert something_else
location: location:
row: 17 row: 17
column: 4 column: 4
@ -113,9 +102,7 @@ expression: diagnostics
row: 18 row: 18
column: 44 column: 44
fix: fix:
content: content: "assert not something\nassert not something_else"
- assert not something
- assert not something_else
location: location:
row: 18 row: 18
column: 4 column: 4
@ -133,10 +120,7 @@ expression: diagnostics
row: 19 row: 19
column: 63 column: 63
fix: fix:
content: content: "assert not something\nassert not something_else\nassert not something_third"
- assert not something
- assert not something_else
- assert not something_third
location: location:
row: 19 row: 19
column: 4 column: 4
@ -154,9 +138,7 @@ expression: diagnostics
row: 22 row: 22
column: 34 column: 34
fix: fix:
content: content: "assert not a\nassert b or c"
- assert not a
- assert b or c
location: location:
row: 22 row: 22
column: 4 column: 4
@ -174,9 +156,7 @@ expression: diagnostics
row: 23 row: 23
column: 35 column: 35
fix: fix:
content: content: "assert not a\nassert b and c"
- assert not a
- assert b and c
location: location:
row: 23 row: 23
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 17 row: 17
column: 18 column: 18
fix: fix:
content: content: return
- return
location: location:
row: 17 row: 17
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -14,8 +14,7 @@ expression: diagnostics
row: 12 row: 12
column: 16 column: 16
fix: fix:
content: content: ()
- ()
location: location:
row: 12 row: 12
column: 16 column: 16
@ -35,8 +34,7 @@ expression: diagnostics
row: 17 row: 17
column: 16 column: 16
fix: fix:
content: content: ()
- ()
location: location:
row: 17 row: 17
column: 16 column: 16
@ -56,8 +54,7 @@ expression: diagnostics
row: 24 row: 24
column: 20 column: 20
fix: fix:
content: content: ()
- ()
location: location:
row: 24 row: 24
column: 20 column: 20
@ -77,8 +74,7 @@ expression: diagnostics
row: 30 row: 30
column: 20 column: 20
fix: fix:
content: content: ()
- ()
location: location:
row: 30 row: 30
column: 20 column: 20
@ -98,8 +94,7 @@ expression: diagnostics
row: 38 row: 38
column: 24 column: 24
fix: fix:
content: content: ()
- ()
location: location:
row: 38 row: 38
column: 24 column: 24

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -14,8 +14,7 @@ expression: diagnostics
row: 46 row: 46
column: 18 column: 18
fix: fix:
content: content: ""
- ""
location: location:
row: 46 row: 46
column: 16 column: 16
@ -35,8 +34,7 @@ expression: diagnostics
row: 51 row: 51
column: 18 column: 18
fix: fix:
content: content: ""
- ""
location: location:
row: 51 row: 51
column: 16 column: 16
@ -56,8 +54,7 @@ expression: diagnostics
row: 58 row: 58
column: 22 column: 22
fix: fix:
content: content: ""
- ""
location: location:
row: 58 row: 58
column: 20 column: 20
@ -77,8 +74,7 @@ expression: diagnostics
row: 64 row: 64
column: 22 column: 22
fix: fix:
content: content: ""
- ""
location: location:
row: 64 row: 64
column: 20 column: 20
@ -98,8 +94,7 @@ expression: diagnostics
row: 72 row: 72
column: 26 column: 26
fix: fix:
content: content: ""
- ""
location: location:
row: 72 row: 72
column: 24 column: 24

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 14 row: 14
column: 22 column: 22
fix: fix:
content: content: ""
- ""
location: location:
row: 14 row: 14
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 20 row: 20
column: 20 column: 20
fix: fix:
content: content: ""
- ""
location: location:
row: 20 row: 20
column: 0 column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 27 row: 27
column: 22 column: 22
fix: fix:
content: content: ""
- ""
location: location:
row: 27 row: 27
column: 0 column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 33 row: 33
column: 20 column: 20
fix: fix:
content: content: ""
- ""
location: location:
row: 33 row: 33
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 9 row: 9
column: 29 column: 29
fix: fix:
content: content: ""
- ""
location: location:
row: 9 row: 9
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 16 row: 16
column: 29 column: 29
fix: fix:
content: content: ""
- ""
location: location:
row: 16 row: 16
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_pytest_style/mod.rs source: crates/ruff/src/rules/flake8_pytest_style/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 19 row: 19
column: 26 column: 26
fix: fix:
content: content: ""
- ""
location: location:
row: 19 row: 19
column: 0 column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 24 row: 24
column: 24 column: 24
fix: fix:
content: content: ""
- ""
location: location:
row: 24 row: 24
column: 0 column: 0

View file

@ -7,10 +7,10 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use super::settings::Quote; use super::settings::Quote;
use crate::assert_yaml_snapshot;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings::Settings; use crate::settings::Settings;
use crate::test::test_path; use crate::test::test_path;

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 7 row: 7
column: 3 column: 3
fix: fix:
content: content: "'''\nthis is not a docstring\n'''"
- "'''"
- this is not a docstring
- "'''"
location: location:
row: 5 row: 5
column: 0 column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 18 row: 18
column: 7 column: 7
fix: fix:
content: content: "'''\n this is not a docstring\n '''"
- "'''"
- " this is not a docstring"
- " '''"
location: location:
row: 16 row: 16
column: 4 column: 4
@ -54,9 +48,7 @@ expression: diagnostics
row: 22 row: 22
column: 37 column: 37
fix: fix:
content: content: "'''\n definitely not a docstring'''"
- "'''"
- " definitely not a docstring'''"
location: location:
row: 21 row: 21
column: 20 column: 20
@ -74,10 +66,7 @@ expression: diagnostics
row: 32 row: 32
column: 11 column: 11
fix: fix:
content: content: "'''\n this is not a docstring\n '''"
- "'''"
- " this is not a docstring"
- " '''"
location: location:
row: 30 row: 30
column: 8 column: 8
@ -95,10 +84,7 @@ expression: diagnostics
row: 37 row: 37
column: 15 column: 15
fix: fix:
content: content: "'''\n Looks like a docstring, but in reality it isn't - only modules, classes and functions\n '''"
- "'''"
- " Looks like a docstring, but in reality it isn't - only modules, classes and functions"
- " '''"
location: location:
row: 35 row: 35
column: 12 column: 12

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 27 column: 27
fix: fix:
content: content: "''' Not a docstring '''"
- "''' Not a docstring '''"
location: location:
row: 3 row: 3
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 5 row: 5
column: 43 column: 43
fix: fix:
content: content: "'''not a docstring'''"
- "'''not a docstring'''"
location: location:
row: 5 row: 5
column: 22 column: 22

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 26 column: 26
fix: fix:
content: content: "''' not a docstring'''"
- "''' not a docstring'''"
location: location:
row: 3 row: 3
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 11 row: 11
column: 26 column: 26
fix: fix:
content: content: "''' not a docstring'''"
- "''' not a docstring'''"
location: location:
row: 11 row: 11
column: 4 column: 4
@ -50,10 +48,7 @@ expression: diagnostics
row: 17 row: 17
column: 3 column: 3
fix: fix:
content: content: "'''\n not a\n'''"
- "'''"
- " not a"
- "'''"
location: location:
row: 15 row: 15
column: 38 column: 38
@ -71,8 +66,7 @@ expression: diagnostics
row: 17 row: 17
column: 19 column: 19
fix: fix:
content: content: "'''docstring'''"
- "'''docstring'''"
location: location:
row: 17 row: 17
column: 4 column: 4
@ -90,8 +84,7 @@ expression: diagnostics
row: 22 row: 22
column: 27 column: 27
fix: fix:
content: content: "''' not a docstring '''"
- "''' not a docstring '''"
location: location:
row: 22 row: 22
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 6 row: 6
column: 3 column: 3
fix: fix:
content: content: "'''\nthis is not a docstring\n'''"
- "'''"
- this is not a docstring
- "'''"
location: location:
row: 4 row: 4
column: 0 column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 11 row: 11
column: 3 column: 3
fix: fix:
content: content: "'''\nthis is not a docstring\n'''"
- "'''"
- this is not a docstring
- "'''"
location: location:
row: 9 row: 9
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 31 column: 31
fix: fix:
content: content: "''' this is not a docstring '''"
- "''' this is not a docstring '''"
location: location:
row: 2 row: 2
column: 0 column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 6 row: 6
column: 31 column: 31
fix: fix:
content: content: "''' this is not a docstring '''"
- "''' this is not a docstring '''"
location: location:
row: 6 row: 6
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\nSingle quotes multiline module docstring\n\"\"\""
- "\"\"\""
- Single quotes multiline module docstring
- "\"\"\""
location: location:
row: 1 row: 1
column: 0 column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 16 row: 16
column: 7 column: 7
fix: fix:
content: content: "\"\"\"\n Single quotes multiline class docstring\n \"\"\""
- "\"\"\""
- " Single quotes multiline class docstring"
- " \"\"\""
location: location:
row: 14 row: 14
column: 4 column: 4
@ -54,10 +48,7 @@ expression: diagnostics
row: 28 row: 28
column: 11 column: 11
fix: fix:
content: content: "\"\"\"\n Single quotes multiline function docstring\n \"\"\""
- "\"\"\""
- " Single quotes multiline function docstring"
- " \"\"\""
location: location:
row: 26 row: 26
column: 8 column: 8

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 53 column: 53
fix: fix:
content: content: "\"\"\" Double quotes single line class docstring \"\"\""
- "\"\"\" Double quotes single line class docstring \"\"\""
location: location:
row: 2 row: 2
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 6 row: 6
column: 57 column: 57
fix: fix:
content: content: "\"\"\" Double quotes single line method docstring\"\"\""
- "\"\"\" Double quotes single line method docstring\"\"\""
location: location:
row: 6 row: 6
column: 8 column: 8
@ -50,8 +48,7 @@ expression: diagnostics
row: 9 row: 9
column: 52 column: 52
fix: fix:
content: content: "\"\"\" inline docstring \"\"\""
- "\"\"\" inline docstring \"\"\""
location: location:
row: 9 row: 9
column: 28 column: 28

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 56 column: 56
fix: fix:
content: content: "\"\"\"function without params, single line docstring\"\"\""
- "\"\"\"function without params, single line docstring\"\"\""
location: location:
row: 2 row: 2
column: 4 column: 4
@ -31,10 +30,7 @@ expression: diagnostics
row: 10 row: 10
column: 7 column: 7
fix: fix:
content: content: "\"\"\"\n function without params, multiline docstring\n \"\"\""
- "\"\"\""
- " function without params, multiline docstring"
- " \"\"\""
location: location:
row: 8 row: 8
column: 4 column: 4
@ -52,8 +48,7 @@ expression: diagnostics
row: 27 row: 27
column: 27 column: 27
fix: fix:
content: content: "\"Single line docstring\""
- "\"Single line docstring\""
location: location:
row: 27 row: 27
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\nDouble quotes multiline module docstring\n\"\"\""
- "\"\"\""
- Double quotes multiline module docstring
- "\"\"\""
location: location:
row: 1 row: 1
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 49 column: 49
fix: fix:
content: content: "\"\"\" Double quotes singleline module docstring \"\"\""
- "\"\"\" Double quotes singleline module docstring \"\"\""
location: location:
row: 1 row: 1
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 3 column: 3
fix: fix:
content: content: "'''\nDouble quotes multiline module docstring\n'''"
- "'''"
- Double quotes multiline module docstring
- "'''"
location: location:
row: 1 row: 1
column: 0 column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 14 row: 14
column: 7 column: 7
fix: fix:
content: content: "'''\n Double quotes multiline class docstring\n '''"
- "'''"
- " Double quotes multiline class docstring"
- " '''"
location: location:
row: 12 row: 12
column: 4 column: 4
@ -54,10 +48,7 @@ expression: diagnostics
row: 26 row: 26
column: 11 column: 11
fix: fix:
content: content: "'''\n Double quotes multiline function docstring\n '''"
- "'''"
- " Double quotes multiline function docstring"
- " '''"
location: location:
row: 24 row: 24
column: 8 column: 8

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 53 column: 53
fix: fix:
content: content: "''' Double quotes single line class docstring '''"
- "''' Double quotes single line class docstring '''"
location: location:
row: 2 row: 2
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 6 row: 6
column: 57 column: 57
fix: fix:
content: content: "''' Double quotes single line method docstring'''"
- "''' Double quotes single line method docstring'''"
location: location:
row: 6 row: 6
column: 8 column: 8
@ -50,8 +48,7 @@ expression: diagnostics
row: 9 row: 9
column: 52 column: 52
fix: fix:
content: content: "''' inline docstring '''"
- "''' inline docstring '''"
location: location:
row: 9 row: 9
column: 28 column: 28

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 56 column: 56
fix: fix:
content: content: "'''function without params, single line docstring'''"
- "'''function without params, single line docstring'''"
location: location:
row: 2 row: 2
column: 4 column: 4
@ -31,10 +30,7 @@ expression: diagnostics
row: 10 row: 10
column: 7 column: 7
fix: fix:
content: content: "'''\n function without params, multiline docstring\n '''"
- "'''"
- " function without params, multiline docstring"
- " '''"
location: location:
row: 8 row: 8
column: 4 column: 4
@ -52,8 +48,7 @@ expression: diagnostics
row: 27 row: 27
column: 27 column: 27
fix: fix:
content: content: "'Single line docstring'"
- "'Single line docstring'"
location: location:
row: 27 row: 27
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 3 column: 3
fix: fix:
content: content: "'''\nDouble quotes multiline module docstring\n'''"
- "'''"
- Double quotes multiline module docstring
- "'''"
location: location:
row: 1 row: 1
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 49 column: 49
fix: fix:
content: content: "''' Double quotes singleline module docstring '''"
- "''' Double quotes singleline module docstring '''"
location: location:
row: 1 row: 1
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 7 row: 7
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\nthis is not a docstring\n\"\"\""
- "\"\"\""
- this is not a docstring
- "\"\"\""
location: location:
row: 5 row: 5
column: 0 column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 13 row: 13
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\n class params \\t not a docstring\n\"\"\""
- "\"\"\""
- " class params \\t not a docstring"
- "\"\"\""
location: location:
row: 11 row: 11
column: 20 column: 20
@ -54,10 +48,7 @@ expression: diagnostics
row: 20 row: 20
column: 7 column: 7
fix: fix:
content: content: "\"\"\"\n this is not a docstring\n \"\"\""
- "\"\"\""
- " this is not a docstring"
- " \"\"\""
location: location:
row: 18 row: 18
column: 4 column: 4
@ -75,9 +66,7 @@ expression: diagnostics
row: 24 row: 24
column: 37 column: 37
fix: fix:
content: content: "\"\"\"\n definitely not a docstring\"\"\""
- "\"\"\""
- " definitely not a docstring\"\"\""
location: location:
row: 23 row: 23
column: 20 column: 20
@ -95,10 +84,7 @@ expression: diagnostics
row: 34 row: 34
column: 11 column: 11
fix: fix:
content: content: "\"\"\"\n this is not a docstring\n \"\"\""
- "\"\"\""
- " this is not a docstring"
- " \"\"\""
location: location:
row: 32 row: 32
column: 8 column: 8
@ -116,10 +102,7 @@ expression: diagnostics
row: 39 row: 39
column: 15 column: 15
fix: fix:
content: content: "\"\"\"\n Looks like a docstring, but in reality it isn't - only modules, classes and functions\n \"\"\""
- "\"\"\""
- " Looks like a docstring, but in reality it isn't - only modules, classes and functions"
- " \"\"\""
location: location:
row: 37 row: 37
column: 12 column: 12

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 27 column: 27
fix: fix:
content: content: "\"\"\" Not a docstring \"\"\""
- "\"\"\" Not a docstring \"\"\""
location: location:
row: 3 row: 3
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 5 row: 5
column: 43 column: 43
fix: fix:
content: content: "\"\"\"not a docstring\"\"\""
- "\"\"\"not a docstring\"\"\""
location: location:
row: 5 row: 5
column: 22 column: 22

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 26 column: 26
fix: fix:
content: content: "\"\"\" not a docstring\"\"\""
- "\"\"\" not a docstring\"\"\""
location: location:
row: 3 row: 3
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 11 row: 11
column: 26 column: 26
fix: fix:
content: content: "\"\"\" not a docstring\"\"\""
- "\"\"\" not a docstring\"\"\""
location: location:
row: 11 row: 11
column: 4 column: 4
@ -50,10 +48,7 @@ expression: diagnostics
row: 17 row: 17
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\n not a\n\"\"\""
- "\"\"\""
- " not a"
- "\"\"\""
location: location:
row: 15 row: 15
column: 38 column: 38
@ -71,8 +66,7 @@ expression: diagnostics
row: 17 row: 17
column: 19 column: 19
fix: fix:
content: content: "\"\"\"docstring\"\"\""
- "\"\"\"docstring\"\"\""
location: location:
row: 17 row: 17
column: 4 column: 4
@ -90,8 +84,7 @@ expression: diagnostics
row: 22 row: 22
column: 27 column: 27
fix: fix:
content: content: "\"\"\" not a docstring \"\"\""
- "\"\"\" not a docstring \"\"\""
location: location:
row: 22 row: 22
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 6 row: 6
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\nthis is not a docstring\n\"\"\""
- "\"\"\""
- this is not a docstring
- "\"\"\""
location: location:
row: 4 row: 4
column: 0 column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 11 row: 11
column: 3 column: 3
fix: fix:
content: content: "\"\"\"\nthis is not a docstring\n\"\"\""
- "\"\"\""
- this is not a docstring
- "\"\"\""
location: location:
row: 9 row: 9
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 31 column: 31
fix: fix:
content: content: "\"\"\" this is not a docstring \"\"\""
- "\"\"\" this is not a docstring \"\"\""
location: location:
row: 2 row: 2
column: 0 column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 6 row: 6
column: 31 column: 31
fix: fix:
content: content: "\"\"\" this is not a docstring \"\"\""
- "\"\"\" this is not a docstring \"\"\""
location: location:
row: 6 row: 6
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 45 column: 45
fix: fix:
content: content: "\"single quote string\""
- "\"single quote string\""
location: location:
row: 1 row: 1
column: 24 column: 24
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 46 column: 46
fix: fix:
content: content: "u\"double quote string\""
- "u\"double quote string\""
location: location:
row: 2 row: 2
column: 24 column: 24
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 46 column: 46
fix: fix:
content: content: "f\"double quote string\""
- "f\"double quote string\""
location: location:
row: 3 row: 3
column: 24 column: 24

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 47 column: 47
fix: fix:
content: content: "'This is a \"string\"'"
- "'This is a \"string\"'"
location: location:
row: 1 row: 1
column: 25 column: 25
@ -29,8 +28,7 @@ expression: diagnostics
row: 9 row: 9
column: 16 column: 16
fix: fix:
content: content: "'\"string\"'"
- "'\"string\"'"
location: location:
row: 9 row: 9
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 10 column: 10
fix: fix:
content: content: "\"This\""
- "\"This\""
location: location:
row: 2 row: 2
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 3 row: 3
column: 8 column: 8
fix: fix:
content: content: "\"is\""
- "\"is\""
location: location:
row: 3 row: 3
column: 4 column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 4 row: 4
column: 9 column: 9
fix: fix:
content: content: "\"not\""
- "\"not\""
location: location:
row: 4 row: 4
column: 4 column: 4
@ -69,8 +66,7 @@ expression: diagnostics
row: 8 row: 8
column: 10 column: 10
fix: fix:
content: content: "\"This\""
- "\"This\""
location: location:
row: 8 row: 8
column: 4 column: 4
@ -88,8 +84,7 @@ expression: diagnostics
row: 9 row: 9
column: 8 column: 8
fix: fix:
content: content: "\"is\""
- "\"is\""
location: location:
row: 9 row: 9
column: 4 column: 4
@ -107,8 +102,7 @@ expression: diagnostics
row: 10 row: 10
column: 9 column: 9
fix: fix:
content: content: "\"not\""
- "\"not\""
location: location:
row: 10 row: 10
column: 4 column: 4
@ -126,8 +120,7 @@ expression: diagnostics
row: 27 row: 27
column: 30 column: 30
fix: fix:
content: content: "\"But this needs to be changed\""
- "\"But this needs to be changed\""
location: location:
row: 27 row: 27
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 12 column: 12
fix: fix:
content: content: "\"\"\" This 'should'\nbe\n'linted' \"\"\""
- "\"\"\" This 'should'"
- be
- "'linted' \"\"\""
location: location:
row: 1 row: 1
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1 row: 1
column: 45 column: 45
fix: fix:
content: content: "'double quote string'"
- "'double quote string'"
location: location:
row: 1 row: 1
column: 24 column: 24
@ -31,8 +30,7 @@ expression: diagnostics
row: 2 row: 2
column: 46 column: 46
fix: fix:
content: content: "u'double quote string'"
- "u'double quote string'"
location: location:
row: 2 row: 2
column: 24 column: 24
@ -50,8 +48,7 @@ expression: diagnostics
row: 3 row: 3
column: 46 column: 46
fix: fix:
content: content: "f'double quote string'"
- "f'double quote string'"
location: location:
row: 3 row: 3
column: 24 column: 24

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1 row: 1
column: 47 column: 47
fix: fix:
content: content: "\"This is a 'string'\""
- "\"This is a 'string'\""
location: location:
row: 1 row: 1
column: 25 column: 25
@ -29,8 +28,7 @@ expression: diagnostics
row: 2 row: 2
column: 52 column: 52
fix: fix:
content: content: "\"This is \\\\ a \\\\'string'\""
- "\"This is \\\\ a \\\\'string'\""
location: location:
row: 2 row: 2
column: 25 column: 25
@ -47,8 +45,7 @@ expression: diagnostics
row: 10 row: 10
column: 16 column: 16
fix: fix:
content: content: "\"'string'\""
- "\"'string'\""
location: location:
row: 10 row: 10
column: 4 column: 4

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2 row: 2
column: 10 column: 10
fix: fix:
content: content: "'This'"
- "'This'"
location: location:
row: 2 row: 2
column: 4 column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 3 row: 3
column: 8 column: 8
fix: fix:
content: content: "'is'"
- "'is'"
location: location:
row: 3 row: 3
column: 4 column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 4 row: 4
column: 9 column: 9
fix: fix:
content: content: "'not'"
- "'not'"
location: location:
row: 4 row: 4
column: 4 column: 4
@ -69,8 +66,7 @@ expression: diagnostics
row: 8 row: 8
column: 10 column: 10
fix: fix:
content: content: "'This'"
- "'This'"
location: location:
row: 8 row: 8
column: 4 column: 4
@ -88,8 +84,7 @@ expression: diagnostics
row: 9 row: 9
column: 8 column: 8
fix: fix:
content: content: "'is'"
- "'is'"
location: location:
row: 9 row: 9
column: 4 column: 4
@ -107,8 +102,7 @@ expression: diagnostics
row: 10 row: 10
column: 9 column: 9
fix: fix:
content: content: "'not'"
- "'not'"
location: location:
row: 10 row: 10
column: 4 column: 4
@ -126,8 +120,7 @@ expression: diagnostics
row: 27 row: 27
column: 30 column: 30
fix: fix:
content: content: "'But this needs to be changed'"
- "'But this needs to be changed'"
location: location:
row: 27 row: 27
column: 0 column: 0

View file

@ -1,5 +1,5 @@
--- ---
source: src/rules/flake8_quotes/mod.rs source: crates/ruff/src/rules/flake8_quotes/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3 row: 3
column: 12 column: 12
fix: fix:
content: content: "''' This \"should\"\nbe\n\"linted\" '''"
- "''' This \"should\""
- be
- "\"linted\" '''"
location: location:
row: 1 row: 1
column: 4 column: 4

View file

@ -7,11 +7,12 @@ mod tests {
use std::path::Path; use std::path::Path;
use anyhow::Result; use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case; use test_case::test_case;
use crate::registry::Rule; use crate::registry::Rule;
use crate::settings;
use crate::test::test_path; use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::UnnecessaryParenOnRaiseException, Path::new("RSE102.py"); "RSE102")] #[test_case(Rule::UnnecessaryParenOnRaiseException, Path::new("RSE102.py"); "RSE102")]
fn rules(rule_code: Rule, path: &Path) -> Result<()> { fn rules(rule_code: Rule, path: &Path) -> Result<()> {

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 5 row: 5
column: 22 column: 22
fix: fix:
content: content: ""
- ""
location: location:
row: 5 row: 5
column: 20 column: 20
@ -29,8 +28,7 @@ expression: diagnostics
row: 13 row: 13
column: 17 column: 17
fix: fix:
content: content: ""
- ""
location: location:
row: 13 row: 13
column: 15 column: 15
@ -47,8 +45,7 @@ expression: diagnostics
row: 16 row: 16
column: 18 column: 18
fix: fix:
content: content: ""
- ""
location: location:
row: 16 row: 16
column: 15 column: 15
@ -65,8 +62,7 @@ expression: diagnostics
row: 20 row: 20
column: 6 column: 6
fix: fix:
content: content: ""
- ""
location: location:
row: 19 row: 19
column: 15 column: 15
@ -83,8 +79,7 @@ expression: diagnostics
row: 25 row: 25
column: 1 column: 1
fix: fix:
content: content: ""
- ""
location: location:
row: 23 row: 23
column: 15 column: 15
@ -101,8 +96,7 @@ expression: diagnostics
row: 30 row: 30
column: 1 column: 1
fix: fix:
content: content: ""
- ""
location: location:
row: 28 row: 28
column: 15 column: 15

Some files were not shown because too many files have changed in this diff Show more