Skip to content

Commit

Permalink
Add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Sep 5, 2023
1 parent 76ab6b6 commit 5d52b0d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
7 changes: 3 additions & 4 deletions crates/ruff/resources/test/fixtures/flake8_bugbear/B006_2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Docstring followed by whitespace with no newline
# Regression test for https://github.com/astral-sh/ruff/issues/7155

def readLinkagesByLineFile(linkages_file,
column_mapping={
}):
def foobar(foor, bar={}):
"""
"""
"""
2 changes: 2 additions & 0 deletions crates/ruff/src/rules/flake8_bugbear/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ mod tests {
#[test_case(Rule::JumpStatementInFinally, Path::new("B012.py"))]
#[test_case(Rule::LoopVariableOverridesIterator, Path::new("B020.py"))]
#[test_case(Rule::MutableArgumentDefault, Path::new("B006_B008.py"))]
#[test_case(Rule::MutableArgumentDefault, Path::new("B006_1.py"))]
#[test_case(Rule::MutableArgumentDefault, Path::new("B006_2.py"))]
#[test_case(Rule::MutableArgumentDefault, Path::new("B006_3.py"))]
#[test_case(Rule::NoExplicitStacklevel, Path::new("B028.py"))]
#[test_case(Rule::RaiseLiteral, Path::new("B016.py"))]
#[test_case(Rule::RaiseWithoutFromInsideExcept, Path::new("B904.py"))]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
B006_2.py:4:43: B006 [*] Do not use mutable data structures for argument defaults
B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument defaults
|
3 | def readLinkagesByLineFile(linkages_file,
4 | column_mapping={
| ___________________________________________^
5 | | }):
| |____________________________^ B006
6 | """
7 | """
2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
3 |
4 | def foobar(foor, bar={}):
| ^^ B006
5 | """
6 | """
|
= help: Replace with `None`; initialize within function

ℹ Possible fix
1 1 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
2 2 |
3 3 | def readLinkagesByLineFile(linkages_file,
4 |- column_mapping={
5 |- }):
4 |+ column_mapping=None):
6 5 | """
7 |- """
6 |+ """
7 |+ if column_mapping is None:
8 |+ column_mapping = {}
1 1 | # Docstring followed by whitespace with no newline
2 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
3 3 |
4 |-def foobar(foor, bar={}):
4 |+def foobar(foor, bar=None):
5 5 | """
6 |- """
6 |+ """
7 |+ if bar is None:
8 |+ bar = {}


0 comments on commit 5d52b0d

Please sign in to comment.