-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ccfc77
commit fb5e255
Showing
3 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...ake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap.new
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs | ||
assertion_line: 72 | ||
--- | ||
B006_8.py:1:19: B006 [*] Do not use mutable data structures for argument defaults | ||
| | ||
1 | def foo(a: list = []): | ||
| ^^ B006 | ||
2 | raise NotImplementedError("") | ||
| | ||
= help: Replace with `None`; initialize within function | ||
|
||
ℹ Unsafe fix | ||
1 |-def foo(a: list = []): | ||
1 |+def foo(a: list = None): | ||
2 2 | raise NotImplementedError("") | ||
3 3 | | ||
4 4 | | ||
|
||
B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument defaults | ||
| | ||
5 | def bar(a: dict = {}): | ||
| ^^ B006 | ||
6 | """ This one also has a docstring""" | ||
7 | raise NotImplementedError("and has some text in here") | ||
| | ||
= help: Replace with `None`; initialize within function | ||
|
||
ℹ Unsafe fix | ||
2 2 | raise NotImplementedError("") | ||
3 3 | | ||
4 4 | | ||
5 |-def bar(a: dict = {}): | ||
5 |+def bar(a: dict = None): | ||
6 6 | """ This one also has a docstring""" | ||
7 7 | raise NotImplementedError("and has some text in here") | ||
8 8 | | ||
|
||
B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaults | ||
| | ||
10 | def baz(a: list = []): | ||
| ^^ B006 | ||
11 | """This one raises a different exception""" | ||
12 | raise IndexError() | ||
| | ||
= help: Replace with `None`; initialize within function | ||
|
||
ℹ Unsafe fix | ||
7 7 | raise NotImplementedError("and has some text in here") | ||
8 8 | | ||
9 9 | | ||
10 |-def baz(a: list = []): | ||
10 |+def baz(a: list = None): | ||
11 11 | """This one raises a different exception""" | ||
12 |+ if a is None: | ||
13 |+ a = [] | ||
12 14 | raise IndexError() | ||
13 15 | | ||
14 16 | | ||
|
||
B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaults | ||
| | ||
15 | def qux(a: list = []): | ||
| ^^ B006 | ||
16 | raise NotImplementedError | ||
| | ||
= help: Replace with `None`; initialize within function | ||
|
||
ℹ Unsafe fix | ||
12 12 | raise IndexError() | ||
13 13 | | ||
14 14 | | ||
15 |-def qux(a: list = []): | ||
15 |+def qux(a: list = None): | ||
16 16 | raise NotImplementedError | ||
17 17 | | ||
18 18 | | ||
|
||
B006_8.py:19:20: B006 [*] Do not use mutable data structures for argument defaults | ||
| | ||
19 | def quux(a: list = []): | ||
| ^^ B006 | ||
20 | raise NotImplemented | ||
| | ||
= help: Replace with `None`; initialize within function | ||
|
||
ℹ Unsafe fix | ||
16 16 | raise NotImplementedError | ||
17 17 | | ||
18 18 | | ||
19 |-def quux(a: list = []): | ||
19 |+def quux(a: list = None): | ||
20 20 | raise NotImplemented |