diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000000..39136639ef --- /dev/null +++ b/_typos.toml @@ -0,0 +1,2 @@ +[files] +extend-exclude = ["snapshots"] diff --git a/crates/ruff/resources/test/fixtures/pylint/bad_str_strip_call.py b/crates/ruff/resources/test/fixtures/pylint/bad_str_strip_call.py index fafc233398..b7344b26ad 100644 --- a/crates/ruff/resources/test/fixtures/pylint/bad_str_strip_call.py +++ b/crates/ruff/resources/test/fixtures/pylint/bad_str_strip_call.py @@ -11,16 +11,16 @@ "Hello World".strip(r"Hello") # PLE1310 -"Hello World".strip("Hel\tlo") +"Hello World".strip("Hello\t") # PLE1310 -"Hello World".strip(r"He\tllo") +"Hello World".strip(r"Hello\t") # PLE1310 -"Hello World".strip("Hel\\lo") +"Hello World".strip("Hello\\") # PLE1310 -"Hello World".strip(r"He\\llo") +"Hello World".strip(r"Hello\\") # PLE1310 "Hello World".strip("🤣🤣🤣🤣🙃👀😀") diff --git a/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap.new b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap.new new file mode 100644 index 0000000000..72a79d636c --- /dev/null +++ b/crates/ruff/src/rules/pylint/snapshots/ruff__rules__pylint__tests__PLE1310_bad_str_strip_call.py.snap.new @@ -0,0 +1,278 @@ +--- +source: crates/ruff/src/rules/pylint/mod.rs +assertion_line: 50 +expression: diagnostics +--- +- kind: + BadStrStripCall: + kind: Strip + location: + row: 2 + column: 20 + end_location: + row: 2 + column: 27 + fix: + content: + - "\"Helo\"" + location: + row: 2 + column: 20 + end_location: + row: 2 + column: 27 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 5 + column: 20 + end_location: + row: 5 + column: 27 + fix: + content: + - "\"Helo\"" + location: + row: 5 + column: 20 + end_location: + row: 5 + column: 27 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 8 + column: 20 + end_location: + row: 8 + column: 28 + fix: + content: + - "u\"Helo\"" + location: + row: 8 + column: 20 + end_location: + row: 8 + column: 28 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 11 + column: 20 + end_location: + row: 11 + column: 28 + fix: + content: + - "r\"Helo\"" + location: + row: 11 + column: 20 + end_location: + row: 11 + column: 28 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 14 + column: 20 + end_location: + row: 14 + column: 29 + fix: + content: + - "\"Helo\\t\"" + location: + row: 14 + column: 20 + end_location: + row: 14 + column: 29 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 17 + column: 20 + end_location: + row: 17 + column: 30 + fix: + content: + - "r\"Helo\\t\"" + location: + row: 17 + column: 20 + end_location: + row: 17 + column: 30 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 20 + column: 20 + end_location: + row: 20 + column: 29 + fix: + content: + - "\"Helo\\\\\"" + location: + row: 20 + column: 20 + end_location: + row: 20 + column: 29 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 23 + column: 20 + end_location: + row: 23 + column: 30 + fix: + content: + - "r\"Helo\\\"" + location: + row: 23 + column: 20 + end_location: + row: 23 + column: 30 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 26 + column: 20 + end_location: + row: 26 + column: 29 + fix: + content: + - "\"🤣🙃👀😀\"" + location: + row: 26 + column: 20 + end_location: + row: 26 + column: 29 + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 30 + column: 4 + end_location: + row: 32 + column: 3 + fix: ~ + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 36 + column: 20 + end_location: + row: 38 + column: 29 + fix: ~ + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 42 + column: 4 + end_location: + row: 44 + column: 13 + fix: ~ + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 49 + column: 4 + end_location: + row: 51 + column: 13 + fix: ~ + parent: ~ +- kind: + BadStrStripCall: + kind: Strip + location: + row: 61 + column: 10 + end_location: + row: 61 + column: 19 + fix: + content: + - "'htp:/'" + location: + row: 61 + column: 10 + end_location: + row: 61 + column: 19 + parent: ~ +- kind: + BadStrStripCall: + kind: LStrip + location: + row: 64 + column: 11 + end_location: + row: 64 + column: 20 + fix: + content: + - "'htp:/'" + location: + row: 64 + column: 11 + end_location: + row: 64 + column: 20 + parent: ~ +- kind: + BadStrStripCall: + kind: RStrip + location: + row: 67 + column: 11 + end_location: + row: 67 + column: 20 + fix: + content: + - "'htp:/'" + location: + row: 67 + column: 11 + end_location: + row: 67 + column: 20 + parent: ~ +