File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 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):
155155 return True
156156
157157 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 :
159159 return True
160160
161161 # flake8 >=4.0: Also check for codes in extend_select
162162 if (
163163 hasattr (self .options , "extend_select" )
164+ and self .options .extend_select
164165 and code [:i ] in self .options .extend_select
165166 ):
166167 return True
Original file line number Diff line number Diff line change @@ -438,6 +438,16 @@ def test_b9_extend_select(self):
438438 ),
439439 )
440440
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+
441451 def test_selfclean_bugbear (self ):
442452 filename = Path (__file__ ).absolute ().parent .parent / "bugbear.py"
443453 proc = subprocess .run (
You can’t perform that action at this time.
0 commit comments