on master help sign in
boilerplate: add pylint / WIP: balance linting with pylint

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit796197db2d135fe3342e4355aeb57a74dfa6beca authorMarkus Heiser <markus.heiser@darmarit.de> dateThu 28 Nov 2019, 20:07 (7 years ago) parent7e572a2
2 files changed+447−1
.pylintrc+444 Makefile+3−1
.pylintrcnew file+444
@@ -0,0 +1,444 @@
1+# -*- coding: utf-8; mode: conf -*-
2+# lint Python modules using external checkers.
3+#
4+# This is the main checker controlling the other ones and the reports
5+# generation. It is itself both a raw checker and an astng checker in order
6+# to:
7+# * handle message activation / deactivation at the module level
8+# * handle some basic but necessary stats'data (number of classes, methods...)
9+#
10+[MASTER]
11+
12+# A comma-separated list of package or module names from where C extensions may
13+# be loaded. Extensions are loading into the active Python interpreter and may
14+# run arbitrary code
15+extension-pkg-whitelist=
16+
17+# Add files or directories to the blacklist. They should be base names, not
18+# paths.
19+ignore=CVS, .git, .svn
20+
21+# Add files or directories matching the regex patterns to the blacklist. The
22+# regex matches against base names, not paths.
23+ignore-patterns=
24+
25+# Python code to execute, usually for sys.path manipulation such as
26+# pygtk.require().
27+#init-hook=
28+
29+# Use multiple processes to speed up Pylint.
30+jobs=1
31+
32+# List of plugins (as comma separated values of python modules names) to load,
33+# usually to register additional checkers.
34+load-plugins=
35+
36+# Pickle collected data for later comparisons.
37+persistent=yes
38+
39+# Specify a configuration file.
40+#rcfile=
41+
42+# Allow loading of arbitrary C extensions. Extensions are imported into the
43+# active Python interpreter and may run arbitrary code.
44+unsafe-load-any-extension=no
45+
46+
47+[MESSAGES CONTROL]
48+
49+# Only show warnings with the listed confidence levels. Leave empty to show
50+# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
51+confidence=
52+
53+# Disable the message, report, category or checker with the given id(s). You
54+# can either give multiple identifiers separated by comma (,) or put this
55+# option multiple times (only on the command line, not in the configuration
56+# file where it should appear only once).You can also use "--disable=all" to
57+# disable everything first and then reenable specific checks. For example, if
58+# you want to run only the similarities checker, you can use "--disable=all
59+# --enable=similarities". If you want to run only the classes checker, but have
60+# no Warning level messages displayed, use"--disable=all --enable=classes
61+# --disable=W"
62+disable=bad-whitespace, duplicate-code
63+
64+# Enable the message, report, category or checker with the given id(s). You can
65+# either give multiple identifier separated by comma (,) or put this option
66+# multiple time (only on the command line, not in the configuration file where
67+# it should appear only once). See also the "--disable" option for examples.
68+enable=
69+
70+
71+[REPORTS]
72+
73+# Python expression which should return a note less than 10 (10 is the highest
74+# note). You have access to the variables errors warning, statement which
75+# respectively contain the number of errors / warnings messages and the total
76+# number of statements analyzed. This is used by the global evaluation report
77+# (RP0004).
78+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
79+
80+# Template used to display messages. This is a python new-style format string
81+# used to format the message information. See doc for all details
82+
83+# HINT: do not set this here, use argument --msg-template=...
84+#msg-template={path}:{line}: [{msg_id}({symbol}),{obj}] {msg}
85+
86+# Set the output format. Available formats are text, parseable, colorized, json
87+# and msvs (visual studio).You can also give a reporter class, eg
88+# mypackage.mymodule.MyReporterClass.
89+
90+# HINT: do not set this here, use argument --output-format=...
91+#output-format=text
92+
93+# Tells whether to display a full report or only the messages
94+reports=no
95+
96+# Activate the evaluation score.
97+score=yes
98+
99+
100+[REFACTORING]
101+
102+# Maximum number of nested blocks for function / method body
103+max-nested-blocks=5
104+
105+
106+[BASIC]
107+
108+# List of builtins function names that should not be used, separated by a comma
109+bad-functions=map,filter,apply,input
110+
111+# Naming hint for argument names
112+argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
113+
114+# Regular expression matching correct argument names
115+argument-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
116+
117+# Naming hint for attribute names
118+attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
119+
120+# Regular expression matching correct attribute names
121+attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*)|([A-Z0-9_]*))$
122+
123+# Bad variable names which should always be refused, separated by a comma
124+bad-names=foo,bar,baz,toto,tutu,tata
125+
126+# Naming hint for class attribute names
127+class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
128+
129+# Regular expression matching correct class attribute names
130+class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
131+
132+# Naming hint for class names
133+class-name-hint=[A-Z_][a-zA-Z0-9]+$
134+
135+# Regular expression matching correct class names
136+class-rgx=[A-Z_][a-zA-Z0-9]+$
137+
138+# Naming hint for constant names
139+const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
140+
141+# Regular expression matching correct constant names
142+const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
143+#const-rgx=[f]?[A-Z_][a-zA-Z0-9_]{2,30}$
144+
145+# Minimum line length for functions/classes that require docstrings, shorter
146+# ones are exempt.
147+docstring-min-length=-1
148+
149+# Naming hint for function names
150+function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
151+
152+# Regular expression matching correct function names
153+function-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
154+
155+# Good variable names which should always be accepted, separated by a comma
156+good-names=i,j,k,ex,Run,_,log,cfg,id
157+
158+# Include a hint for the correct naming format with invalid-name
159+include-naming-hint=no
160+
161+# Naming hint for inline iteration names
162+inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
163+
164+# Regular expression matching correct inline iteration names
165+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
166+
167+# Naming hint for method names
168+method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
169+
170+# Regular expression matching correct method names
171+method-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
172+
173+# Naming hint for module names
174+module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
175+
176+# Regular expression matching correct module names
177+#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
178+module-rgx=([a-z_][a-z0-9_]*)$
179+
180+# Colon-delimited sets of names that determine each other's naming style when
181+# the name regexes allow several styles.
182+name-group=
183+
184+# Regular expression which should only match function or class names that do
185+# not require a docstring.
186+no-docstring-rgx=^_
187+
188+# List of decorators that produce properties, such as abc.abstractproperty. Add
189+# to this list to register other decorators that produce valid properties.
190+property-classes=abc.abstractproperty
191+
192+# Naming hint for variable names
193+variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
194+
195+# Regular expression matching correct variable names
196+variable-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*)|([a-z]))$
197+
198+
199+[FORMAT]
200+
201+# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
202+expected-line-ending-format=
203+
204+# Regexp for a line that is allowed to be longer than the limit.
205+ignore-long-lines=^\s*(# )?<?https?://\S+>?$
206+
207+# Number of spaces of indent required inside a hanging or continued line.
208+indent-after-paren=4
209+
210+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
211+# tab).
212+indent-string=' '
213+
214+# Maximum number of characters on a single line.
215+max-line-length=120
216+
217+# Maximum number of lines in a module
218+max-module-lines=2000
219+
220+# List of optional constructs for which whitespace checking is disabled. `dict-
221+# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
222+# `trailing-comma` allows a space between comma and closing bracket: (a, ).
223+# `empty-line` allows space-only lines.
224+no-space-check=trailing-comma,dict-separator
225+
226+# Allow the body of a class to be on the same line as the declaration if body
227+# contains single statement.No config file found, using default configuration
228+
229+single-line-class-stmt=no
230+
231+# Allow the body of an if to be on the same line as the test if there is no
232+# else.
233+single-line-if-stmt=no
234+
235+
236+[LOGGING]
237+
238+# Logging modules to check that the string format arguments are in logging
239+# function parameter format
240+logging-modules=logging
241+
242+
243+[MISCELLANEOUS]
244+
245+# List of note tags to take in consideration, separated by a comma.
246+notes=FIXME,XXX,TODO
247+
248+
249+[SIMILARITIES]
250+
251+# Ignore comments when computing similarities.
252+ignore-comments=yes
253+
254+# Ignore docstrings when computing similarities.
255+ignore-docstrings=yes
256+
257+# Ignore imports when computing similarities.
258+ignore-imports=no
259+
260+# Minimum lines number of a similarity.
261+min-similarity-lines=4
262+
263+
264+[SPELLING]
265+
266+# Spelling dictionary name. Available dictionaries: none. To make it working
267+# install python-enchant package.
268+spelling-dict=
269+
270+# List of comma separated words that should not be checked.
271+spelling-ignore-words=
272+
273+# A path to a file that contains private dictionary; one word per line.
274+spelling-private-dict-file=
275+
276+# Tells whether to store unknown words to indicated private dictionary in
277+# --spelling-private-dict-file option instead of raising a message.
278+spelling-store-unknown-words=no
279+
280+
281+[TYPECHECK]
282+
283+# List of decorators that produce context managers, such as
284+# contextlib.contextmanager. Add to this list to register other decorators that
285+# produce valid context managers.
286+contextmanager-decorators=contextlib.contextmanager
287+
288+# List of members which are set dynamically and missed by pylint inference
289+# system, and so shouldn't trigger E1101 when accessed. Python regular
290+# expressions are accepted.
291+generated-members=
292+
293+# Tells whether missing members accessed in mixin class should be ignored. A
294+# mixin class is detected if its name ends with "mixin" (case insensitive).
295+ignore-mixin-members=yes
296+
297+# This flag controls whether pylint should warn about no-member and similar
298+# checks whenever an opaque object is returned when inferring. The inference
299+# can return multiple potential results while evaluating a Python object, but
300+# some branches might not be evaluated, which results in partial inference. In
301+# that case, it might be useful to still emit no-member and other checks for
302+# the rest of the inferred objects.
303+ignore-on-opaque-inference=yes
304+
305+# List of class names for which member attributes should not be checked (useful
306+# for classes with dynamically set attributes). This supports the use of
307+# qualified names.
308+ignored-classes=optparse.Values,thread._local,_thread._local
309+
310+# List of module names for which member attributes should not be checked
311+# (useful for modules/projects where namespaces are manipulated during runtime
312+# and thus existing member attributes cannot be deduced by static analysis. It
313+# supports qualified module names, as well as Unix pattern matching.
314+ignored-modules=
315+
316+# Show a hint with possible names when a member name was not found. The aspect
317+# of finding the hint is based on edit distance.
318+missing-member-hint=yes
319+
320+# The minimum edit distance a name should have in order to be considered a
321+# similar match for a missing member name.
322+missing-member-hint-distance=1
323+
324+# The total number of similar names that should be taken in consideration when
325+# showing a hint for a missing member.
326+missing-member-max-choices=1
327+
328+
329+[VARIABLES]
330+
331+# List of additional names supposed to be defined in builtins. Remember that
332+# you should avoid to define new builtins when possible.
333+additional-builtins=
334+
335+# Tells whether unused global variables should be treated as a violation.
336+allow-global-unused-variables=yes
337+
338+# List of strings which can identify a callback function by name. A callback
339+# name must start or end with one of those strings.
340+callbacks=cb_,_cb
341+
342+# A regular expression matching the name of dummy variables (i.e. expectedly
343+# not used).
344+dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
345+
346+# Argument names that match this expression will be ignored. Default to name
347+# with leading underscore
348+ignored-argument-names=_.*|^ignored_|^unused_
349+
350+# Tells whether we should check for unused import in __init__ files.
351+init-import=no
352+
353+# List of qualified module names which can have objects that can redefine
354+# builtins.
355+redefining-builtins-modules=six.moves,future.builtins
356+
357+
358+[CLASSES]
359+
360+# List of method names used to declare (i.e. assign) instance attributes.
361+defining-attr-methods=__init__,__new__,setUp
362+
363+# List of member names, which should be excluded from the protected access
364+# warning.
365+exclude-protected=_asdict,_fields,_replace,_source,_make
366+
367+# List of valid names for the first argument in a class method.
368+valid-classmethod-first-arg=cls
369+
370+# List of valid names for the first argument in a metaclass class method.
371+valid-metaclass-classmethod-first-arg=mcs
372+
373+
374+[DESIGN]
375+
376+# Maximum number of arguments for function / method
377+max-args=8
378+
379+# Maximum number of attributes for a class (see R0902).
380+max-attributes=20
381+
382+# Maximum number of boolean expressions in a if statement
383+max-bool-expr=5
384+
385+# Maximum number of branch for function / method body
386+max-branches=12
387+
388+# Maximum number of locals for function / method body
389+max-locals=20
390+
391+# Maximum number of parents for a class (see R0901).
392+max-parents=7
393+
394+# Maximum number of public methods for a class (see R0904).
395+max-public-methods=20
396+
397+# Maximum number of return / yield for function / method body
398+max-returns=6
399+
400+# Maximum number of statements in function / method body
401+max-statements=50
402+
403+# Minimum number of public methods for a class (see R0903).
404+min-public-methods=2
405+
406+
407+[IMPORTS]
408+
409+# Allow wildcard imports from modules that define __all__.
410+allow-wildcard-with-all=no
411+
412+# Analyse import fallback blocks. This can be used to support both Python 2 and
413+# 3 compatible code, which means that the block might have code that exists
414+# only in one or another interpreter, leading to false positives when analysed.
415+analyse-fallback-blocks=no
416+
417+# Deprecated modules which should not be used, separated by a comma
418+deprecated-modules=optparse,tkinter.tix
419+
420+# Create a graph of external dependencies in the given file (report RP0402 must
421+# not be disabled)
422+ext-import-graph=
423+
424+# Create a graph of every (i.e. internal and external) dependencies in the
425+# given file (report RP0402 must not be disabled)
426+import-graph=
427+
428+# Create a graph of internal dependencies in the given file (report RP0402 must
429+# not be disabled)
430+int-import-graph=
431+
432+# Force import order to recognize a module as part of the standard
433+# compatibility libraries.
434+known-standard-library=
435+
436+# Force import order to recognize a module as part of a third party library.
437+known-third-party=enchant
438+
439+
440+[EXCEPTIONS]
441+
442+# Exceptions that will emit a warning when being caught. Defaults to
443+# "Exception"
444+overgeneral-exceptions=Exception
Makefile+3−1
@@ -43,9 +43,11 @@ run: pyenvinstall
4343# test
4444# ----
4545
46−PHONY += test test.pep8 test.unit test.robot
46+PHONY += test test.pylint test.pep8 test.unit test.robot
4747
48+# TODO: balance linting with pylint
4849test: test.pep8 test.unit test.robot
50+ - make pylint
4951
5052test.pep8: pyenvinstall
5153 $(PY_ENV_ACT); ./manage.sh pep8_check