Skip to content

Commit 010efed

Browse files
committed
fix: python linting
1 parent 6419d45 commit 010efed

3 files changed

Lines changed: 311 additions & 0 deletions

File tree

pylintrc

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
[MASTER]
2+
3+
# Specify a configuration file.
4+
#rcfile=
5+
6+
# Python code to execute, usually for sys.path manipulation such as
7+
# pygtk.require().
8+
#init-hook=
9+
10+
# Profiled execution.
11+
profile=no
12+
13+
# Add files or directories to the blacklist. They should be base names, not
14+
# paths.
15+
ignore=CVS
16+
17+
# Pickle collected data for later comparisons.
18+
persistent=yes
19+
20+
# List of plugins (as comma separated values of python modules names) to load,
21+
# usually to register additional checkers.
22+
load-plugins=
23+
24+
25+
[MESSAGES CONTROL]
26+
27+
# Enable the message, report, category or checker with the given id(s). You can
28+
# either give multiple identifier separated by comma (,) or put this option
29+
# multiple time. See also the "--disable" option for examples.
30+
#enable=
31+
32+
# Disable the message, report, category or checker with the given id(s). You
33+
# can either give multiple identifiers separated by comma (,) or put this
34+
# option multiple times (only on the command line, not in the configuration
35+
# file where it should appear only once).You can also use "--disable=all" to
36+
# disable everything first and then reenable specific checks. For example, if
37+
# you want to run only the similarities checker, you can use "--disable=all
38+
# --enable=similarities". If you want to run only the classes checker, but have
39+
# no Warning level messages displayed, use"--disable=all --enable=classes
40+
# --disable=W"
41+
# see http://stackoverflow.com/questions/21487025/pylint-locally-defined-disables-still-give-warnings-how-to-suppress-them
42+
disable=locally-disabled,C0103
43+
44+
45+
[REPORTS]
46+
47+
# Set the output format. Available formats are text, parseable, colorized, msvs
48+
# (visual studio) and html. You can also give a reporter class, eg
49+
# mypackage.mymodule.MyReporterClass.
50+
output-format=text
51+
52+
# Put messages in a separate file for each module / package specified on the
53+
# command line instead of printing them on stdout. Reports (if any) will be
54+
# written in a file name "pylint_global.[txt|html]".
55+
files-output=no
56+
57+
# Tells whether to display a full report or only the messages
58+
reports=yes
59+
60+
# Python expression which should return a note less than 10 (10 is the highest
61+
# note). You have access to the variables errors warning, statement which
62+
# respectively contain the number of errors / warnings messages and the total
63+
# number of statements analyzed. This is used by the global evaluation report
64+
# (RP0004).
65+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
66+
67+
# Add a comment according to your evaluation note. This is used by the global
68+
# evaluation report (RP0004).
69+
comment=no
70+
71+
# Template used to display messages. This is a python new-style format string
72+
# used to format the message information. See doc for all details
73+
#msg-template=
74+
75+
76+
[BASIC]
77+
78+
# Required attributes for module, separated by a comma
79+
required-attributes=
80+
81+
# List of builtins function names that should not be used, separated by a comma
82+
bad-functions=map,filter,apply,input
83+
84+
# Regular expression which should only match correct module names
85+
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
86+
87+
# Regular expression which should only match correct module level names
88+
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
89+
90+
# Regular expression which should only match correct class names
91+
class-rgx=[A-Z_][a-zA-Z0-9]+$
92+
93+
# Regular expression which should only match correct function names
94+
function-rgx=[a-z_][a-z0-9_]{2,30}$
95+
96+
# Regular expression which should only match correct method names
97+
method-rgx=[a-z_][a-z0-9_]{2,30}$
98+
99+
# Regular expression which should only match correct instance attribute names
100+
attr-rgx=[a-z_][a-z0-9_]{2,30}$
101+
102+
# Regular expression which should only match correct argument names
103+
argument-rgx=[a-z_][a-z0-9_]{2,30}$
104+
105+
# Regular expression which should only match correct variable names
106+
variable-rgx=[a-z_][a-z0-9_]{2,30}$
107+
108+
# Regular expression which should only match correct attribute names in class
109+
# bodies
110+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
111+
112+
# Regular expression which should only match correct list comprehension /
113+
# generator expression variable names
114+
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
115+
116+
# Good variable names which should always be accepted, separated by a comma
117+
good-names=i,j,k,ex,Run,_
118+
119+
# Bad variable names which should always be refused, separated by a comma
120+
bad-names=foo,bar,baz,toto,tutu,tata
121+
122+
# Regular expression which should only match function or class names that do
123+
# not require a docstring.
124+
no-docstring-rgx=__.*__
125+
126+
# Minimum line length for functions/classes that require docstrings, shorter
127+
# ones are exempt.
128+
docstring-min-length=-1
129+
130+
131+
[MISCELLANEOUS]
132+
133+
# List of note tags to take in consideration, separated by a comma.
134+
notes=FIXME,XXX,TODO
135+
136+
137+
[TYPECHECK]
138+
139+
# Tells whether missing members accessed in mixin class should be ignored. A
140+
# mixin class is detected if its name ends with "mixin" (case insensitive).
141+
ignore-mixin-members=yes
142+
143+
# List of classes names for which member attributes should not be checked
144+
# (useful for classes with attributes dynamically set).
145+
ignored-classes=SQLObject
146+
147+
# When zope mode is activated, add a predefined set of Zope acquired attributes
148+
# to generated-members.
149+
zope=no
150+
151+
# List of members which are set dynamically and missed by pylint inference
152+
# system, and so shouldn't trigger E0201 when accessed. Python regular
153+
# expressions are accepted.
154+
generated-members=REQUEST,acl_users,aq_parent
155+
156+
157+
[VARIABLES]
158+
159+
# Tells whether we should check for unused import in __init__ files.
160+
init-import=no
161+
162+
# A regular expression matching the beginning of the name of dummy variables
163+
# (i.e. not used).
164+
dummy-variables-rgx=_$|dummy
165+
166+
# List of additional names supposed to be defined in builtins. Remember that
167+
# you should avoid to define new builtins when possible.
168+
additional-builtins=
169+
170+
171+
[FORMAT]
172+
173+
# Maximum number of characters on a single line.
174+
max-line-length=80
175+
176+
# Regexp for a line that is allowed to be longer than the limit.
177+
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
178+
179+
# Allow the body of an if to be on the same line as the test if there is no
180+
# else.
181+
single-line-if-stmt=no
182+
183+
# List of optional constructs for which whitespace checking is disabled
184+
no-space-check=trailing-comma,dict-separator
185+
186+
# Maximum number of lines in a module
187+
max-module-lines=1000
188+
189+
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
190+
# tab).
191+
indent-string=' '
192+
193+
194+
[SIMILARITIES]
195+
196+
# Minimum lines number of a similarity.
197+
min-similarity-lines=4
198+
199+
# Ignore comments when computing similarities.
200+
ignore-comments=yes
201+
202+
# Ignore docstrings when computing similarities.
203+
ignore-docstrings=yes
204+
205+
# Ignore imports when computing similarities.
206+
ignore-imports=no
207+
208+
209+
[IMPORTS]
210+
211+
# Deprecated modules which should not be used, separated by a comma
212+
deprecated-modules=regsub,TERMIOS,Bastion,rexec
213+
214+
# Create a graph of every (i.e. internal and external) dependencies in the
215+
# given file (report RP0402 must not be disabled)
216+
import-graph=
217+
218+
# Create a graph of external dependencies in the given file (report RP0402 must
219+
# not be disabled)
220+
ext-import-graph=
221+
222+
# Create a graph of internal dependencies in the given file (report RP0402 must
223+
# not be disabled)
224+
int-import-graph=
225+
226+
227+
[DESIGN]
228+
229+
# Maximum number of arguments for function / method
230+
max-args=5
231+
232+
# Argument names that match this expression will be ignored. Default to name
233+
# with leading underscore
234+
ignored-argument-names=_.*
235+
236+
# Maximum number of locals for function / method body
237+
max-locals=15
238+
239+
# Maximum number of return / yield for function / method body
240+
max-returns=6
241+
242+
# Maximum number of branch for function / method body
243+
max-branches=12
244+
245+
# Maximum number of statements in function / method body
246+
max-statements=50
247+
248+
# Maximum number of parents for a class (see R0901).
249+
max-parents=7
250+
251+
# Maximum number of attributes for a class (see R0902).
252+
max-attributes=7
253+
254+
# Minimum number of public methods for a class (see R0903).
255+
min-public-methods=2
256+
257+
# Maximum number of public methods for a class (see R0904).
258+
max-public-methods=20
259+
260+
261+
[CLASSES]
262+
263+
# List of interface methods to ignore, separated by a comma. This is used for
264+
# instance to not check methods defines in Zope's Interface base class.
265+
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
266+
267+
# List of method names used to declare (i.e. assign) instance attributes.
268+
defining-attr-methods=__init__,__new__,setUp
269+
270+
# List of valid names for the first argument in a class method.
271+
valid-classmethod-first-arg=cls
272+
273+
# List of valid names for the first argument in a metaclass class method.
274+
valid-metaclass-classmethod-first-arg=mcs
275+
276+
277+
[EXCEPTIONS]
278+
279+
# Exceptions that will emit a warning when being caught. Defaults to
280+
# "Exception"
281+
overgeneral-exceptions=Exception

requirements/requirements.dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
flake8
2+
flake8-builtins
3+
flake8-isort
4+
setuptools

setup.cfg

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[metadata]
2+
description_file = README.md
3+
4+
# -- Code quality ------------------------------------
5+
[flake8]
6+
count = True
7+
exclude =
8+
.git
9+
ignore = T201, W503, W504
10+
max-complexity = 20
11+
max-doc-length = 130
12+
max-line-length = 80
13+
per-file-ignores =
14+
__init__.py: E501, W505
15+
resources2.py: E501, W505
16+
resources3.py: E501, W505
17+
per-file-line_length = 21
18+
19+
[isort]
20+
ensure_newline_before_comments = True
21+
force_grid_wrap = 0
22+
include_trailing_comma = True
23+
line_length = 80
24+
multi_line_output = 3
25+
profile = black
26+
use_parentheses = True

0 commit comments

Comments
 (0)