21
21
Optional ,
22
22
Sequence ,
23
23
Set ,
24
+ Tuple ,
24
25
Type ,
25
26
Union ,
26
27
)
72
73
else :
73
74
from typing_extensions import Literal
74
75
76
+ OptionDict = Dict [str , Union [str , bool , int , Iterable [Union [str , int ]]]]
77
+
75
78
MANAGER = astroid .MANAGER
76
79
77
80
@@ -216,7 +219,7 @@ class PyLinter(
216
219
crash_file_path : str = "pylint-crash-%Y-%m-%d-%H.txt"
217
220
218
221
@staticmethod
219
- def make_options ():
222
+ def make_options () -> Tuple [ Tuple [ str , OptionDict ], ...] :
220
223
return (
221
224
(
222
225
"ignore" ,
@@ -526,7 +529,7 @@ def make_options():
526
529
),
527
530
)
528
531
529
- option_groups = (
532
+ base_option_groups = (
530
533
("Messages control" , "Options controlling analysis messages" ),
531
534
("Reports" , "Options related to output formatting and reporting" ),
532
535
)
@@ -557,21 +560,26 @@ def __init__(
557
560
self ._dynamic_plugins : Set [str ] = set ()
558
561
"""Set of loaded plugin names"""
559
562
560
- self .msgs_store = MessageDefinitionStore ()
561
- self ._pragma_lineno = {}
562
-
563
563
# Attributes related to visiting files
564
564
self .file_state = FileState ()
565
565
self .current_name : Optional [str ] = None
566
566
self .current_file : Optional [str ] = None
567
567
self ._ignore_file = False
568
+ self ._pragma_lineno : Dict [str , int ] = {}
568
569
570
+ # Attributes related to stats
569
571
self .stats = LinterStats ()
570
- self .fail_on_symbols = []
571
- # init options
572
- self ._external_opts = options
573
- self .options = options + PyLinter .make_options ()
574
- self .option_groups = option_groups + PyLinter .option_groups
572
+
573
+ # Attributes related to (command-line) options and their parsing
574
+ # pylint: disable-next=fixme
575
+ # TODO: Make these implicitly typing when typing for __init__ parameter is added
576
+ self ._external_opts : Tuple [Tuple [str , OptionDict ], ...] = options
577
+ self .options : Tuple [Tuple [str , OptionDict ], ...] = (
578
+ options + PyLinter .make_options ()
579
+ )
580
+ self .option_groups : Tuple [Tuple [str , str ], ...] = (
581
+ option_groups + PyLinter .base_option_groups
582
+ )
575
583
self ._options_methods = {
576
584
"enable" : self .enable ,
577
585
"disable" : self .disable ,
@@ -581,8 +589,12 @@ def __init__(
581
589
"disable-msg" : self ._options_methods ["disable" ],
582
590
"enable-msg" : self ._options_methods ["enable" ],
583
591
}
592
+ self .fail_on_symbols : List [str ] = []
593
+ """List of message symbols on which pylint should fail, set by --fail-on"""
594
+ self ._error_mode = False
584
595
585
- # Attributes related to message (state) handling
596
+ # Attributes related to messages (states) and their handling
597
+ self .msgs_store = MessageDefinitionStore ()
586
598
self .msg_status = 0
587
599
self ._msgs_state : Dict [str , bool ] = {}
588
600
self ._by_id_managed_msgs : List [ManagedMessage ] = []
@@ -604,7 +616,6 @@ def __init__(
604
616
("RP0003" , "Messages" , report_messages_stats ),
605
617
)
606
618
self .register_checker (self )
607
- self ._error_mode = False
608
619
self .load_provider_defaults ()
609
620
610
621
def load_default_plugins (self ):
0 commit comments