3131 MSG_TYPES ,
3232 MSG_TYPES_LONG ,
3333 MSG_TYPES_STATUS ,
34+ WarningScope ,
3435)
3536from pylint .lint .base_options import _make_linter_options
3637from pylint .lint .caching import load_results , save_results
@@ -101,52 +102,61 @@ def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
101102
102103# Python Linter class #########################################################
103104
105+ # pylint: disable-next=consider-using-namedtuple-or-dataclass
104106MSGS : dict [str , MessageDefinitionTuple ] = {
105107 "F0001" : (
106108 "%s" ,
107109 "fatal" ,
108110 "Used when an error occurred preventing the analysis of a \
109111 module (unable to find it for instance)." ,
112+ {"scope" : WarningScope .LINE },
110113 ),
111114 "F0002" : (
112115 "%s: %s" ,
113116 "astroid-error" ,
114117 "Used when an unexpected error occurred while building the "
115118 "Astroid representation. This is usually accompanied by a "
116119 "traceback. Please report such errors !" ,
120+ {"scope" : WarningScope .LINE },
117121 ),
118122 "F0010" : (
119123 "error while code parsing: %s" ,
120124 "parse-error" ,
121125 "Used when an exception occurred while building the Astroid "
122126 "representation which could be handled by astroid." ,
127+ {"scope" : WarningScope .LINE },
123128 ),
124129 "F0011" : (
125130 "error while parsing the configuration: %s" ,
126131 "config-parse-error" ,
127132 "Used when an exception occurred while parsing a pylint configuration file." ,
133+ {"scope" : WarningScope .LINE },
128134 ),
129135 "I0001" : (
130136 "Unable to run raw checkers on built-in module %s" ,
131137 "raw-checker-failed" ,
132138 "Used to inform that a built-in module has not been checked "
133139 "using the raw checkers." ,
140+ {"scope" : WarningScope .LINE },
134141 ),
135142 "I0010" : (
136143 "Unable to consider inline option %r" ,
137144 "bad-inline-option" ,
138145 "Used when an inline option is either badly formatted or can't "
139146 "be used inside modules." ,
147+ {"scope" : WarningScope .LINE },
140148 ),
141149 "I0011" : (
142150 "Locally disabling %s (%s)" ,
143151 "locally-disabled" ,
144152 "Used when an inline option disables a message or a messages category." ,
153+ {"scope" : WarningScope .LINE },
145154 ),
146155 "I0013" : (
147156 "Ignoring entire file" ,
148157 "file-ignored" ,
149158 "Used to inform that the file will not be checked" ,
159+ {"scope" : WarningScope .LINE },
150160 ),
151161 "I0020" : (
152162 "Suppressed %s (from line %d)" ,
@@ -155,46 +165,61 @@ def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
155165 "by a disable= comment in the file. This message is not "
156166 "generated for messages that are ignored due to configuration "
157167 "settings." ,
168+ {"scope" : WarningScope .LINE },
158169 ),
159170 "I0021" : (
160171 "Useless suppression of %s" ,
161172 "useless-suppression" ,
162173 "Reported when a message is explicitly disabled for a line or "
163174 "a block of code, but never triggered." ,
175+ {"scope" : WarningScope .LINE },
164176 ),
165177 "I0022" : (
166178 'Pragma "%s" is deprecated, use "%s" instead' ,
167179 "deprecated-pragma" ,
168180 "Some inline pylint options have been renamed or reworked, "
169181 "only the most recent form should be used. "
170182 "NOTE:skip-all is only available with pylint >= 0.26" ,
171- {"old_names" : [("I0014" , "deprecated-disable-all" )]},
183+ {
184+ "old_names" : [("I0014" , "deprecated-disable-all" )],
185+ "scope" : WarningScope .LINE ,
186+ },
187+ ),
188+ "E0001" : (
189+ "%s" ,
190+ "syntax-error" ,
191+ "Used when a syntax error is raised for a module." ,
192+ {"scope" : WarningScope .LINE },
172193 ),
173- "E0001" : ("%s" , "syntax-error" , "Used when a syntax error is raised for a module." ),
174194 "E0011" : (
175195 "Unrecognized file option %r" ,
176196 "unrecognized-inline-option" ,
177197 "Used when an unknown inline option is encountered." ,
198+ {"scope" : WarningScope .LINE },
178199 ),
179200 "E0012" : (
180201 "Bad option value for %s" ,
181202 "bad-option-value" ,
182203 "Used when a bad value for an inline option is encountered." ,
204+ {"scope" : WarningScope .LINE },
183205 ),
184206 "E0013" : (
185207 "Plugin '%s' is impossible to load, is it installed ? ('%s')" ,
186208 "bad-plugin-value" ,
187209 "Used when a bad value is used in 'load-plugins'." ,
210+ {"scope" : WarningScope .LINE },
188211 ),
189212 "E0014" : (
190213 "Out-of-place setting encountered in top level configuration-section '%s' : '%s'" ,
191214 "bad-configuration-section" ,
192215 "Used when we detect a setting in the top level of a toml configuration that shouldn't be there." ,
216+ {"scope" : WarningScope .LINE },
193217 ),
194218 "E0015" : (
195219 "Unrecognized option found: %s" ,
196220 "unrecognized-option" ,
197221 "Used when we detect an option that we do not recognize." ,
222+ {"scope" : WarningScope .LINE },
198223 ),
199224}
200225
0 commit comments