Method: pylint.lint.base_options._make_linter_options
Calls: 1488, Exceptions: 0, Paths: 1Back
Path 1: 1488 calls (1.0)
PyLinter (1248) UnittestLinter (238) _CustomPyLinter (2)
tuple (1488)
1def _make_linter_options(linter: PyLinter) -> Options:
2 """Return the options used in a PyLinter class."""
3 return (
4 (
5 "ignore",
6 {
7 "type": "csv",
8 "metavar": "<file>[,<file>...]",
9 "dest": "black_list",
10 "kwargs": {"old_names": ["black_list"]},
11 "default": constants.DEFAULT_IGNORE_LIST,
12 "help": "Files or directories to be skipped. "
13 "They should be base names, not paths.",
14 },
15 ),
16 (
17 "ignore-patterns",
18 {
19 "type": "regexp_csv",
20 "metavar": "<pattern>[,<pattern>...]",
21 "dest": "black_list_re",
22 "default": (re.compile(r"^\.#"),),
23 "help": "Files or directories matching the regular expression patterns are"
24 " skipped. The regex matches against base names, not paths. The default value "
25 "ignores Emacs file locks",
26 },
27 ),
28 (
29 "ignore-paths",
30 {
31 "type": "regexp_paths_csv",
32 "metavar": "<pattern>[,<pattern>...]",
33 "default": [],
34 "help": "Add files or directories matching the regular expressions patterns to the "
35 "ignore-list. The regex matches against paths and can be in "
36 "Posix or Windows format. Because '\\\\' represents the directory delimiter "
37 "on Windows systems, it can't be used as an escape character.",
38 },
39 ),
40 (
41 "persistent",
42 {
43 "default": True,
44 "type": "yn",
45 "metavar": "<y or n>",
46 "help": "Pickle collected data for later comparisons.",
47 },
48 ),
49 (
50 "load-plugins",
51 {
52 "type": "csv",
53 "metavar": "<modules>",
54 "default": (),
55 "help": "List of plugins (as comma separated values of "
56 "python module names) to load, usually to register "
57 "additional checkers.",
58 },
59 ),
60 (
61 "output-format",
62 {
63 "default": "text",
64 "action": _OutputFormatAction,
65 "callback": lambda x: x,
66 "metavar": "<format>",
67 "short": "f",
68 "group": "Reports",
69 "help": "Set the output format. Available formats are text,"
70 " parseable, colorized, json and msvs (visual studio)."
71 " You can also give a reporter class, e.g. mypackage.mymodule."
72 "MyReporterClass.",
73 "kwargs": {"linter": linter},
74 },
75 ),
76 (
77 "reports",
78 {
79 "default": False,
80 "type": "yn",
81 "metavar": "<y or n>",
82 "short": "r",
83 "group": "Reports",
84 "help": "Tells whether to display a full report or only the "
85 "messages.",
86 },
87 ),
88 (
89 "evaluation",
90 {
91 "type": "string",
92 "metavar": "<python_expression>",
93 "group": "Reports",
94 "default": "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + "
95 "convention) / statement) * 10))",
96 "help": "Python expression which should return a score less "
97 "than or equal to 10. You have access to the variables 'fatal', "
98 "'error', 'warning', 'refactor', 'convention', and 'info' which "
99 "contain the number of messages in each category, as well as "
100 "'statement' which is the total number of statements "
101 "analyzed. This score is used by the global "
102 "evaluation report (RP0004).",
103 },
104 ),
105 (
106 "score",
107 {
108 "default": True,
109 "type": "yn",
110 "metavar": "<y or n>",
111 "short": "s",
112 "group": "Reports",
113 "help": "Activate the evaluation score.",
114 },
115 ),
116 (
117 "fail-under",
118 {
119 "default": 10,
120 "type": "float",
121 "metavar": "<score>",
122 "help": "Specify a score threshold under which the program will exit with error.",
123 },
124 ),
125 (
126 "fail-on",
127 {
128 "default": "",
129 "type": "csv",
130 "metavar": "<msg ids>",
131 "help": "Return non-zero exit code if any of these messages/categories are detected,"
132 " even if score is above --fail-under value. Syntax same as enable."
133 " Messages specified are enabled, while categories only check already-enabled messages.",
134 },
135 ),
136 (
137 "confidence",
138 {
139 "type": "confidence",
140 "metavar": "<levels>",
141 "default": interfaces.CONFIDENCE_LEVEL_NAMES,
142 "group": "Messages control",
143 "help": "Only show warnings with the listed confidence levels."
144 f" Leave empty to show all. Valid levels: {', '.join(interfaces.CONFIDENCE_LEVEL_NAMES)}.",
145 },
146 ),
147 (
148 "enable",
149 {
150 "action": _EnableAction,
151 "callback": lambda x1, x2, x3, x4: x1,
152 "default": (),
153 "metavar": "<msg ids>",
154 "short": "e",
155 "group": "Messages control",
156 "help": "Enable the message, report, category or checker with the "
157 "given id(s). You can either give multiple identifier "
158 "separated by comma (,) or put this option multiple time "
159 "(only on the command line, not in the configuration file "
160 "where it should appear only once). "
161 'See also the "--disable" option for examples.',
162 "kwargs": {"linter": linter},
163 },
164 ),
165 (
166 "disable",
167 {
168 "action": _DisableAction,
169 "callback": lambda x1, x2, x3, x4: x1,
170 "metavar": "<msg ids>",
171 "default": (),
172 "short": "d",
173 "group": "Messages control",
174 "help": "Disable the message, report, category or checker "
175 "with the given id(s). You can either give multiple identifiers "
176 "separated by comma (,) or put this option multiple times "
177 "(only on the command line, not in the configuration file "
178 "where it should appear only once). "
179 'You can also use "--disable=all" to disable everything first '
180 "and then re-enable specific checks. For example, if you want "
181 "to run only the similarities checker, you can use "
182 '"--disable=all --enable=similarities". '
183 "If you want to run only the classes checker, but have no "
184 "Warning level messages displayed, use "
185 '"--disable=all --enable=classes --disable=W".',
186 "kwargs": {"linter": linter},
187 },
188 ),
189 (
190 "msg-template",
191 {
192 "type": "string",
193 "default": "",
194 "metavar": "<template>",
195 "group": "Reports",
196 "help": (
197 "Template used to display messages. "
198 "This is a python new-style format string "
199 "used to format the message information. "
200 "See doc for all details."
201 ),
202 },
203 ),
204 (
205 "jobs",
206 {
207 "type": "int",
208 "metavar": "<n-processes>",
209 "short": "j",
210 "default": 1,
211 "help": "Use multiple processes to speed up Pylint. Specifying 0 will "
212 "auto-detect the number of processors available to use, and will cap "
213 "the count on Windows to avoid hangs.",
214 },
215 ),
216 (
217 "unsafe-load-any-extension",
218 {
219 "type": "yn",
220 "metavar": "<y or n>",
221 "default": False,
222 "hide": True,
223 "help": (
224 "Allow loading of arbitrary C extensions. Extensions"
225 " are imported into the active Python interpreter and"
226 " may run arbitrary code."
227 ),
228 },
229 ),
230 (
231 "limit-inference-results",
232 {
233 "type": "int",
234 "metavar": "<number-of-results>",
235 "default": 100,
236 "help": (
237 "Control the amount of potential inferred values when inferring "
238 "a single object. This can help the performance when dealing with "
239 "large functions or complex, nested conditions."
240 ),
241 },
242 ),
243 (
244 "extension-pkg-allow-list",
245 {
246 "type": "csv",
247 "metavar": "<pkg[,pkg]>",
248 "default": [],
249 "help": (
250 "A comma-separated list of package or module names"
251 " from where C extensions may be loaded. Extensions are"
252 " loading into the active Python interpreter and may run"
253 " arbitrary code."
254 ),
255 },
256 ),
257 (
258 "extension-pkg-whitelist",
259 {
260 "type": "csv",
261 "metavar": "<pkg[,pkg]>",
262 "default": [],
263 "help": (
264 "A comma-separated list of package or module names"
265 " from where C extensions may be loaded. Extensions are"
266 " loading into the active Python interpreter and may run"
267 " arbitrary code. (This is an alternative name to"
268 " extension-pkg-allow-list for backward compatibility.)"
269 ),
270 },
271 ),
272 (
273 "suggestion-mode",
274 {
275 "type": "yn",
276 "metavar": "<y or n>",
277 "default": True,
278 "help": (
279 "When enabled, pylint would attempt to guess common "
280 "misconfiguration and emit user-friendly hints instead "
281 "of false-positive error messages."
282 ),
283 },
284 ),
285 (
286 "exit-zero",
287 {
288 "action": "store_true",
289 "default": False,
290 "metavar": "<flag>",
291 "help": (
292 "Always return a 0 (non-error) status code, even if "
293 "lint errors are found. This is primarily useful in "
294 "continuous integration scripts."
295 ),
296 },
297 ),
298 (
299 "from-stdin",
300 {
301 "action": "store_true",
302 "default": False,
303 "metavar": "<flag>",
304 "help": (
305 "Interpret the stdin as a python script, whose filename "
306 "needs to be passed as the module_or_package argument."
307 ),
308 },
309 ),
310 (
311 "recursive",
312 {
313 "type": "yn",
314 "metavar": "<yn>",
315 "default": False,
316 "help": "Discover python modules and packages in the file system subtree.",
317 },
318 ),
319 (
320 "py-version",
321 {
322 "default": sys.version_info[:2],
323 "type": "py_version",
324 "metavar": "<py_version>",
325 "help": (
326 "Minimum Python version to use for version dependent checks. "
327 "Will default to the version used to run pylint."
328 ),
329 },
330 ),
331 (
332 "ignored-modules",
333 {
334 "default": (),
335 "type": "csv",
336 "metavar": "<module names>",
337 "help": "List of module names for which member attributes "
338 "should not be checked (useful for modules/projects "
339 "where namespaces are manipulated during runtime and "
340 "thus existing member attributes cannot be "
341 "deduced by static analysis). It supports qualified "
342 "module names, as well as Unix pattern matching.",
343 },
344 ),
345 (
346 "analyse-fallback-blocks",
347 {
348 "default": False,
349 "type": "yn",
350 "metavar": "<y or n>",
351 "help": "Analyse import fallback blocks. This can be used to "
352 "support both Python 2 and 3 compatible code, which "
353 "means that the block might have code that exists "
354 "only in one or another interpreter, leading to false "
355 "positives when analysed.",
356 },
357 ),
358 (
359 "clear-cache-post-run",
360 {
361 "default": False,
362 "type": "yn",
363 "metavar": "<y or n>",
364 "help": "Clear in-memory caches upon conclusion of linting. "
365 "Useful if running pylint in a server-like mode.",
366 },
367 ),
368 )