Skip to content

Commit 3452d2b

Browse files
committed
Add pylint config and script to run pylint
1 parent d2b8e43 commit 3452d2b

File tree

2 files changed

+369
-0
lines changed

2 files changed

+369
-0
lines changed

unittests/pylint.cfg

Lines changed: 361 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,361 @@
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+
# Add files or directories to the blacklist. They should be base names, not
11+
# paths.
12+
ignore=CVS
13+
14+
# Pickle collected data for later comparisons.
15+
persistent=yes
16+
17+
# List of plugins (as comma separated values of python modules names) to load,
18+
# usually to register additional checkers.
19+
load-plugins=
20+
21+
# Use multiple processes to speed up Pylint.
22+
jobs=1
23+
24+
# Allow loading of arbitrary C extensions. Extensions are imported into the
25+
# active Python interpreter and may run arbitrary code.
26+
unsafe-load-any-extension=no
27+
28+
# A comma-separated list of package or module names from where C extensions may
29+
# be loaded. Extensions are loading into the active Python interpreter and may
30+
# run arbitrary code
31+
extension-pkg-whitelist=
32+
33+
34+
[MESSAGES CONTROL]
35+
36+
# Only show warnings with the listed confidence levels. Leave empty to show
37+
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
38+
confidence=
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. See also the "--disable" option for examples.
43+
#enable=
44+
45+
# Disable the message, report, category or checker with the given id(s). You
46+
# can either give multiple identifiers separated by comma (,) or put this
47+
# option multiple times (only on the command line, not in the configuration
48+
# file where it should appear only once).You can also use "--disable=all" to
49+
# disable everything first and then reenable specific checks. For example, if
50+
# you want to run only the similarities checker, you can use "--disable=all
51+
# --enable=similarities". If you want to run only the classes checker, but have
52+
# no Warning level messages displayed, use"--disable=all --enable=classes
53+
# --disable=W"
54+
disable=C0103,C0111,E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625,W1624,W1609,W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,I0021,W1638,I0020,W1618,W1619,W1630,W1626,W1637,W1634,W1635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1632,W1633,W0704,W1628,W1629,W1636
55+
56+
# Things that ware disabled specifically for pygccxml
57+
# Some of these may be enable later
58+
# C0103: Invalid class name
59+
# C0111: Missing method docstring (missing-docstring)
60+
61+
62+
[REPORTS]
63+
64+
# Set the output format. Available formats are text, parseable, colorized, msvs
65+
# (visual studio) and html. You can also give a reporter class, eg
66+
# mypackage.mymodule.MyReporterClass.
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=yes
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+
# Template used to display messages. This is a python new-style format string
85+
# used to format the message information. See doc for all details
86+
msg-template={msg_id}:{line:3d},{column:2d}: {msg} ({symbol})
87+
88+
89+
[LOGGING]
90+
91+
# Logging modules to check that the string format arguments are in logging
92+
# function parameter format
93+
logging-modules=logging
94+
95+
96+
[VARIABLES]
97+
98+
# Tells whether we should check for unused import in __init__ files.
99+
init-import=no
100+
101+
# A regular expression matching the name of dummy variables (i.e. expectedly
102+
# not used).
103+
dummy-variables-rgx=_$|dummy
104+
105+
# List of additional names supposed to be defined in builtins. Remember that
106+
# you should avoid to define new builtins when possible.
107+
additional-builtins=
108+
109+
# List of strings which can identify a callback function by name. A callback
110+
# name must start or end with one of those strings.
111+
callbacks=cb_,_cb
112+
113+
114+
[BASIC]
115+
116+
# List of builtins function names that should not be used, separated by a comma
117+
bad-functions=map,filter,input
118+
119+
# Good variable names which should always be accepted, separated by a comma
120+
good-names=i,j,k,ex,Run,_
121+
122+
# Bad variable names which should always be refused, separated by a comma
123+
bad-names=foo,bar,baz,toto,tutu,tata
124+
125+
# Colon-delimited sets of names that determine each other's naming style when
126+
# the name regexes allow several styles.
127+
name-group=
128+
129+
# Include a hint for the correct naming format with invalid-name
130+
include-naming-hint=no
131+
132+
# Regular expression matching correct function names
133+
function-rgx=[a-z_][a-z0-9_]{2,30}$
134+
135+
# Naming hint for function names
136+
function-name-hint=[a-z_][a-z0-9_]{2,30}$
137+
138+
# Regular expression matching correct variable names
139+
variable-rgx=[a-z_][a-z0-9_]{2,30}$
140+
141+
# Naming hint for variable names
142+
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
143+
144+
# Regular expression matching correct constant names
145+
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
146+
147+
# Naming hint for constant names
148+
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
149+
150+
# Regular expression matching correct attribute names
151+
attr-rgx=[a-z_][a-z0-9_]{2,30}$
152+
153+
# Naming hint for attribute names
154+
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
155+
156+
# Regular expression matching correct argument names
157+
argument-rgx=[a-z_][a-z0-9_]{2,30}$
158+
159+
# Naming hint for argument names
160+
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
161+
162+
# Regular expression matching correct class attribute names
163+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
164+
165+
# Naming hint for class attribute names
166+
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
167+
168+
# Regular expression matching correct inline iteration names
169+
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
170+
171+
# Naming hint for inline iteration names
172+
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
173+
174+
# Regular expression matching correct class names
175+
class-rgx=[A-Z_][a-zA-Z0-9]+$
176+
177+
# Naming hint for class names
178+
class-name-hint=[A-Z_][a-zA-Z0-9]+$
179+
180+
# Regular expression matching correct module names
181+
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
182+
183+
# Naming hint for module names
184+
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
185+
186+
# Regular expression matching correct method names
187+
method-rgx=[a-z_][a-z0-9_]{2,30}$
188+
189+
# Naming hint for method names
190+
method-name-hint=[a-z_][a-z0-9_]{2,30}$
191+
192+
# Regular expression which should only match function or class names that do
193+
# not require a docstring.
194+
no-docstring-rgx=__.*__
195+
196+
# Minimum line length for functions/classes that require docstrings, shorter
197+
# ones are exempt.
198+
docstring-min-length=-1
199+
200+
201+
[MISCELLANEOUS]
202+
203+
# List of note tags to take in consideration, separated by a comma.
204+
notes=FIXME,XXX,TODO
205+
206+
207+
[TYPECHECK]
208+
209+
# Tells whether missing members accessed in mixin class should be ignored. A
210+
# mixin class is detected if its name ends with "mixin" (case insensitive).
211+
ignore-mixin-members=yes
212+
213+
# List of module names for which member attributes should not be checked
214+
# (useful for modules/projects where namespaces are manipulated during runtime
215+
# and thus existing member attributes cannot be deduced by static analysis
216+
ignored-modules=
217+
218+
# List of classes names for which member attributes should not be checked
219+
# (useful for classes with attributes dynamically set).
220+
ignored-classes=SQLObject, optparse.Values, thread._local, _thread._local
221+
222+
# List of members which are set dynamically and missed by pylint inference
223+
# system, and so shouldn't trigger E1101 when accessed. Python regular
224+
# expressions are accepted.
225+
generated-members=REQUEST,acl_users,aq_parent
226+
227+
228+
[SPELLING]
229+
230+
# Spelling dictionary name. Available dictionaries: none. To make it working
231+
# install python-enchant package.
232+
spelling-dict=
233+
234+
# List of comma separated words that should not be checked.
235+
spelling-ignore-words=
236+
237+
# A path to a file that contains private dictionary; one word per line.
238+
spelling-private-dict-file=
239+
240+
# Tells whether to store unknown words to indicated private dictionary in
241+
# --spelling-private-dict-file option instead of raising a message.
242+
spelling-store-unknown-words=no
243+
244+
245+
[FORMAT]
246+
247+
# Maximum number of characters on a single line.
248+
max-line-length=100
249+
250+
# Regexp for a line that is allowed to be longer than the limit.
251+
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
252+
253+
# Allow the body of an if to be on the same line as the test if there is no
254+
# else.
255+
single-line-if-stmt=no
256+
257+
# List of optional constructs for which whitespace checking is disabled
258+
no-space-check=trailing-comma,dict-separator
259+
260+
# Maximum number of lines in a module
261+
max-module-lines=1000
262+
263+
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
264+
# tab).
265+
indent-string=' '
266+
267+
# Number of spaces of indent required inside a hanging or continued line.
268+
indent-after-paren=4
269+
270+
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
271+
expected-line-ending-format=
272+
273+
274+
[SIMILARITIES]
275+
276+
# Minimum lines number of a similarity.
277+
min-similarity-lines=4
278+
279+
# Ignore comments when computing similarities.
280+
ignore-comments=yes
281+
282+
# Ignore docstrings when computing similarities.
283+
ignore-docstrings=yes
284+
285+
# Ignore imports when computing similarities.
286+
ignore-imports=no
287+
288+
289+
[CLASSES]
290+
291+
# List of method names used to declare (i.e. assign) instance attributes.
292+
defining-attr-methods=__init__,__new__,setUp
293+
294+
# List of valid names for the first argument in a class method.
295+
valid-classmethod-first-arg=cls
296+
297+
# List of valid names for the first argument in a metaclass class method.
298+
valid-metaclass-classmethod-first-arg=mcs
299+
300+
# List of member names, which should be excluded from the protected access
301+
# warning.
302+
exclude-protected=_asdict,_fields,_replace,_source,_make
303+
304+
305+
[DESIGN]
306+
307+
# Maximum number of arguments for function / method
308+
max-args=5
309+
310+
# Argument names that match this expression will be ignored. Default to name
311+
# with leading underscore
312+
ignored-argument-names=_.*
313+
314+
# Maximum number of locals for function / method body
315+
max-locals=15
316+
317+
# Maximum number of return / yield for function / method body
318+
max-returns=6
319+
320+
# Maximum number of branch for function / method body
321+
max-branches=12
322+
323+
# Maximum number of statements in function / method body
324+
max-statements=50
325+
326+
# Maximum number of parents for a class (see R0901).
327+
max-parents=7
328+
329+
# Maximum number of attributes for a class (see R0902).
330+
max-attributes=7
331+
332+
# Minimum number of public methods for a class (see R0903).
333+
min-public-methods=2
334+
335+
# Maximum number of public methods for a class (see R0904).
336+
max-public-methods=20
337+
338+
339+
[IMPORTS]
340+
341+
# Deprecated modules which should not be used, separated by a comma
342+
deprecated-modules=regsub,TERMIOS,Bastion,rexec
343+
344+
# Create a graph of every (i.e. internal and external) dependencies in the
345+
# given file (report RP0402 must not be disabled)
346+
import-graph=
347+
348+
# Create a graph of external dependencies in the given file (report RP0402 must
349+
# not be disabled)
350+
ext-import-graph=
351+
352+
# Create a graph of internal dependencies in the given file (report RP0402 must
353+
# not be disabled)
354+
int-import-graph=
355+
356+
357+
[EXCEPTIONS]
358+
359+
# Exceptions that will emit a warning when being caught. Defaults to
360+
# "Exception"
361+
overgeneral-exceptions=Exception

unittests/run_pylint

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# Get current directory
4+
DIRECTORY=$( cd "$( dirname "$0" )" && pwd )
5+
# Get parent directory
6+
DIR=${DIRECTORY%/*}
7+
8+
pylint --rcfile=$DIRECTORY"/pylint.cfg" $DIR/pygccxml/declarations

0 commit comments

Comments
 (0)