1 |
A bunch of warnings are left disabled because there's too many violations |
2 |
in the current code base. Hopefully we can get to a point where everyone |
3 |
uses this though and we can start enabling more and more. |
4 |
|
5 |
The code base is "clean" right now in the sense that running pylint will |
6 |
not produce any output. But we should start removing violations one by |
7 |
one and re-enable the warning class as we go. |
8 |
--- |
9 |
.pylintrc | 250 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
10 |
bin/pylint | 31 ++++++++ |
11 |
2 files changed, 281 insertions(+) |
12 |
create mode 100644 .pylintrc |
13 |
create mode 100755 bin/pylint |
14 |
|
15 |
diff --git a/.pylintrc b/.pylintrc |
16 |
new file mode 100644 |
17 |
index 0000000..5fdbb1f |
18 |
--- /dev/null |
19 |
+++ b/.pylintrc |
20 |
@@ -0,0 +1,250 @@ |
21 |
+[MASTER] |
22 |
+ |
23 |
+# Profiled execution. |
24 |
+profile=no |
25 |
+ |
26 |
+# Add files or directories to the blacklist. They should be base names, not |
27 |
+# paths. |
28 |
+ignore= |
29 |
+ |
30 |
+# Pickle collected data for later comparisons. |
31 |
+persistent=yes |
32 |
+ |
33 |
+# List of plugins (as comma separated values of python modules names) to load, |
34 |
+# usually to register additional checkers. |
35 |
+load-plugins= |
36 |
+ |
37 |
+ |
38 |
+[MESSAGES CONTROL] |
39 |
+ |
40 |
+# Enable the message, report, category or checker with the given id(s). You can |
41 |
+# either give multiple identifier separated by comma (,) or put this option |
42 |
+# multiple time. |
43 |
+#enable= |
44 |
+ |
45 |
+# Disable the message, report, category or checker with the given id(s). You |
46 |
+# can either give multiple identifier separated by comma (,) or put this option |
47 |
+# multiple time (only on the command line, not in the configuration file where |
48 |
+# it should appear only once). |
49 |
+# We should clean up things so we can enable: |
50 |
+# missing-docstring -- add lots of docstrings everywhere! |
51 |
+# bad-whitespace -- fix spacing everywhere |
52 |
+# bad-continuation -- might be hard with tab indentation policy |
53 |
+# invalid-name -- need to manage constants better |
54 |
+# line-too-long -- figure out a length and stick to it |
55 |
+# pointless-string-statement -- convert to comments |
56 |
+# unused-wildcard-import -- use local disables if needed |
57 |
+# unidiomatic-typecheck -- convert to isinstance |
58 |
+# redefined-outer-name -- clean up code to not do this |
59 |
+# <all the ones after redefined-outer-name in the list> |
60 |
+disable=missing-docstring, too-many-lines, locally-enabled, locally-disabled, too-few-public-methods, too-many-public-methods, too-many-return-statements, too-many-branches, too-many-arguments, too-many-function-args, too-many-locals, too-many-statements, too-many-instance-attributes, fixme, broad-except, bad-whitespace, bad-continuation, invalid-name, line-too-long, pointless-string-statement, unused-wildcard-import, unidiomatic-typecheck, redefined-outer-name, attribute-defined-outside-init, bad-indentation, bare-except, global-statement, global-variable-not-assigned, mixed-indentation, multiple-statements, no-self-use, redefined-builtin, reimported, relative-import, superfluous-parens, super-init-not-called, unused-argument, unused-import, unused-variable, wildcard-import, bad-builtin, no-init, unreachable |
61 |
+ |
62 |
+ |
63 |
+[REPORTS] |
64 |
+ |
65 |
+# Set the output format. Available formats are text, parseable, colorized, msvs |
66 |
+# (visual studio) and html |
67 |
+output-format=text |
68 |
+ |
69 |
+# Put messages in a separate file for each module / package specified on the |
70 |
+# command line instead of printing them on stdout. Reports (if any) will be |
71 |
+# written in a file name "pylint_global.[txt|html]". |
72 |
+files-output=no |
73 |
+ |
74 |
+# Tells whether to display a full report or only the messages |
75 |
+reports=no |
76 |
+ |
77 |
+# Python expression which should return a note less than 10 (10 is the highest |
78 |
+# note). You have access to the variables errors warning, statement which |
79 |
+# respectively contain the number of errors / warnings messages and the total |
80 |
+# number of statements analyzed. This is used by the global evaluation report |
81 |
+# (RP0004). |
82 |
+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) |
83 |
+ |
84 |
+# Add a comment according to your evaluation note. This is used by the global |
85 |
+# evaluation report (RP0004). |
86 |
+comment=no |
87 |
+ |
88 |
+ |
89 |
+[FORMAT] |
90 |
+ |
91 |
+# Maximum number of characters on a single line. |
92 |
+max-line-length=80 |
93 |
+ |
94 |
+# Maximum number of lines in a module |
95 |
+max-module-lines=1000 |
96 |
+ |
97 |
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 |
98 |
+# tab). |
99 |
+indent-string='\t' |
100 |
+ |
101 |
+ |
102 |
+[MISCELLANEOUS] |
103 |
+ |
104 |
+# List of note tags to take in consideration, separated by a comma. |
105 |
+notes=FIXME,XXX,TODO |
106 |
+ |
107 |
+ |
108 |
+[VARIABLES] |
109 |
+ |
110 |
+# Tells whether we should check for unused import in __init__ files. |
111 |
+init-import=no |
112 |
+ |
113 |
+# A regular expression matching the beginning of the name of dummy variables |
114 |
+# (i.e. not used). |
115 |
+dummy-variables-rgx=_|dummy |
116 |
+ |
117 |
+# List of additional names supposed to be defined in builtins. Remember that |
118 |
+# you should avoid to define new builtins when possible. |
119 |
+additional-builtins= |
120 |
+ |
121 |
+ |
122 |
+[TYPECHECK] |
123 |
+ |
124 |
+# Tells whether missing members accessed in mixin class should be ignored. A |
125 |
+# mixin class is detected if its name ends with "mixin" (case insensitive). |
126 |
+ignore-mixin-members=yes |
127 |
+ |
128 |
+# List of classes names for which member attributes should not be checked |
129 |
+# (useful for classes with attributes dynamically set). |
130 |
+ignored-classes=SQLObject,twisted.internet.reactor,hashlib,google.appengine.api.memcache |
131 |
+ |
132 |
+# When zope mode is activated, add a predefined set of Zope acquired attributes |
133 |
+# to generated-members. |
134 |
+zope=no |
135 |
+ |
136 |
+# List of members which are set dynamically and missed by pylint inference |
137 |
+# system, and so shouldn't trigger E0201 when accessed. Python regular |
138 |
+# expressions are accepted. |
139 |
+generated-members=REQUEST,acl_users,aq_parent,multiprocessing.managers.SyncManager |
140 |
+ |
141 |
+ |
142 |
+[BASIC] |
143 |
+ |
144 |
+# Required attributes for module, separated by a comma |
145 |
+required-attributes= |
146 |
+ |
147 |
+# List of builtins function names that should not be used, separated by a comma |
148 |
+bad-functions=map,filter,apply,input |
149 |
+ |
150 |
+# Regular expression which should only match correct module names |
151 |
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ |
152 |
+ |
153 |
+# Regular expression which should only match correct module level names |
154 |
+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ |
155 |
+ |
156 |
+# Regular expression which should only match correct class names |
157 |
+class-rgx=[A-Z_][a-zA-Z0-9]+$ |
158 |
+ |
159 |
+# Regular expression which should only match correct function names |
160 |
+function-rgx=[a-z_][a-z0-9_]{2,30}$ |
161 |
+ |
162 |
+# Regular expression which should only match correct method names |
163 |
+method-rgx=[a-z_][a-z0-9_]{2,30}$ |
164 |
+ |
165 |
+# Regular expression which should only match correct instance attribute names |
166 |
+attr-rgx=[a-z_][a-z0-9_]{2,30}$ |
167 |
+ |
168 |
+# Regular expression which should only match correct argument names |
169 |
+argument-rgx=[a-z_][a-z0-9_]{2,30}$ |
170 |
+ |
171 |
+# Regular expression which should only match correct variable names |
172 |
+variable-rgx=[a-z_][a-z0-9_]{2,30}$ |
173 |
+ |
174 |
+# Regular expression which should only match correct list comprehension / |
175 |
+# generator expression variable names |
176 |
+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ |
177 |
+ |
178 |
+# Good variable names which should always be accepted, separated by a comma |
179 |
+good-names=i,j,k,ex,Run,_ |
180 |
+ |
181 |
+# Bad variable names which should always be refused, separated by a comma |
182 |
+bad-names=foo,bar,baz,toto,tutu,tata |
183 |
+ |
184 |
+# Regular expression which should only match functions or classes name which do |
185 |
+# not require a docstring |
186 |
+no-docstring-rgx=__.*__ |
187 |
+ |
188 |
+ |
189 |
+[SIMILARITIES] |
190 |
+ |
191 |
+# Minimum lines number of a similarity. |
192 |
+min-similarity-lines=20 |
193 |
+ |
194 |
+# Ignore comments when computing similarities. |
195 |
+ignore-comments=yes |
196 |
+ |
197 |
+# Ignore docstrings when computing similarities. |
198 |
+ignore-docstrings=yes |
199 |
+ |
200 |
+ |
201 |
+[IMPORTS] |
202 |
+ |
203 |
+# Deprecated modules which should not be used, separated by a comma |
204 |
+deprecated-modules=regsub,string,TERMIOS,Bastion,rexec |
205 |
+ |
206 |
+# Create a graph of every (i.e. internal and external) dependencies in the |
207 |
+# given file (report RP0402 must not be disabled) |
208 |
+import-graph= |
209 |
+ |
210 |
+# Create a graph of external dependencies in the given file (report RP0402 must |
211 |
+# not be disabled) |
212 |
+ext-import-graph= |
213 |
+ |
214 |
+# Create a graph of internal dependencies in the given file (report RP0402 must |
215 |
+# not be disabled) |
216 |
+int-import-graph= |
217 |
+ |
218 |
+ |
219 |
+[CLASSES] |
220 |
+ |
221 |
+# List of interface methods to ignore, separated by a comma. This is used for |
222 |
+# instance to not check methods defines in Zope's Interface base class. |
223 |
+ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by |
224 |
+ |
225 |
+# List of method names used to declare (i.e. assign) instance attributes. |
226 |
+defining-attr-methods=__init__,__new__,setUp |
227 |
+ |
228 |
+# List of valid names for the first argument in a class method. |
229 |
+valid-classmethod-first-arg=cls |
230 |
+ |
231 |
+ |
232 |
+[DESIGN] |
233 |
+ |
234 |
+# Maximum number of arguments for function / method |
235 |
+max-args=5 |
236 |
+ |
237 |
+# Argument names that match this expression will be ignored. Default to name |
238 |
+# with leading underscore |
239 |
+ignored-argument-names=_.* |
240 |
+ |
241 |
+# Maximum number of locals for function / method body |
242 |
+max-locals=15 |
243 |
+ |
244 |
+# Maximum number of return / yield for function / method body |
245 |
+max-returns=6 |
246 |
+ |
247 |
+# Maximum number of branch for function / method body |
248 |
+max-branchs=12 |
249 |
+ |
250 |
+# Maximum number of statements in function / method body |
251 |
+max-statements=50 |
252 |
+ |
253 |
+# Maximum number of parents for a class (see R0901). |
254 |
+max-parents=7 |
255 |
+ |
256 |
+# Maximum number of attributes for a class (see R0902). |
257 |
+max-attributes=7 |
258 |
+ |
259 |
+# Minimum number of public methods for a class (see R0903). |
260 |
+min-public-methods=2 |
261 |
+ |
262 |
+# Maximum number of public methods for a class (see R0904). |
263 |
+max-public-methods=20 |
264 |
+ |
265 |
+ |
266 |
+[EXCEPTIONS] |
267 |
+ |
268 |
+# Exceptions that will emit a warning when being caught. Defaults to |
269 |
+# "Exception" |
270 |
+overgeneral-exceptions=Exception |
271 |
diff --git a/bin/pylint b/bin/pylint |
272 |
new file mode 100755 |
273 |
index 0000000..1a50609 |
274 |
--- /dev/null |
275 |
+++ b/bin/pylint |
276 |
@@ -0,0 +1,31 @@ |
277 |
+#!/usr/bin/python |
278 |
+# Copyright 1999-2015 Gentoo Foundation |
279 |
+# Distributed under the terms of the GNU General Public License v2 |
280 |
+ |
281 |
+"""Run pylint with the right settings.""" |
282 |
+ |
283 |
+from __future__ import print_function |
284 |
+ |
285 |
+import os |
286 |
+import sys |
287 |
+ |
288 |
+ |
289 |
+def main(argv): |
290 |
+ """The main entry point""" |
291 |
+ source_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) |
292 |
+ |
293 |
+ pympath = source_root |
294 |
+ pythonpath = os.environ.get('PYTHONPATH') |
295 |
+ if pythonpath is None: |
296 |
+ pythonpath = pympath |
297 |
+ else: |
298 |
+ pythonpath = pympath + ':' + pythonpath |
299 |
+ os.environ['PYTHONPATH'] = pythonpath |
300 |
+ |
301 |
+ pylintrc = os.path.join(source_root, '.pylintrc') |
302 |
+ cmd = ['pylint', '--rcfile', pylintrc] |
303 |
+ os.execvp(cmd[0], cmd + argv) |
304 |
+ |
305 |
+ |
306 |
+if __name__ == '__main__': |
307 |
+ main(sys.argv[1:]) |
308 |
-- |
309 |
2.5.2 |