@@ -301,7 +301,7 @@ class FormatChecker(BaseTokenChecker):
301
301
)
302
302
303
303
def __init__ (self , linter = None ):
304
- super ().__init__ (linter )
304
+ super ().__init__ (linter , future_option_parsing = True )
305
305
self ._lines = None
306
306
self ._visited_lines = None
307
307
self ._bracket_stack = [None ]
@@ -498,7 +498,7 @@ def process_tokens(self, tokens):
498
498
handler (tokens , idx )
499
499
500
500
line_num -= 1 # to be ok with "wc -l"
501
- if line_num > self .config .max_module_lines :
501
+ if line_num > self .linter . namespace .max_module_lines :
502
502
# Get the line where the too-many-lines (or its message id)
503
503
# was disabled or default to 1.
504
504
message_definition = self .linter .msgs_store .get_message_definitions (
@@ -511,7 +511,7 @@ def process_tokens(self, tokens):
511
511
)
512
512
self .add_message (
513
513
"too-many-lines" ,
514
- args = (line_num , self .config .max_module_lines ),
514
+ args = (line_num , self .linter . namespace .max_module_lines ),
515
515
line = line ,
516
516
)
517
517
@@ -532,7 +532,7 @@ def _check_line_ending(self, line_ending, line_num):
532
532
self ._last_line_ending = line_ending
533
533
534
534
# check if line ending is as expected
535
- expected = self .config .expected_line_ending_format
535
+ expected = self .linter . namespace .expected_line_ending_format
536
536
if expected :
537
537
# reduce multiple \n\n\n\n to one \n
538
538
line_ending = reduce (lambda x , y : x + y if x != y else x , line_ending , "" )
@@ -601,13 +601,13 @@ def _check_multi_statement_line(self, node, line):
601
601
if (
602
602
isinstance (node .parent , nodes .If )
603
603
and not node .parent .orelse
604
- and self .config .single_line_if_stmt
604
+ and self .linter . namespace .single_line_if_stmt
605
605
):
606
606
return
607
607
if (
608
608
isinstance (node .parent , nodes .ClassDef )
609
609
and len (node .parent .body ) == 1
610
- and self .config .single_line_class_stmt
610
+ and self .linter . namespace .single_line_class_stmt
611
611
):
612
612
return
613
613
@@ -638,8 +638,8 @@ def check_line_ending(self, line: str, i: int) -> None:
638
638
639
639
def check_line_length (self , line : str , i : int , checker_off : bool ) -> None :
640
640
"""Check that the line length is less than the authorized value."""
641
- max_chars = self .config .max_line_length
642
- ignore_long_line = self .config .ignore_long_lines
641
+ max_chars = self .linter . namespace .max_line_length
642
+ ignore_long_line = self .linter . namespace .ignore_long_lines
643
643
line = line .rstrip ()
644
644
if len (line ) > max_chars and not ignore_long_line .search (line ):
645
645
if checker_off :
@@ -708,7 +708,7 @@ def check_lines(self, lines: str, lineno: int) -> None:
708
708
# we'll also handle the line ending check here to avoid double-iteration
709
709
# unless the line lengths are suspect
710
710
711
- max_chars = self .config .max_line_length
711
+ max_chars = self .linter . namespace .max_line_length
712
712
713
713
split_lines = self .specific_splitlines (lines )
714
714
@@ -745,7 +745,7 @@ def check_lines(self, lines: str, lineno: int) -> None:
745
745
746
746
def check_indent_level (self , string , expected , line_num ):
747
747
"""Return the indent level of the string."""
748
- indent = self .config .indent_string
748
+ indent = self .linter . namespace .indent_string
749
749
if indent == "\\ t" : # \t is not interpreted in the configuration file
750
750
indent = "\t "
751
751
level = 0
0 commit comments