Merge lp:~dobey/ubuntuone-dev-tools/no-more-pylint into lp:ubuntuone-dev-tools
- no-more-pylint
- Merge into trunk
Proposed by
dobey
Status: | Merged |
---|---|
Approved by: | Brian Curtin |
Approved revision: | 103 |
Merged at revision: | 103 |
Proposed branch: | lp:~dobey/ubuntuone-dev-tools/no-more-pylint |
Merge into: | lp:ubuntuone-dev-tools |
Diff against target: |
541 lines (+9/-384) 4 files modified
bin/u1lint (+5/-67) pylintrc (+0/-307) run-tests (+1/-3) setup.py (+3/-7) |
To merge this branch: | bzr merge lp:~dobey/ubuntuone-dev-tools/no-more-pylint |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brian Curtin (community) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+164240@code.launchpad.net |
Commit message
Drop all usage of pylint in u1lint and only use pyflakes instead.
Description of the change
We don't use pylint in the projects any more, so lets get rid of it here too, and make pyflakes the default.
To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) : | # |
review:
Approve
Revision history for this message
Brian Curtin (brian.curtin) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/u1lint' |
2 | --- bin/u1lint 2012-11-28 21:45:47 +0000 |
3 | +++ bin/u1lint 2013-05-16 17:44:27 +0000 |
4 | @@ -1,6 +1,6 @@ |
5 | #!/usr/bin/python |
6 | # |
7 | -# Copyright 2009-2012 Canonical Ltd. |
8 | +# Copyright 2009-2013 Canonical Ltd. |
9 | # |
10 | # This program is free software: you can redistribute it and/or modify it |
11 | # under the terms of the GNU General Public License version 3, as published |
12 | @@ -26,22 +26,14 @@ |
13 | # do not wish to do so, delete this exception statement from your |
14 | # version. If you delete this exception statement from all source |
15 | # files in the program, then also delete it here. |
16 | -"""Wrapper script for pylint command.""" |
17 | +"""Wrapper script for pyflakes command.""" |
18 | |
19 | from __future__ import print_function |
20 | |
21 | -# pylint: disable=F0401 |
22 | -try: |
23 | - import configparser |
24 | -except ImportError: |
25 | - import ConfigParser as configparser |
26 | -# pylint: disable=F0401 |
27 | - |
28 | import os |
29 | import subprocess |
30 | import sys |
31 | |
32 | -from dirspec.basedir import xdg_data_dirs |
33 | |
34 | SRCDIR = os.environ.get('SRCDIR', os.getcwd()) |
35 | |
36 | @@ -68,38 +60,28 @@ |
37 | if os.path.exists(os.path.join(path, "python.exe")): |
38 | return path |
39 | |
40 | - # pylint: disable=F0401 |
41 | try: |
42 | import winreg |
43 | except ImportError: |
44 | import _winreg as winreg |
45 | - # pylint: enable=F0401 |
46 | software_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'Software') |
47 | python_key = None |
48 | try: |
49 | python_key = winreg.OpenKey(software_key, 'Python') |
50 | - # pylint: disable=E0602 |
51 | except WindowsError: |
52 | - # pylint: enable=E0602 |
53 | try: |
54 | # look in the WoW6432node, we are running python |
55 | # 32 on a 64 machine |
56 | wow6432node_key = winreg.OpenKey(software_key, 'WoW6432Node') |
57 | python_key = winreg.OpenKey(wow6432node_key, 'Python') |
58 | - # pylint: disable=E0602 |
59 | except WindowsError: |
60 | - # pylint: enable=E0602 |
61 | raise InvalidSetupException( |
62 | 'Could not located python installation path.') |
63 | try: |
64 | core_key = winreg.OpenKey(python_key, 'PythonCore') |
65 | - # pylint: disable=E1101 |
66 | version_key = winreg.OpenKey(core_key, sys.winver) |
67 | - # pylint: enable=E1101 |
68 | return winreg.QueryValue(version_key, 'InstallPath') |
69 | - # pylint: disable=E0602 |
70 | except WindowsError: |
71 | - # pylint: enable=E0602 |
72 | raise InvalidSetupException( |
73 | 'Could not located python installation path.') |
74 | |
75 | @@ -135,39 +117,6 @@ |
76 | return [script, ] |
77 | |
78 | |
79 | -def find_pylintrc(): |
80 | - """Return the first pylintrc found.""" |
81 | - # Use the pylintrc in the source tree if there is one |
82 | - full_name = os.path.join(SRCDIR, 'pylintrc') |
83 | - if os.path.exists(full_name): |
84 | - return full_name |
85 | - |
86 | - # If no pylintrc in the source tree, use the first in $XDG_DATA_DIRS |
87 | - # Hopefully this is the one we installed, and hasn't been overridden |
88 | - for name in xdg_data_dirs: |
89 | - full_name = os.path.join(name, 'ubuntuone-dev-tools', 'pylintrc') |
90 | - if os.path.exists(full_name): |
91 | - return full_name |
92 | - return None |
93 | - |
94 | - |
95 | -PYLINTRC = find_pylintrc() |
96 | - |
97 | - |
98 | -def _read_pylintrc_ignored(): |
99 | - """Get the ignored files list from pylintrc""" |
100 | - try: |
101 | - config = configparser.ConfigParser() |
102 | - config.read([PYLINTRC]) |
103 | - |
104 | - # pylint: disable=E1103 |
105 | - return [os.path.join(SRCDIR, item) for item in |
106 | - config.get("MASTER", "ignore").split(",")] |
107 | - except (TypeError, configparser.NoOptionError): |
108 | - return [] |
109 | - # pylint: enable=E1103 |
110 | - |
111 | - |
112 | def _group_lines_by_file(data): |
113 | """Format file:line:message output as lines grouped by file.""" |
114 | did_fail = False |
115 | @@ -180,7 +129,6 @@ |
116 | elif line.startswith("build/") or len(current) < 3: |
117 | pass |
118 | elif filename == current[0]: |
119 | - # pylint warning W0511 is a custom note |
120 | if not "[W0511]" in current[2]: |
121 | did_fail = True |
122 | outputs.append(" " + current[1] + ": " + current[2]) |
123 | @@ -188,7 +136,6 @@ |
124 | filename = current[0] |
125 | outputs.append("") |
126 | outputs.append(filename + ":") |
127 | - # pylint warning W0511 is a custom note |
128 | if not "[W0511]" in current[2]: |
129 | did_fail = True |
130 | outputs.append(" " + current[1] + ": " + current[2]) |
131 | @@ -199,7 +146,6 @@ |
132 | def _find_files(): |
133 | """Find all Python files under the current tree.""" |
134 | pyfiles = [] |
135 | - # pylint: disable=W0612 |
136 | for root, dirs, files in os.walk(SRCDIR, topdown=False): |
137 | for filename in files: |
138 | filepath = root + os.path.sep |
139 | @@ -233,20 +179,12 @@ |
140 | (options, args) = parser.parse_args() |
141 | |
142 | failed = False |
143 | - ignored = _read_pylintrc_ignored() |
144 | + ignored = [] |
145 | if options.ignored: |
146 | ignored.extend([os.path.join(SRCDIR, item) for item in |
147 | map(str.strip, options.ignored.split(','))]) |
148 | |
149 | - if os.environ.get('USE_PYFLAKES'): |
150 | - pylint_args = get_subprocess_start_info('pyflakes') |
151 | - else: |
152 | - pylint_args = get_subprocess_start_info('pylint') |
153 | - # append the extra args to the start info |
154 | - pylint_args.extend(['--output-format=parseable', |
155 | - '--include-ids=yes']) |
156 | - if PYLINTRC: |
157 | - pylint_args.append("--rcfile=" + PYLINTRC) |
158 | + pylint_args = get_subprocess_start_info('pyflakes') |
159 | |
160 | for path in _find_files(): |
161 | is_build = path.startswith(os.path.join(SRCDIR, "_build")) |
162 | @@ -272,7 +210,7 @@ |
163 | print(grouped, end="\n\n") |
164 | |
165 | returncode = sp.wait() |
166 | - # XXX Testing that W0511 does not cause a failure |
167 | + |
168 | if failed: |
169 | if returncode != 0: |
170 | exit(returncode) |
171 | |
172 | === removed file 'pylintrc' |
173 | --- pylintrc 2011-04-13 14:44:11 +0000 |
174 | +++ pylintrc 1970-01-01 00:00:00 +0000 |
175 | @@ -1,307 +0,0 @@ |
176 | -# lint Python modules using external checkers. |
177 | -# |
178 | -# This is the main checker controlling the other ones and the reports |
179 | -# generation. It is itself both a raw checker and an astng checker in order |
180 | -# to: |
181 | -# * handle message activation / deactivation at the module level |
182 | -# * handle some basic but necessary stats'data (number of classes, methods...) |
183 | -# |
184 | -[MASTER] |
185 | - |
186 | -# Specify a configuration file. |
187 | -#rcfile= |
188 | - |
189 | -# Python code to execute, usually for sys.path manipulation such as |
190 | -# pygtk.require(). |
191 | -#init-hook= |
192 | - |
193 | -# Profiled execution. |
194 | -profile=no |
195 | - |
196 | -# Add <file or directory> to the black list. It should be a base name, not a |
197 | -# path. You may set this option multiple times. |
198 | -#ignore=<somedir> |
199 | - |
200 | -# Pickle collected data for later comparisons. |
201 | -persistent=no |
202 | - |
203 | -# List of plugins (as comma separated values of python modules names) to load, |
204 | -# usually to register additional checkers. |
205 | -load-plugins= |
206 | - |
207 | - |
208 | -[MESSAGES CONTROL] |
209 | - |
210 | -# Enable only checker(s) with the given id(s). This option conflicts with the |
211 | -# disable-checker option |
212 | -#enable-checker= |
213 | - |
214 | -# Enable all checker(s) except those with the given id(s). This option |
215 | -# conflicts with the enable-checker option |
216 | -#disable-checker= |
217 | - |
218 | -# Enable all messages in the listed categories. |
219 | -#enable-cat= |
220 | - |
221 | -# Disable all messages in the listed categories. |
222 | -#disable-cat= |
223 | - |
224 | -# Disable the message(s) with the given id(s) or categories |
225 | -# W0142: Used * or ** magic |
226 | -# W0221: Arguments number differs from %s method (pylint is confused by * and **) |
227 | -# W0613: Unused argument %r (We get lots of these from interfaces) |
228 | -# W0404: Erroneous re-import warning: MM: X Reimported (line MM) |
229 | -disable=R,I,W0142,W0221,W0613,W0404 |
230 | - |
231 | - |
232 | -[REPORTS] |
233 | - |
234 | -# Set the output format. Available formats are text, parseable, colorized, msvs |
235 | -# (visual studio) and html |
236 | -output-format=colorized |
237 | - |
238 | -# Include message's id in output |
239 | -include-ids=yes |
240 | - |
241 | -# Put messages in a separate file for each module / package specified on the |
242 | -# command line instead of printing them on stdout. Reports (if any) will be |
243 | -# written in a file name "pylint_global.[txt|html]". |
244 | -files-output=no |
245 | - |
246 | -# Tells whether to display a full report or only the messages |
247 | -reports=no |
248 | - |
249 | -# Python expression which should return a note less than 10 (10 is the highest |
250 | -# note). You have access to the variables errors warning, statement which |
251 | -# respectively contain the number of errors / warnings messages and the total |
252 | -# number of statements analyzed. This is used by the global evaluation report |
253 | -# (R0004). |
254 | -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) |
255 | - |
256 | -# Add a comment according to your evaluation note. This is used by the global |
257 | -# evaluation report (R0004). |
258 | -comment=no |
259 | - |
260 | -# Enable the report(s) with the given id(s). |
261 | -#enable-report= |
262 | - |
263 | -# Disable the report(s) with the given id(s). |
264 | -#disable-report= |
265 | - |
266 | - |
267 | -# try to find bugs in the code using type inference |
268 | -# |
269 | -[TYPECHECK] |
270 | - |
271 | -# Tells whether missing members accessed in mixin class should be ignored. A |
272 | -# mixin class is detected if its name ends with "mixin" (case insensitive). |
273 | -ignore-mixin-members=yes |
274 | - |
275 | -# List of classes names for which member attributes should not be checked |
276 | -# (useful for classes with attributes dynamically set). |
277 | -ignored-classes= |
278 | - |
279 | -# When zope mode is activated, add a predefined set of Zope acquired attributes |
280 | -# to generated-members. |
281 | -zope=no |
282 | - |
283 | -# List of members which are set dynamically and missed by pylint inference |
284 | -# system, and so shouldn't trigger E0201 when accessed. |
285 | -generated-members=REQUEST,acl_users,aq_parent |
286 | - |
287 | - |
288 | -# checks for |
289 | -# * unused variables / imports |
290 | -# * undefined variables |
291 | -# * redefinition of variable from builtins or from an outer scope |
292 | -# * use of variable before assignment |
293 | -# |
294 | -[VARIABLES] |
295 | - |
296 | -# Tells whether we should check for unused import in __init__ files. |
297 | -init-import=yes |
298 | - |
299 | -# A regular expression matching names used for dummy variables (i.e. not used). |
300 | -dummy-variables-rgx=_|dummy |
301 | - |
302 | -# List of additional names supposed to be defined in builtins. Remember that |
303 | -# you should avoid to define new builtins when possible. |
304 | -additional-builtins= |
305 | - |
306 | - |
307 | -# checks for : |
308 | -# * doc strings |
309 | -# * modules / classes / functions / methods / arguments / variables name |
310 | -# * number of arguments, local variables, branches, returns and statements in |
311 | -# functions, methods |
312 | -# * required module attributes |
313 | -# * dangerous default values as arguments |
314 | -# * redefinition of function / method / class |
315 | -# * uses of the global statement |
316 | -# |
317 | -[BASIC] |
318 | - |
319 | -# Required attributes for module, separated by a comma |
320 | -required-attributes= |
321 | - |
322 | -# Regular expression which should only match functions or classes name which do |
323 | -# not require a docstring |
324 | -no-docstring-rgx=(__.*__|setUp|tearDown) |
325 | - |
326 | -# Regular expression which should only match correct module names |
327 | -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ |
328 | - |
329 | -# Regular expression which should only match correct module level names |
330 | -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ |
331 | - |
332 | -# Regular expression which should only match correct class names |
333 | -class-rgx=[A-Z_][a-zA-Z0-9]+$ |
334 | - |
335 | -# Regular expression which should only match correct function names |
336 | -function-rgx=[a-z_][a-z0-9_]{2,79}$ |
337 | - |
338 | -# Regular expression which should only match correct method names |
339 | -method-rgx=([a-z_][a-z0-9_]{2,79}$|setUp|tearDown) |
340 | - |
341 | -# Regular expression which should only match correct instance attribute names |
342 | -attr-rgx=[a-z_][a-z0-9_]{1,30}$ |
343 | - |
344 | -# Regular expression which should only match correct argument names |
345 | -argument-rgx=[a-z_][a-z0-9_]{1,30}$ |
346 | - |
347 | -# Regular expression which should only match correct variable names |
348 | -variable-rgx=[a-z_][a-z0-9_]{1,30}$ |
349 | - |
350 | -# Regular expression which should only match correct list comprehension / |
351 | -# generator expression variable names |
352 | -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ |
353 | - |
354 | -# Good variable names which should always be accepted, separated by a comma |
355 | -good-names=d,e,f,g,i,j,k,ex,logger,Run,_ |
356 | - |
357 | -# Bad variable names which should always be refused, separated by a comma |
358 | -bad-names=foo,bar,baz,toto,tutu,tata |
359 | - |
360 | -# List of builtins function names that should not be used, separated by a comma |
361 | -bad-functions=apply,input,reduce |
362 | - |
363 | - |
364 | -# checks for sign of poor/misdesign: |
365 | -# * number of methods, attributes, local variables... |
366 | -# * size, complexity of functions, methods |
367 | -# |
368 | -[DESIGN] |
369 | - |
370 | -# Maximum number of arguments for function / method |
371 | -max-args=5 |
372 | - |
373 | -# Maximum number of locals for function / method body |
374 | -max-locals=15 |
375 | - |
376 | -# Maximum number of return / yield for function / method body |
377 | -max-returns=6 |
378 | - |
379 | -# Maximum number of branch for function / method body |
380 | -max-branchs=12 |
381 | - |
382 | -# Maximum number of statements in function / method body |
383 | -max-statements=50 |
384 | - |
385 | -# Maximum number of parents for a class (see R0901). |
386 | -max-parents=7 |
387 | - |
388 | -# Maximum number of attributes for a class (see R0902). |
389 | -max-attributes=7 |
390 | - |
391 | -# Minimum number of public methods for a class (see R0903). |
392 | -min-public-methods=2 |
393 | - |
394 | -# Maximum number of public methods for a class (see R0904). |
395 | -max-public-methods=20 |
396 | - |
397 | - |
398 | -# checks for : |
399 | -# * methods without self as first argument |
400 | -# * overridden methods signature |
401 | -# * access only to existent members via self |
402 | -# * attributes not defined in the __init__ method |
403 | -# * supported interfaces implementation |
404 | -# * unreachable code |
405 | -# |
406 | -[CLASSES] |
407 | - |
408 | -# List of interface methods to ignore, separated by a comma. This is used for |
409 | -# instance to not check methods defines in Zopes Interface base class. |
410 | -#ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by,providedBy |
411 | - |
412 | -# List of method names used to declare (i.e. assign) instance attributes. |
413 | -defining-attr-methods=__init__,__new__,setUp |
414 | - |
415 | - |
416 | -# checks for |
417 | -# * external modules dependencies |
418 | -# * relative / wildcard imports |
419 | -# * cyclic imports |
420 | -# * uses of deprecated modules |
421 | -# |
422 | -[IMPORTS] |
423 | - |
424 | -# Deprecated modules which should not be used, separated by a comma |
425 | -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec |
426 | - |
427 | -# Create a graph of every (i.e. internal and external) dependencies in the |
428 | -# given file (report RP0402 must not be disabled) |
429 | -import-graph= |
430 | - |
431 | -# Create a graph of external dependencies in the given file (report RP0402 must |
432 | -# not be disabled) |
433 | -ext-import-graph= |
434 | - |
435 | -# Create a graph of internal dependencies in the given file (report RP0402 must |
436 | -# not be disabled) |
437 | -int-import-graph= |
438 | - |
439 | - |
440 | -# checks for : |
441 | -# * unauthorized constructions |
442 | -# * strict indentation |
443 | -# * line length |
444 | -# * use of <> instead of != |
445 | -# |
446 | -[FORMAT] |
447 | - |
448 | -# Maximum number of characters on a single line. |
449 | -max-line-length=79 |
450 | - |
451 | -# Maximum number of lines in a module |
452 | -max-module-lines=2000 |
453 | - |
454 | -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 |
455 | -# tab). |
456 | -indent-string=' ' |
457 | - |
458 | - |
459 | -# checks for similarities and duplicated code. This computation may be |
460 | -# memory / CPU intensive, so you should disable it if you experiments some |
461 | -# problems. |
462 | -# |
463 | -[SIMILARITIES] |
464 | - |
465 | -# Minimum lines number of a similarity. |
466 | -min-similarity-lines=4 |
467 | - |
468 | -# Ignore comments when computing similarities. |
469 | -ignore-comments=yes |
470 | - |
471 | -# Ignore docstrings when computing similarities. |
472 | -ignore-docstrings=yes |
473 | - |
474 | - |
475 | -# checks for: |
476 | -# * warning notes in the code like FIXME, XXX |
477 | -# * PEP 263: source code with non ascii character but no encoding declaration |
478 | -# |
479 | -[MISCELLANEOUS] |
480 | - |
481 | -# List of note tags to take in consideration, separated by a comma. |
482 | -notes=FIXME,XXX,TODO,fixme,xxx,todo |
483 | |
484 | === modified file 'run-tests' |
485 | --- run-tests 2012-10-18 21:17:22 +0000 |
486 | +++ run-tests 2013-05-16 17:44:27 +0000 |
487 | @@ -1,6 +1,6 @@ |
488 | #!/bin/bash |
489 | # |
490 | -# Copyright 2010-2012 Canonical Ltd. |
491 | +# Copyright 2010-2013 Canonical Ltd. |
492 | # |
493 | # This program is free software: you can redistribute it and/or modify it |
494 | # under the terms of the GNU General Public License version 3, as published |
495 | @@ -26,8 +26,6 @@ |
496 | $PYTHON bin/u1trial --reactor=twisted -i "test_squid_windows.py" ubuntuone |
497 | echo "Running style checks..." |
498 | $PYTHON bin/u1lint |
499 | -# Run with pyflakes as well as pylint |
500 | -USE_PYFLAKES="1" $PYTHON bin/u1lint |
501 | |
502 | pep8 --repeat . bin/* --exclude=*.bat,.pc |
503 | rm -rf _trial_temp |
504 | |
505 | === modified file 'setup.py' |
506 | --- setup.py 2012-11-28 21:45:47 +0000 |
507 | +++ setup.py 2013-05-16 17:44:27 +0000 |
508 | @@ -1,6 +1,6 @@ |
509 | #!/usr/bin/python |
510 | # |
511 | -# Copyright 2010-2012 Canonical Ltd. |
512 | +# Copyright 2010-2013 Canonical Ltd. |
513 | # |
514 | # This program is free software: you can redistribute it and/or modify it |
515 | # under the terms of the GNU General Public License version 3, as published |
516 | @@ -59,23 +59,19 @@ |
517 | if retcode != 0: |
518 | sys.exit(retcode) |
519 | |
520 | -# pylint: disable=C0103 |
521 | scripts = ['bin/u1lint', |
522 | 'bin/u1trial'] |
523 | -# pylint: enable=C0103 |
524 | |
525 | if sys.platform == 'win32': |
526 | # lets add the .bat so that windows users are happy |
527 | scripts.extend(['bin/u1lint.bat', 'bin/u1trial.bat']) |
528 | DATA_FILES = [(os.path.join(basedir.default_data_path, PACKAGE), |
529 | - ['pylintrc', |
530 | - 'data/dbus-session.conf.in', |
531 | + ['data/dbus-session.conf.in', |
532 | 'data/squid.conf.in']), |
533 | ] |
534 | else: |
535 | DATA_FILES = [('share/%s' % PACKAGE, |
536 | - ['pylintrc', |
537 | - 'data/dbus-session.conf.in', |
538 | + ['data/dbus-session.conf.in', |
539 | 'data/squid.conf.in']), |
540 | ('share/man/man1', |
541 | ['man/u1lint.1', |