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

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
regex = '\.png$'
#: W605:2:1
regex = '''
\.png$
'''
#: W605:2:6
f(
'\_'
)
#: W605:4:6
"""
multi-line
literal
with \_ somewhere
in the middle
"""
#: Okay
regex = r'\.png$'
regex = '\\.png$'
regex = r'''
\.png$
'''
regex = r'''
\\.png$
'''
s = '\\'
regex = '\w' # noqa
regex = '''
\w
''' # noqa
#: W605:1:10
regex = '\.png$'
#: W605:2:1
regex = '''
\.png$
'''
#: W605:2:6
f(
'\_'
)
#: W605:4:6
"""
multi-line
literal
with \_ somewhere
in the middle
"""
#: Okay
regex = r'\.png$'
regex = '\\.png$'
regex = r'''
\.png$
'''
regex = r'''
\\.png$
'''
s = '\\'
regex = '\w' # noqa
regex = '''
\w
''' # 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 violation::{AutofixKind, Availability as AutofixAvailability};
mod assert_yaml_snapshot;
mod ast;
mod autofix;
pub mod cache;

View file

@ -7,11 +7,12 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::registry::Rule;
use crate::settings;
use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Rule::CommentedOutCode, Path::new("ERA001.py"); "ERA001")]
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 10
fix:
content:
- ""
content: ""
location:
row: 1
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 2
column: 22
fix:
content:
- ""
content: ""
location:
row: 2
column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 3
column: 6
fix:
content:
- ""
content: ""
location:
row: 3
column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 5
column: 13
fix:
content:
- ""
content: ""
location:
row: 5
column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 12
column: 16
fix:
content:
- ""
content: ""
location:
row: 12
column: 0

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,9 +7,9 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule;
use crate::settings::Settings;
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
---
- kind:
@ -27,8 +27,7 @@ expression: diagnostics
row: 18
column: 13
fix:
content:
- _k
content: _k
location:
row: 18
column: 12
@ -61,8 +60,7 @@ expression: diagnostics
row: 30
column: 13
fix:
content:
- _k
content: _k
location:
row: 30
column: 12
@ -134,8 +132,7 @@ expression: diagnostics
row: 52
column: 16
fix:
content:
- _bar
content: _bar
location:
row: 52
column: 13
@ -168,8 +165,7 @@ expression: diagnostics
row: 68
column: 16
fix:
content:
- _bar
content: _bar
location:
row: 68
column: 13
@ -189,8 +185,7 @@ expression: diagnostics
row: 77
column: 16
fix:
content:
- _bar
content: _bar
location:
row: 77
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 19
column: 19
fix:
content:
- foo.bar
content: foo.bar
location:
row: 19
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 20
column: 23
fix:
content:
- foo._123abc
content: foo._123abc
location:
row: 20
column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 21
column: 26
fix:
content:
- foo.__123abc__
content: foo.__123abc__
location:
row: 21
column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 22
column: 22
fix:
content:
- foo.abc123
content: foo.abc123
location:
row: 22
column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 23
column: 23
fix:
content:
- foo.abc123
content: foo.abc123
location:
row: 23
column: 0
@ -101,8 +96,7 @@ expression: diagnostics
row: 24
column: 31
fix:
content:
- x.bar
content: x.bar
location:
row: 24
column: 14
@ -119,8 +113,7 @@ expression: diagnostics
row: 25
column: 20
fix:
content:
- x.bar
content: x.bar
location:
row: 25
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 40
column: 25
fix:
content:
- foo.bar = None
content: foo.bar = None
location:
row: 40
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 41
column: 29
fix:
content:
- foo._123abc = None
content: foo._123abc = None
location:
row: 41
column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 42
column: 32
fix:
content:
- foo.__123abc__ = None
content: foo.__123abc__ = None
location:
row: 42
column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 43
column: 28
fix:
content:
- foo.abc123 = None
content: foo.abc123 = None
location:
row: 43
column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 44
column: 29
fix:
content:
- foo.abc123 = None
content: foo.abc123 = None
location:
row: 44
column: 0
@ -101,8 +96,7 @@ expression: diagnostics
row: 45
column: 30
fix:
content:
- foo.bar.baz = None
content: foo.bar.baz = None
location:
row: 45
column: 0

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 8
column: 12
fix:
content:
- raise AssertionError()
content: raise AssertionError()
location:
row: 8
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 10
column: 12
fix:
content:
- "raise AssertionError(\"message\")"
content: "raise AssertionError(\"message\")"
location:
row: 10
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3
column: 20
fix:
content:
- ValueError
content: ValueError
location:
row: 3
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
---
- kind:
@ -13,8 +13,7 @@ expression: diagnostics
row: 17
column: 25
fix:
content:
- OSError
content: OSError
location:
row: 17
column: 7
@ -33,8 +32,7 @@ expression: diagnostics
row: 28
column: 25
fix:
content:
- MyError
content: MyError
location:
row: 28
column: 7
@ -53,8 +51,7 @@ expression: diagnostics
row: 49
column: 27
fix:
content:
- re.error
content: re.error
location:
row: 49
column: 7

View file

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

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::registry::Rule;
use crate::settings;
use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};
#[test_case(Path::new("COM81.py"); "COM81")]
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 4
column: 17
fix:
content:
- ","
content: ","
location:
row: 4
column: 17
@ -29,8 +28,7 @@ expression: diagnostics
row: 10
column: 5
fix:
content:
- ","
content: ","
location:
row: 10
column: 5
@ -47,8 +45,7 @@ expression: diagnostics
row: 16
column: 5
fix:
content:
- ","
content: ","
location:
row: 16
column: 5
@ -65,8 +62,7 @@ expression: diagnostics
row: 23
column: 5
fix:
content:
- ","
content: ","
location:
row: 23
column: 5
@ -153,8 +149,7 @@ expression: diagnostics
row: 70
column: 7
fix:
content:
- ","
content: ","
location:
row: 70
column: 7
@ -171,8 +166,7 @@ expression: diagnostics
row: 78
column: 7
fix:
content:
- ","
content: ","
location:
row: 78
column: 7
@ -189,8 +183,7 @@ expression: diagnostics
row: 86
column: 7
fix:
content:
- ","
content: ","
location:
row: 86
column: 7
@ -207,8 +200,7 @@ expression: diagnostics
row: 152
column: 5
fix:
content:
- ","
content: ","
location:
row: 152
column: 5
@ -225,8 +217,7 @@ expression: diagnostics
row: 158
column: 10
fix:
content:
- ","
content: ","
location:
row: 158
column: 10
@ -243,8 +234,7 @@ expression: diagnostics
row: 293
column: 14
fix:
content:
- ","
content: ","
location:
row: 293
column: 14
@ -261,8 +251,7 @@ expression: diagnostics
row: 304
column: 13
fix:
content:
- ","
content: ","
location:
row: 304
column: 13
@ -279,8 +268,7 @@ expression: diagnostics
row: 310
column: 13
fix:
content:
- ","
content: ","
location:
row: 310
column: 13
@ -297,8 +285,7 @@ expression: diagnostics
row: 316
column: 9
fix:
content:
- ","
content: ","
location:
row: 316
column: 9
@ -315,8 +302,7 @@ expression: diagnostics
row: 322
column: 14
fix:
content:
- ","
content: ","
location:
row: 322
column: 14
@ -333,8 +319,7 @@ expression: diagnostics
row: 368
column: 14
fix:
content:
- ","
content: ","
location:
row: 368
column: 14
@ -351,8 +336,7 @@ expression: diagnostics
row: 375
column: 14
fix:
content:
- ","
content: ","
location:
row: 375
column: 14
@ -369,8 +353,7 @@ expression: diagnostics
row: 404
column: 14
fix:
content:
- ","
content: ","
location:
row: 404
column: 14
@ -387,8 +370,7 @@ expression: diagnostics
row: 432
column: 14
fix:
content:
- ","
content: ","
location:
row: 432
column: 14
@ -405,8 +387,7 @@ expression: diagnostics
row: 485
column: 21
fix:
content:
- ""
content: ""
location:
row: 485
column: 20
@ -423,8 +404,7 @@ expression: diagnostics
row: 487
column: 13
fix:
content:
- ""
content: ""
location:
row: 487
column: 12
@ -441,8 +421,7 @@ expression: diagnostics
row: 489
column: 18
fix:
content:
- ""
content: ""
location:
row: 489
column: 17
@ -459,8 +438,7 @@ expression: diagnostics
row: 494
column: 6
fix:
content:
- ""
content: ""
location:
row: 494
column: 5
@ -477,8 +455,7 @@ expression: diagnostics
row: 496
column: 21
fix:
content:
- ""
content: ""
location:
row: 496
column: 20
@ -495,8 +472,7 @@ expression: diagnostics
row: 498
column: 13
fix:
content:
- ""
content: ""
location:
row: 498
column: 12
@ -513,8 +489,7 @@ expression: diagnostics
row: 500
column: 18
fix:
content:
- ""
content: ""
location:
row: 500
column: 17
@ -531,8 +506,7 @@ expression: diagnostics
row: 505
column: 6
fix:
content:
- ""
content: ""
location:
row: 505
column: 5
@ -549,8 +523,7 @@ expression: diagnostics
row: 511
column: 10
fix:
content:
- ""
content: ""
location:
row: 511
column: 9
@ -567,8 +540,7 @@ expression: diagnostics
row: 513
column: 9
fix:
content:
- ""
content: ""
location:
row: 513
column: 8
@ -585,8 +557,7 @@ expression: diagnostics
row: 519
column: 12
fix:
content:
- ","
content: ","
location:
row: 519
column: 12
@ -603,8 +574,7 @@ expression: diagnostics
row: 526
column: 9
fix:
content:
- ","
content: ","
location:
row: 526
column: 9
@ -621,8 +591,7 @@ expression: diagnostics
row: 534
column: 15
fix:
content:
- ","
content: ","
location:
row: 534
column: 15
@ -639,8 +608,7 @@ expression: diagnostics
row: 541
column: 12
fix:
content:
- ","
content: ","
location:
row: 541
column: 12
@ -657,8 +625,7 @@ expression: diagnostics
row: 547
column: 23
fix:
content:
- ","
content: ","
location:
row: 547
column: 23
@ -675,8 +642,7 @@ expression: diagnostics
row: 554
column: 14
fix:
content:
- ","
content: ","
location:
row: 554
column: 14
@ -693,8 +659,7 @@ expression: diagnostics
row: 561
column: 12
fix:
content:
- ","
content: ","
location:
row: 561
column: 12
@ -711,8 +676,7 @@ expression: diagnostics
row: 565
column: 12
fix:
content:
- ","
content: ","
location:
row: 565
column: 12
@ -729,8 +693,7 @@ expression: diagnostics
row: 573
column: 9
fix:
content:
- ","
content: ","
location:
row: 573
column: 9
@ -747,8 +710,7 @@ expression: diagnostics
row: 577
column: 9
fix:
content:
- ","
content: ","
location:
row: 577
column: 9
@ -765,8 +727,7 @@ expression: diagnostics
row: 583
column: 9
fix:
content:
- ","
content: ","
location:
row: 583
column: 9
@ -783,8 +744,7 @@ expression: diagnostics
row: 590
column: 12
fix:
content:
- ","
content: ","
location:
row: 590
column: 12
@ -801,8 +761,7 @@ expression: diagnostics
row: 598
column: 14
fix:
content:
- ","
content: ","
location:
row: 598
column: 14
@ -819,8 +778,7 @@ expression: diagnostics
row: 627
column: 19
fix:
content:
- ","
content: ","
location:
row: 627
column: 19

View file

@ -8,9 +8,9 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::assert_yaml_snapshot;
use crate::registry::Rule;
use crate::settings::Settings;
use crate::test::test_path;
@ -31,7 +31,6 @@ mod tests {
#[test_case(Rule::UnnecessarySubscriptReversal, Path::new("C415.py"); "C415")]
#[test_case(Rule::UnnecessaryComprehension, Path::new("C416.py"); "C416")]
#[test_case(Rule::UnnecessaryMap, Path::new("C417.py"); "C417")]
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 29
fix:
content:
- "[x for x in range(3)]"
content: "[x for x in range(3)]"
location:
row: 1
column: 4
@ -29,10 +28,7 @@ expression: diagnostics
row: 4
column: 1
fix:
content:
- "["
- " x for x in range(3)"
- "]"
content: "[\n x for x in range(3)\n]"
location:
row: 2
column: 4

View file

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

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 30
fix:
content:
- "{x: x for x in range(3)}"
content: "{x: x for x in range(3)}"
location:
row: 1
column: 0
@ -29,10 +28,7 @@ expression: diagnostics
row: 4
column: 1
fix:
content:
- "{"
- " x: x for x in range(3)"
- "}"
content: "{\n x: x for x in range(3)\n}"
location:
row: 2
column: 0
@ -49,8 +45,7 @@ expression: diagnostics
row: 6
column: 37
fix:
content:
- " {x: x for x in range(3)} "
content: " {x: x for x in range(3)} "
location:
row: 6
column: 7
@ -67,8 +62,7 @@ expression: diagnostics
row: 7
column: 45
fix:
content:
- " {x: x for x in range(3)} "
content: " {x: x for x in range(3)} "
location:
row: 7
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 30
fix:
content:
- "{x for x in range(3)}"
content: "{x for x in range(3)}"
location:
row: 1
column: 4
@ -29,10 +28,7 @@ expression: diagnostics
row: 4
column: 1
fix:
content:
- "{"
- " x for x in range(3)"
- "}"
content: "{\n x for x in range(3)\n}"
location:
row: 2
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 32
fix:
content:
- "{i: i for i in range(3)}"
content: "{i: i for i in range(3)}"
location:
row: 1
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 11
fix:
content:
- "{1, 2}"
content: "{1, 2}"
location:
row: 1
column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 11
fix:
content:
- "{1, 2}"
content: "{1, 2}"
location:
row: 2
column: 0
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 7
fix:
content:
- set()
content: set()
location:
row: 3
column: 0
@ -69,8 +66,7 @@ expression: diagnostics
row: 4
column: 7
fix:
content:
- set()
content: set()
location:
row: 4
column: 0
@ -88,8 +84,7 @@ expression: diagnostics
row: 6
column: 9
fix:
content:
- "{1}"
content: "{1}"
location:
row: 6
column: 0
@ -107,10 +102,7 @@ expression: diagnostics
row: 9
column: 2
fix:
content:
- "{"
- " 1,"
- "}"
content: "{\n 1,\n}"
location:
row: 7
column: 0
@ -128,10 +120,7 @@ expression: diagnostics
row: 12
column: 2
fix:
content:
- "{"
- " 1,"
- "}"
content: "{\n 1,\n}"
location:
row: 10
column: 0
@ -149,8 +138,7 @@ expression: diagnostics
row: 15
column: 1
fix:
content:
- "{1}"
content: "{1}"
location:
row: 13
column: 0
@ -168,8 +156,7 @@ expression: diagnostics
row: 18
column: 1
fix:
content:
- "{1,}"
content: "{1,}"
location:
row: 16
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 19
fix:
content:
- "{1: 2}"
content: "{1: 2}"
location:
row: 1
column: 5
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 20
fix:
content:
- "{1: 2,}"
content: "{1: 2,}"
location:
row: 2
column: 5
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 13
fix:
content:
- "{}"
content: "{}"
location:
row: 3
column: 5
@ -69,8 +66,7 @@ expression: diagnostics
row: 4
column: 13
fix:
content:
- "{}"
content: "{}"
location:
row: 4
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 11
fix:
content:
- ()
content: ()
location:
row: 1
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 10
fix:
content:
- "[]"
content: "[]"
location:
row: 2
column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 11
fix:
content:
- "{}"
content: "{}"
location:
row: 3
column: 5
@ -69,8 +66,7 @@ expression: diagnostics
row: 4
column: 14
fix:
content:
- "{\"a\": 1}"
content: "{\"a\": 1}"
location:
row: 4
column: 5

View file

@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 11
fix:
content:
- ()
content: ()
location:
row: 1
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 10
fix:
content:
- "[]"
content: "[]"
location:
row: 2
column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 11
fix:
content:
- "{}"
content: "{}"
location:
row: 3
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 14
fix:
content:
- ()
content: ()
location:
row: 1
column: 5
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 18
fix:
content:
- "(1, 2)"
content: "(1, 2)"
location:
row: 2
column: 5
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 18
fix:
content:
- "(1, 2)"
content: "(1, 2)"
location:
row: 3
column: 5
@ -69,11 +66,7 @@ expression: diagnostics
row: 7
column: 2
fix:
content:
- (
- " 1,"
- " 2"
- )
content: "(\n 1,\n 2\n)"
location:
row: 4
column: 5
@ -91,8 +84,7 @@ expression: diagnostics
row: 10
column: 1
fix:
content:
- "(1, 2)"
content: "(1, 2)"
location:
row: 8
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 17
fix:
content:
- "[1, 2]"
content: "[1, 2]"
location:
row: 1
column: 5
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 17
fix:
content:
- "[1, 2]"
content: "[1, 2]"
location:
row: 2
column: 5
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 13
fix:
content:
- "[]"
content: "[]"
location:
row: 3
column: 5
@ -69,8 +66,7 @@ expression: diagnostics
row: 4
column: 13
fix:
content:
- "[]"
content: "[]"
location:
row: 4
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 2
column: 20
fix:
content:
- "[i for i in x]"
content: "[i for i in x]"
location:
row: 2
column: 0

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -8,11 +8,12 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::registry::Rule;
use crate::settings;
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_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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 4
fix:
content:
- ""
content: ""
location:
row: 1
column: 0

View file

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

View file

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

View file

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

View file

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

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 4
column: 8
fix:
content:
- ""
content: ""
location:
row: 4
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 9
column: 8
fix:
content:
- ""
content: ""
location:
row: 9
column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 14
column: 8
fix:
content:
- ""
content: ""
location:
row: 14
column: 4
@ -65,8 +62,7 @@ expression: diagnostics
row: 21
column: 8
fix:
content:
- ""
content: ""
location:
row: 21
column: 0
@ -83,8 +79,7 @@ expression: diagnostics
row: 28
column: 8
fix:
content:
- ""
content: ""
location:
row: 28
column: 0
@ -101,8 +96,7 @@ expression: diagnostics
row: 35
column: 8
fix:
content:
- ""
content: ""
location:
row: 35
column: 0
@ -119,8 +113,7 @@ expression: diagnostics
row: 42
column: 8
fix:
content:
- ""
content: ""
location:
row: 42
column: 0
@ -137,8 +130,7 @@ expression: diagnostics
row: 50
column: 8
fix:
content:
- ""
content: ""
location:
row: 50
column: 0
@ -155,8 +147,7 @@ expression: diagnostics
row: 58
column: 8
fix:
content:
- ""
content: ""
location:
row: 58
column: 0
@ -173,8 +164,7 @@ expression: diagnostics
row: 65
column: 8
fix:
content:
- ""
content: ""
location:
row: 65
column: 0
@ -191,8 +181,7 @@ expression: diagnostics
row: 74
column: 8
fix:
content:
- ""
content: ""
location:
row: 74
column: 0
@ -209,8 +198,7 @@ expression: diagnostics
row: 79
column: 8
fix:
content:
- ""
content: ""
location:
row: 79
column: 0
@ -227,8 +215,7 @@ expression: diagnostics
row: 83
column: 8
fix:
content:
- ""
content: ""
location:
row: 83
column: 0
@ -245,8 +232,7 @@ expression: diagnostics
row: 87
column: 8
fix:
content:
- ""
content: ""
location:
row: 87
column: 0
@ -263,8 +249,7 @@ expression: diagnostics
row: 92
column: 8
fix:
content:
- ""
content: ""
location:
row: 92
column: 0
@ -281,8 +266,7 @@ expression: diagnostics
row: 96
column: 8
fix:
content:
- ""
content: ""
location:
row: 96
column: 0
@ -299,8 +283,7 @@ expression: diagnostics
row: 101
column: 8
fix:
content:
- ""
content: ""
location:
row: 101
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 4
column: 24
fix:
content:
- ""
content: ""
location:
row: 4
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 13
column: 24
fix:
content:
- ""
content: ""
location:
row: 13
column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 23
column: 23
fix:
content:
- ""
content: ""
location:
row: 23
column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 40
column: 23
fix:
content:
- ""
content: ""
location:
row: 40
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 3
column: 53
fix:
content:
- list
content: list
location:
row: 3
column: 43
@ -29,8 +28,7 @@ expression: diagnostics
row: 7
column: 45
fix:
content:
- list
content: list
location:
row: 7
column: 35
@ -47,8 +45,7 @@ expression: diagnostics
row: 11
column: 37
fix:
content:
- list
content: list
location:
row: 11
column: 27

View file

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

View file

@ -6,11 +6,12 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::registry::Rule;
use crate::settings;
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.py"))]

View file

@ -8,13 +8,14 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use super::settings::Settings;
use super::types;
use crate::registry::Rule;
use crate::settings;
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(

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
---
- kind:
@ -13,8 +13,7 @@ expression: diagnostics
row: 9
column: 15
fix:
content:
- ()
content: ()
location:
row: 9
column: 15
@ -33,8 +32,7 @@ expression: diagnostics
row: 34
column: 8
fix:
content:
- ()
content: ()
location:
row: 34
column: 8
@ -53,8 +51,7 @@ expression: diagnostics
row: 59
column: 8
fix:
content:
- ()
content: ()
location:
row: 59
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
---
- kind:
@ -13,8 +13,7 @@ expression: diagnostics
row: 14
column: 17
fix:
content:
- ""
content: ""
location:
row: 14
column: 15
@ -33,8 +32,7 @@ expression: diagnostics
row: 26
column: 1
fix:
content:
- ""
content: ""
location:
row: 24
column: 15
@ -53,8 +51,7 @@ expression: diagnostics
row: 39
column: 10
fix:
content:
- ""
content: ""
location:
row: 39
column: 8
@ -73,8 +70,7 @@ expression: diagnostics
row: 51
column: 1
fix:
content:
- ""
content: ""
location:
row: 49
column: 8
@ -93,8 +89,7 @@ expression: diagnostics
row: 64
column: 10
fix:
content:
- ""
content: ""
location:
row: 64
column: 8
@ -113,8 +108,7 @@ expression: diagnostics
row: 76
column: 1
fix:
content:
- ""
content: ""
location:
row: 74
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 14
column: 32
fix:
content:
- ""
content: ""
location:
row: 14
column: 16
@ -29,8 +28,7 @@ expression: diagnostics
row: 19
column: 32
fix:
content:
- ""
content: ""
location:
row: 19
column: 16
@ -47,8 +45,7 @@ expression: diagnostics
row: 24
column: 51
fix:
content:
- ""
content: ""
location:
row: 24
column: 33
@ -65,8 +62,7 @@ expression: diagnostics
row: 29
column: 51
fix:
content:
- ""
content: ""
location:
row: 29
column: 35
@ -83,8 +79,7 @@ expression: diagnostics
row: 37
column: 46
fix:
content:
- ""
content: ""
location:
row: 37
column: 28
@ -101,8 +96,7 @@ expression: diagnostics
row: 43
column: 20
fix:
content:
- ""
content: ""
location:
row: 43
column: 4
@ -119,8 +113,7 @@ expression: diagnostics
row: 52
column: 20
fix:
content:
- ""
content: ""
location:
row: 51
column: 21
@ -137,8 +130,7 @@ expression: diagnostics
row: 67
column: 18
fix:
content:
- ""
content: ""
location:
row: 66
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 24
column: 45
fix:
content:
- "\"param1,param2\""
content: "\"param1,param2\""
location:
row: 24
column: 25
@ -31,8 +30,7 @@ expression: diagnostics
row: 29
column: 36
fix:
content:
- "\"param1\""
content: "\"param1\""
location:
row: 29
column: 25
@ -50,8 +48,7 @@ expression: diagnostics
row: 34
column: 45
fix:
content:
- "\"param1,param2\""
content: "\"param1,param2\""
location:
row: 34
column: 25
@ -69,8 +66,7 @@ expression: diagnostics
row: 39
column: 35
fix:
content:
- "\"param1\""
content: "\"param1\""
location:
row: 39
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 9
column: 40
fix:
content:
- "(\"param1\", \"param2\")"
content: "(\"param1\", \"param2\")"
location:
row: 9
column: 25
@ -31,8 +30,7 @@ expression: diagnostics
row: 14
column: 56
fix:
content:
- "(\"param1\", \"param2\")"
content: "(\"param1\", \"param2\")"
location:
row: 14
column: 25
@ -50,8 +48,7 @@ expression: diagnostics
row: 19
column: 40
fix:
content:
- "(\"param1\", \"param2\")"
content: "(\"param1\", \"param2\")"
location:
row: 19
column: 25
@ -69,8 +66,7 @@ expression: diagnostics
row: 29
column: 36
fix:
content:
- "\"param1\""
content: "\"param1\""
location:
row: 29
column: 25
@ -88,8 +84,7 @@ expression: diagnostics
row: 34
column: 45
fix:
content:
- "(\"param1\", \"param2\")"
content: "(\"param1\", \"param2\")"
location:
row: 34
column: 25
@ -107,8 +102,7 @@ expression: diagnostics
row: 39
column: 35
fix:
content:
- "\"param1\""
content: "\"param1\""
location:
row: 39
column: 25
@ -126,8 +120,7 @@ expression: diagnostics
row: 44
column: 50
fix:
content:
- "(some_expr, another_expr)"
content: "(some_expr, another_expr)"
location:
row: 44
column: 25
@ -145,8 +138,7 @@ expression: diagnostics
row: 49
column: 46
fix:
content:
- "(some_expr, \"param2\")"
content: "(some_expr, \"param2\")"
location:
row: 49
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 9
column: 40
fix:
content:
- "[\"param1\", \"param2\"]"
content: "[\"param1\", \"param2\"]"
location:
row: 9
column: 25
@ -31,8 +30,7 @@ expression: diagnostics
row: 14
column: 56
fix:
content:
- "[\"param1\", \"param2\"]"
content: "[\"param1\", \"param2\"]"
location:
row: 14
column: 25
@ -50,8 +48,7 @@ expression: diagnostics
row: 19
column: 40
fix:
content:
- "[\"param1\", \"param2\"]"
content: "[\"param1\", \"param2\"]"
location:
row: 19
column: 25
@ -69,8 +66,7 @@ expression: diagnostics
row: 24
column: 45
fix:
content:
- "[\"param1\", \"param2\"]"
content: "[\"param1\", \"param2\"]"
location:
row: 24
column: 25
@ -88,8 +84,7 @@ expression: diagnostics
row: 29
column: 36
fix:
content:
- "\"param1\""
content: "\"param1\""
location:
row: 29
column: 25
@ -107,8 +102,7 @@ expression: diagnostics
row: 39
column: 35
fix:
content:
- "\"param1\""
content: "\"param1\""
location:
row: 39
column: 25

View file

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

View file

@ -12,9 +12,7 @@ expression: diagnostics
row: 13
column: 39
fix:
content:
- assert something
- assert something_else
content: "assert something\nassert something_else"
location:
row: 13
column: 4
@ -32,10 +30,7 @@ expression: diagnostics
row: 14
column: 59
fix:
content:
- assert something
- assert something_else
- assert something_third
content: "assert something\nassert something_else\nassert something_third"
location:
row: 14
column: 4
@ -53,9 +48,7 @@ expression: diagnostics
row: 15
column: 43
fix:
content:
- assert something
- assert not something_else
content: "assert something\nassert not something_else"
location:
row: 15
column: 4
@ -73,9 +66,7 @@ expression: diagnostics
row: 16
column: 60
fix:
content:
- assert something
- assert something_else or something_third
content: "assert something\nassert something_else or something_third"
location:
row: 16
column: 4
@ -93,9 +84,7 @@ expression: diagnostics
row: 17
column: 43
fix:
content:
- assert not something
- assert something_else
content: "assert not something\nassert something_else"
location:
row: 17
column: 4
@ -113,9 +102,7 @@ expression: diagnostics
row: 18
column: 44
fix:
content:
- assert not something
- assert not something_else
content: "assert not something\nassert not something_else"
location:
row: 18
column: 4
@ -133,10 +120,7 @@ expression: diagnostics
row: 19
column: 63
fix:
content:
- assert not something
- assert not something_else
- assert not something_third
content: "assert not something\nassert not something_else\nassert not something_third"
location:
row: 19
column: 4
@ -154,9 +138,7 @@ expression: diagnostics
row: 22
column: 34
fix:
content:
- assert not a
- assert b or c
content: "assert not a\nassert b or c"
location:
row: 22
column: 4
@ -174,9 +156,7 @@ expression: diagnostics
row: 23
column: 35
fix:
content:
- assert not a
- assert b and c
content: "assert not a\nassert b and c"
location:
row: 23
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 17
column: 18
fix:
content:
- return
content: return
location:
row: 17
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
---
- kind:
@ -14,8 +14,7 @@ expression: diagnostics
row: 12
column: 16
fix:
content:
- ()
content: ()
location:
row: 12
column: 16
@ -35,8 +34,7 @@ expression: diagnostics
row: 17
column: 16
fix:
content:
- ()
content: ()
location:
row: 17
column: 16
@ -56,8 +54,7 @@ expression: diagnostics
row: 24
column: 20
fix:
content:
- ()
content: ()
location:
row: 24
column: 20
@ -77,8 +74,7 @@ expression: diagnostics
row: 30
column: 20
fix:
content:
- ()
content: ()
location:
row: 30
column: 20
@ -98,8 +94,7 @@ expression: diagnostics
row: 38
column: 24
fix:
content:
- ()
content: ()
location:
row: 38
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
---
- kind:
@ -14,8 +14,7 @@ expression: diagnostics
row: 46
column: 18
fix:
content:
- ""
content: ""
location:
row: 46
column: 16
@ -35,8 +34,7 @@ expression: diagnostics
row: 51
column: 18
fix:
content:
- ""
content: ""
location:
row: 51
column: 16
@ -56,8 +54,7 @@ expression: diagnostics
row: 58
column: 22
fix:
content:
- ""
content: ""
location:
row: 58
column: 20
@ -77,8 +74,7 @@ expression: diagnostics
row: 64
column: 22
fix:
content:
- ""
content: ""
location:
row: 64
column: 20
@ -98,8 +94,7 @@ expression: diagnostics
row: 72
column: 26
fix:
content:
- ""
content: ""
location:
row: 72
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 14
column: 22
fix:
content:
- ""
content: ""
location:
row: 14
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 20
column: 20
fix:
content:
- ""
content: ""
location:
row: 20
column: 0
@ -47,8 +45,7 @@ expression: diagnostics
row: 27
column: 22
fix:
content:
- ""
content: ""
location:
row: 27
column: 0
@ -65,8 +62,7 @@ expression: diagnostics
row: 33
column: 20
fix:
content:
- ""
content: ""
location:
row: 33
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 9
column: 29
fix:
content:
- ""
content: ""
location:
row: 9
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 16
column: 29
fix:
content:
- ""
content: ""
location:
row: 16
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
---
- kind:
@ -11,8 +11,7 @@ expression: diagnostics
row: 19
column: 26
fix:
content:
- ""
content: ""
location:
row: 19
column: 0
@ -29,8 +28,7 @@ expression: diagnostics
row: 24
column: 24
fix:
content:
- ""
content: ""
location:
row: 24
column: 0

View file

@ -7,10 +7,10 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use super::settings::Quote;
use crate::assert_yaml_snapshot;
use crate::registry::Rule;
use crate::settings::Settings;
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 7
column: 3
fix:
content:
- "'''"
- this is not a docstring
- "'''"
content: "'''\nthis is not a docstring\n'''"
location:
row: 5
column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 18
column: 7
fix:
content:
- "'''"
- " this is not a docstring"
- " '''"
content: "'''\n this is not a docstring\n '''"
location:
row: 16
column: 4
@ -54,9 +48,7 @@ expression: diagnostics
row: 22
column: 37
fix:
content:
- "'''"
- " definitely not a docstring'''"
content: "'''\n definitely not a docstring'''"
location:
row: 21
column: 20
@ -74,10 +66,7 @@ expression: diagnostics
row: 32
column: 11
fix:
content:
- "'''"
- " this is not a docstring"
- " '''"
content: "'''\n this is not a docstring\n '''"
location:
row: 30
column: 8
@ -95,10 +84,7 @@ expression: diagnostics
row: 37
column: 15
fix:
content:
- "'''"
- " Looks like a docstring, but in reality it isn't - only modules, classes and functions"
- " '''"
content: "'''\n Looks like a docstring, but in reality it isn't - only modules, classes and functions\n '''"
location:
row: 35
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3
column: 27
fix:
content:
- "''' Not a docstring '''"
content: "''' Not a docstring '''"
location:
row: 3
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 5
column: 43
fix:
content:
- "'''not a docstring'''"
content: "'''not a docstring'''"
location:
row: 5
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3
column: 26
fix:
content:
- "''' not a docstring'''"
content: "''' not a docstring'''"
location:
row: 3
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 11
column: 26
fix:
content:
- "''' not a docstring'''"
content: "''' not a docstring'''"
location:
row: 11
column: 4
@ -50,10 +48,7 @@ expression: diagnostics
row: 17
column: 3
fix:
content:
- "'''"
- " not a"
- "'''"
content: "'''\n not a\n'''"
location:
row: 15
column: 38
@ -71,8 +66,7 @@ expression: diagnostics
row: 17
column: 19
fix:
content:
- "'''docstring'''"
content: "'''docstring'''"
location:
row: 17
column: 4
@ -90,8 +84,7 @@ expression: diagnostics
row: 22
column: 27
fix:
content:
- "''' not a docstring '''"
content: "''' not a docstring '''"
location:
row: 22
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 6
column: 3
fix:
content:
- "'''"
- this is not a docstring
- "'''"
content: "'''\nthis is not a docstring\n'''"
location:
row: 4
column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 11
column: 3
fix:
content:
- "'''"
- this is not a docstring
- "'''"
content: "'''\nthis is not a docstring\n'''"
location:
row: 9
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 31
fix:
content:
- "''' this is not a docstring '''"
content: "''' this is not a docstring '''"
location:
row: 2
column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 6
column: 31
fix:
content:
- "''' this is not a docstring '''"
content: "''' this is not a docstring '''"
location:
row: 6
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3
column: 3
fix:
content:
- "\"\"\""
- Single quotes multiline module docstring
- "\"\"\""
content: "\"\"\"\nSingle quotes multiline module docstring\n\"\"\""
location:
row: 1
column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 16
column: 7
fix:
content:
- "\"\"\""
- " Single quotes multiline class docstring"
- " \"\"\""
content: "\"\"\"\n Single quotes multiline class docstring\n \"\"\""
location:
row: 14
column: 4
@ -54,10 +48,7 @@ expression: diagnostics
row: 28
column: 11
fix:
content:
- "\"\"\""
- " Single quotes multiline function docstring"
- " \"\"\""
content: "\"\"\"\n Single quotes multiline function docstring\n \"\"\""
location:
row: 26
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 53
fix:
content:
- "\"\"\" Double quotes single line class docstring \"\"\""
content: "\"\"\" Double quotes single line class docstring \"\"\""
location:
row: 2
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 6
column: 57
fix:
content:
- "\"\"\" Double quotes single line method docstring\"\"\""
content: "\"\"\" Double quotes single line method docstring\"\"\""
location:
row: 6
column: 8
@ -50,8 +48,7 @@ expression: diagnostics
row: 9
column: 52
fix:
content:
- "\"\"\" inline docstring \"\"\""
content: "\"\"\" inline docstring \"\"\""
location:
row: 9
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 56
fix:
content:
- "\"\"\"function without params, single line docstring\"\"\""
content: "\"\"\"function without params, single line docstring\"\"\""
location:
row: 2
column: 4
@ -31,10 +30,7 @@ expression: diagnostics
row: 10
column: 7
fix:
content:
- "\"\"\""
- " function without params, multiline docstring"
- " \"\"\""
content: "\"\"\"\n function without params, multiline docstring\n \"\"\""
location:
row: 8
column: 4
@ -52,8 +48,7 @@ expression: diagnostics
row: 27
column: 27
fix:
content:
- "\"Single line docstring\""
content: "\"Single line docstring\""
location:
row: 27
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3
column: 3
fix:
content:
- "\"\"\""
- Double quotes multiline module docstring
- "\"\"\""
content: "\"\"\"\nDouble quotes multiline module docstring\n\"\"\""
location:
row: 1
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 49
fix:
content:
- "\"\"\" Double quotes singleline module docstring \"\"\""
content: "\"\"\" Double quotes singleline module docstring \"\"\""
location:
row: 1
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3
column: 3
fix:
content:
- "'''"
- Double quotes multiline module docstring
- "'''"
content: "'''\nDouble quotes multiline module docstring\n'''"
location:
row: 1
column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 14
column: 7
fix:
content:
- "'''"
- " Double quotes multiline class docstring"
- " '''"
content: "'''\n Double quotes multiline class docstring\n '''"
location:
row: 12
column: 4
@ -54,10 +48,7 @@ expression: diagnostics
row: 26
column: 11
fix:
content:
- "'''"
- " Double quotes multiline function docstring"
- " '''"
content: "'''\n Double quotes multiline function docstring\n '''"
location:
row: 24
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 53
fix:
content:
- "''' Double quotes single line class docstring '''"
content: "''' Double quotes single line class docstring '''"
location:
row: 2
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 6
column: 57
fix:
content:
- "''' Double quotes single line method docstring'''"
content: "''' Double quotes single line method docstring'''"
location:
row: 6
column: 8
@ -50,8 +48,7 @@ expression: diagnostics
row: 9
column: 52
fix:
content:
- "''' inline docstring '''"
content: "''' inline docstring '''"
location:
row: 9
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 56
fix:
content:
- "'''function without params, single line docstring'''"
content: "'''function without params, single line docstring'''"
location:
row: 2
column: 4
@ -31,10 +30,7 @@ expression: diagnostics
row: 10
column: 7
fix:
content:
- "'''"
- " function without params, multiline docstring"
- " '''"
content: "'''\n function without params, multiline docstring\n '''"
location:
row: 8
column: 4
@ -52,8 +48,7 @@ expression: diagnostics
row: 27
column: 27
fix:
content:
- "'Single line docstring'"
content: "'Single line docstring'"
location:
row: 27
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3
column: 3
fix:
content:
- "'''"
- Double quotes multiline module docstring
- "'''"
content: "'''\nDouble quotes multiline module docstring\n'''"
location:
row: 1
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 49
fix:
content:
- "''' Double quotes singleline module docstring '''"
content: "''' Double quotes singleline module docstring '''"
location:
row: 1
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 7
column: 3
fix:
content:
- "\"\"\""
- this is not a docstring
- "\"\"\""
content: "\"\"\"\nthis is not a docstring\n\"\"\""
location:
row: 5
column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 13
column: 3
fix:
content:
- "\"\"\""
- " class params \\t not a docstring"
- "\"\"\""
content: "\"\"\"\n class params \\t not a docstring\n\"\"\""
location:
row: 11
column: 20
@ -54,10 +48,7 @@ expression: diagnostics
row: 20
column: 7
fix:
content:
- "\"\"\""
- " this is not a docstring"
- " \"\"\""
content: "\"\"\"\n this is not a docstring\n \"\"\""
location:
row: 18
column: 4
@ -75,9 +66,7 @@ expression: diagnostics
row: 24
column: 37
fix:
content:
- "\"\"\""
- " definitely not a docstring\"\"\""
content: "\"\"\"\n definitely not a docstring\"\"\""
location:
row: 23
column: 20
@ -95,10 +84,7 @@ expression: diagnostics
row: 34
column: 11
fix:
content:
- "\"\"\""
- " this is not a docstring"
- " \"\"\""
content: "\"\"\"\n this is not a docstring\n \"\"\""
location:
row: 32
column: 8
@ -116,10 +102,7 @@ expression: diagnostics
row: 39
column: 15
fix:
content:
- "\"\"\""
- " Looks like a docstring, but in reality it isn't - only modules, classes and functions"
- " \"\"\""
content: "\"\"\"\n Looks like a docstring, but in reality it isn't - only modules, classes and functions\n \"\"\""
location:
row: 37
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3
column: 27
fix:
content:
- "\"\"\" Not a docstring \"\"\""
content: "\"\"\" Not a docstring \"\"\""
location:
row: 3
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 5
column: 43
fix:
content:
- "\"\"\"not a docstring\"\"\""
content: "\"\"\"not a docstring\"\"\""
location:
row: 5
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 3
column: 26
fix:
content:
- "\"\"\" not a docstring\"\"\""
content: "\"\"\" not a docstring\"\"\""
location:
row: 3
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 11
column: 26
fix:
content:
- "\"\"\" not a docstring\"\"\""
content: "\"\"\" not a docstring\"\"\""
location:
row: 11
column: 4
@ -50,10 +48,7 @@ expression: diagnostics
row: 17
column: 3
fix:
content:
- "\"\"\""
- " not a"
- "\"\"\""
content: "\"\"\"\n not a\n\"\"\""
location:
row: 15
column: 38
@ -71,8 +66,7 @@ expression: diagnostics
row: 17
column: 19
fix:
content:
- "\"\"\"docstring\"\"\""
content: "\"\"\"docstring\"\"\""
location:
row: 17
column: 4
@ -90,8 +84,7 @@ expression: diagnostics
row: 22
column: 27
fix:
content:
- "\"\"\" not a docstring \"\"\""
content: "\"\"\" not a docstring \"\"\""
location:
row: 22
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 6
column: 3
fix:
content:
- "\"\"\""
- this is not a docstring
- "\"\"\""
content: "\"\"\"\nthis is not a docstring\n\"\"\""
location:
row: 4
column: 0
@ -33,10 +30,7 @@ expression: diagnostics
row: 11
column: 3
fix:
content:
- "\"\"\""
- this is not a docstring
- "\"\"\""
content: "\"\"\"\nthis is not a docstring\n\"\"\""
location:
row: 9
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 31
fix:
content:
- "\"\"\" this is not a docstring \"\"\""
content: "\"\"\" this is not a docstring \"\"\""
location:
row: 2
column: 0
@ -31,8 +30,7 @@ expression: diagnostics
row: 6
column: 31
fix:
content:
- "\"\"\" this is not a docstring \"\"\""
content: "\"\"\" this is not a docstring \"\"\""
location:
row: 6
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 45
fix:
content:
- "\"single quote string\""
content: "\"single quote string\""
location:
row: 1
column: 24
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 46
fix:
content:
- "u\"double quote string\""
content: "u\"double quote string\""
location:
row: 2
column: 24
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 46
fix:
content:
- "f\"double quote string\""
content: "f\"double quote string\""
location:
row: 3
column: 24

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 47
fix:
content:
- "'This is a \"string\"'"
content: "'This is a \"string\"'"
location:
row: 1
column: 25
@ -29,8 +28,7 @@ expression: diagnostics
row: 9
column: 16
fix:
content:
- "'\"string\"'"
content: "'\"string\"'"
location:
row: 9
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 10
fix:
content:
- "\"This\""
content: "\"This\""
location:
row: 2
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 3
column: 8
fix:
content:
- "\"is\""
content: "\"is\""
location:
row: 3
column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 4
column: 9
fix:
content:
- "\"not\""
content: "\"not\""
location:
row: 4
column: 4
@ -69,8 +66,7 @@ expression: diagnostics
row: 8
column: 10
fix:
content:
- "\"This\""
content: "\"This\""
location:
row: 8
column: 4
@ -88,8 +84,7 @@ expression: diagnostics
row: 9
column: 8
fix:
content:
- "\"is\""
content: "\"is\""
location:
row: 9
column: 4
@ -107,8 +102,7 @@ expression: diagnostics
row: 10
column: 9
fix:
content:
- "\"not\""
content: "\"not\""
location:
row: 10
column: 4
@ -126,8 +120,7 @@ expression: diagnostics
row: 27
column: 30
fix:
content:
- "\"But this needs to be changed\""
content: "\"But this needs to be changed\""
location:
row: 27
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3
column: 12
fix:
content:
- "\"\"\" This 'should'"
- be
- "'linted' \"\"\""
content: "\"\"\" This 'should'\nbe\n'linted' \"\"\""
location:
row: 1
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 1
column: 45
fix:
content:
- "'double quote string'"
content: "'double quote string'"
location:
row: 1
column: 24
@ -31,8 +30,7 @@ expression: diagnostics
row: 2
column: 46
fix:
content:
- "u'double quote string'"
content: "u'double quote string'"
location:
row: 2
column: 24
@ -50,8 +48,7 @@ expression: diagnostics
row: 3
column: 46
fix:
content:
- "f'double quote string'"
content: "f'double quote string'"
location:
row: 3
column: 24

View file

@ -11,8 +11,7 @@ expression: diagnostics
row: 1
column: 47
fix:
content:
- "\"This is a 'string'\""
content: "\"This is a 'string'\""
location:
row: 1
column: 25
@ -29,8 +28,7 @@ expression: diagnostics
row: 2
column: 52
fix:
content:
- "\"This is \\\\ a \\\\'string'\""
content: "\"This is \\\\ a \\\\'string'\""
location:
row: 2
column: 25
@ -47,8 +45,7 @@ expression: diagnostics
row: 10
column: 16
fix:
content:
- "\"'string'\""
content: "\"'string'\""
location:
row: 10
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
---
- kind:
@ -12,8 +12,7 @@ expression: diagnostics
row: 2
column: 10
fix:
content:
- "'This'"
content: "'This'"
location:
row: 2
column: 4
@ -31,8 +30,7 @@ expression: diagnostics
row: 3
column: 8
fix:
content:
- "'is'"
content: "'is'"
location:
row: 3
column: 4
@ -50,8 +48,7 @@ expression: diagnostics
row: 4
column: 9
fix:
content:
- "'not'"
content: "'not'"
location:
row: 4
column: 4
@ -69,8 +66,7 @@ expression: diagnostics
row: 8
column: 10
fix:
content:
- "'This'"
content: "'This'"
location:
row: 8
column: 4
@ -88,8 +84,7 @@ expression: diagnostics
row: 9
column: 8
fix:
content:
- "'is'"
content: "'is'"
location:
row: 9
column: 4
@ -107,8 +102,7 @@ expression: diagnostics
row: 10
column: 9
fix:
content:
- "'not'"
content: "'not'"
location:
row: 10
column: 4
@ -126,8 +120,7 @@ expression: diagnostics
row: 27
column: 30
fix:
content:
- "'But this needs to be changed'"
content: "'But this needs to be changed'"
location:
row: 27
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
---
- kind:
@ -12,10 +12,7 @@ expression: diagnostics
row: 3
column: 12
fix:
content:
- "''' This \"should\""
- be
- "\"linted\" '''"
content: "''' This \"should\"\nbe\n\"linted\" '''"
location:
row: 1
column: 4

View file

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

View file

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

View file

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

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