File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -155,12 +155,13 @@ def should_warn(self, code):
155
155
return True
156
156
157
157
for i in range (2 , len (code ) + 1 ):
158
- if code [:i ] in self .options .select :
158
+ if self . options . select and code [:i ] in self .options .select :
159
159
return True
160
160
161
161
# flake8 >=4.0: Also check for codes in extend_select
162
162
if (
163
163
hasattr (self .options , "extend_select" )
164
+ and self .options .extend_select
164
165
and code [:i ] in self .options .extend_select
165
166
):
166
167
return True
Original file line number Diff line number Diff line change @@ -438,6 +438,16 @@ def test_b9_extend_select(self):
438
438
),
439
439
)
440
440
441
+ def test_b9_flake8_next_default_options (self ):
442
+ filename = Path (__file__ ).absolute ().parent / "b950.py"
443
+
444
+ # in flake8 next, unset select / extend_select will be `None` to
445
+ # signify the default values
446
+ mock_options = Namespace (select = None , extend_select = None )
447
+ bbc = BugBearChecker (filename = str (filename ), options = mock_options )
448
+ errors = list (bbc .run ())
449
+ self .assertEqual (errors , [])
450
+
441
451
def test_selfclean_bugbear (self ):
442
452
filename = Path (__file__ ).absolute ().parent .parent / "bugbear.py"
443
453
proc = subprocess .run (
You can’t perform that action at this time.
0 commit comments