Skip to content

Commit 1a2c658

Browse files
committed
Added a PyLint Action
1 parent eb8b816 commit 1a2c658

2 files changed

Lines changed: 329 additions & 0 deletions

File tree

.github/linters/.python-lint.yml

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
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+
disable=F0401,W0141,W0611,W0110,W0703,W0142
42+
43+
44+
[REPORTS]
45+
46+
# Set the output format. Available formats are text, parseable, colorized, msvs
47+
# (visual studio) and html. You can also give a reporter class, eg
48+
# mypackage.mymodule.MyReporterClass.
49+
output-format=text
50+
51+
# Put messages in a separate file for each module / package specified on the
52+
# command line instead of printing them on stdout. Reports (if any) will be
53+
# written in a file name "pylint_global.[txt|html]".
54+
files-output=no
55+
56+
# Tells whether to display a full report or only the messages
57+
reports=yes
58+
59+
# Python expression which should return a note less than 10 (10 is the highest
60+
# note). You have access to the variables errors warning, statement which
61+
# respectively contain the number of errors / warnings messages and the total
62+
# number of statements analyzed. This is used by the global evaluation report
63+
# (RP0004).
64+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
65+
66+
# Add a comment according to your evaluation note. This is used by the global
67+
# evaluation report (RP0004).
68+
comment=no
69+
70+
# Template used to display messages. This is a python new-style format string
71+
# used to format the massage information. See doc for all details
72+
#msg-template=
73+
74+
75+
[BASIC]
76+
77+
# Required attributes for module, separated by a comma
78+
required-attributes=
79+
80+
# List of builtins function names that should not be used, separated by a comma
81+
bad-functions=map,filter,apply,input
82+
83+
# Regular expression which should only match correct module names
84+
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
85+
86+
# Regular expression which should only match correct module level names
87+
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
88+
89+
# Regular expression which should only match correct class names
90+
class-rgx=[A-Z_][a-zA-Z0-9]+$
91+
92+
# Regular expression which should only match correct function names
93+
function-rgx=[a-z_][a-z0-9_]{2,30}$
94+
95+
# Regular expression which should only match correct method names
96+
method-rgx=[a-z_][a-z0-9_]{2,30}$
97+
98+
# Regular expression which should only match correct instance attribute names
99+
attr-rgx=[a-z_][a-z0-9_]{2,30}$
100+
101+
# Regular expression which should only match correct argument names
102+
argument-rgx=[a-z_][a-z0-9_]{2,30}$
103+
104+
# Regular expression which should only match correct variable names
105+
variable-rgx=[a-z_][a-z0-9_]{2,30}$
106+
107+
# Regular expression which should only match correct attribute names in class
108+
# bodies
109+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
110+
111+
# Regular expression which should only match correct list comprehension /
112+
# generator expression variable names
113+
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
114+
115+
# Good variable names which should always be accepted, separated by a comma
116+
good-names=i,j,k,ex,Run,_
117+
118+
# Bad variable names which should always be refused, separated by a comma
119+
bad-names=foo,bar,baz,toto,tutu,tata
120+
121+
# Regular expression which should only match function or class names that do
122+
# not require a docstring.
123+
no-docstring-rgx=__.*__
124+
125+
# Minimum line length for functions/classes that require docstrings, shorter
126+
# ones are exempt.
127+
docstring-min-length=-1
128+
129+
130+
[VARIABLES]
131+
132+
# Tells whether we should check for unused import in __init__ files.
133+
init-import=no
134+
135+
# A regular expression matching the beginning of the name of dummy variables
136+
# (i.e. not used).
137+
dummy-variables-rgx=_|dummy
138+
139+
# List of additional names supposed to be defined in builtins. Remember that
140+
# you should avoid to define new builtins when possible.
141+
additional-builtins=
142+
143+
144+
[SIMILARITIES]
145+
146+
# Minimum lines number of a similarity.
147+
min-similarity-lines=4
148+
149+
# Ignore comments when computing similarities.
150+
ignore-comments=yes
151+
152+
# Ignore docstrings when computing similarities.
153+
ignore-docstrings=yes
154+
155+
# Ignore imports when computing similarities.
156+
ignore-imports=no
157+
158+
159+
[MISCELLANEOUS]
160+
161+
# List of note tags to take in consideration, separated by a comma.
162+
notes=FIXME,XXX,TODO
163+
164+
165+
[FORMAT]
166+
167+
# Maximum number of characters on a single line.
168+
max-line-length=80
169+
170+
# Regexp for a line that is allowed to be longer than the limit.
171+
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
172+
173+
# Maximum number of lines in a module
174+
max-module-lines=1000
175+
176+
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
177+
# tab).
178+
indent-string=' '
179+
180+
181+
[TYPECHECK]
182+
183+
# Tells whether missing members accessed in mixin class should be ignored. A
184+
# mixin class is detected if its name ends with "mixin" (case insensitive).
185+
ignore-mixin-members=yes
186+
187+
# List of classes names for which member attributes should not be checked
188+
# (useful for classes with attributes dynamically set).
189+
ignored-classes=SQLObject
190+
191+
# When zope mode is activated, add a predefined set of Zope acquired attributes
192+
# to generated-members.
193+
zope=no
194+
195+
# List of members which are set dynamically and missed by pylint inference
196+
# system, and so shouldn't trigger E0201 when accessed. Python regular
197+
# expressions are accepted.
198+
generated-members=REQUEST,acl_users,aq_parent
199+
200+
201+
[IMPORTS]
202+
203+
# Deprecated modules which should not be used, separated by a comma
204+
deprecated-modules=regsub,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+
[DESIGN]
220+
221+
# Maximum number of arguments for function / method
222+
max-args=5
223+
224+
# Argument names that match this expression will be ignored. Default to name
225+
# with leading underscore
226+
ignored-argument-names=_.*
227+
228+
# Maximum number of locals for function / method body
229+
max-locals=15
230+
231+
# Maximum number of return / yield for function / method body
232+
max-returns=6
233+
234+
# Maximum number of branch for function / method body
235+
max-branches=12
236+
237+
# Maximum number of statements in function / method body
238+
max-statements=50
239+
240+
# Maximum number of parents for a class (see R0901).
241+
max-parents=7
242+
243+
# Maximum number of attributes for a class (see R0902).
244+
max-attributes=7
245+
246+
# Minimum number of public methods for a class (see R0903).
247+
min-public-methods=2
248+
249+
# Maximum number of public methods for a class (see R0904).
250+
max-public-methods=20
251+
252+
253+
[CLASSES]
254+
255+
# List of interface methods to ignore, separated by a comma. This is used for
256+
# instance to not check methods defines in Zope's Interface base class.
257+
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
258+
259+
# List of method names used to declare (i.e. assign) instance attributes.
260+
defining-attr-methods=__init__,__new__,setUp
261+
262+
# List of valid names for the first argument in a class method.
263+
valid-classmethod-first-arg=cls
264+
265+
# List of valid names for the first argument in a metaclass class method.
266+
valid-metaclass-classmethod-first-arg=mcs
267+
268+
269+
[EXCEPTIONS]
270+
271+
# Exceptions that will emit a warning when being caught. Defaults to
272+
# "Exception"
273+
overgeneral-exceptions=Exception

.github/workflows/py_lint.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
###########################
2+
###########################
3+
## Linter GitHub Actions ##
4+
###########################
5+
###########################
6+
name: Lint Code Base
7+
8+
#
9+
# Documentation:
10+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
11+
#
12+
13+
#############################
14+
# Start the job on all push #
15+
#############################
16+
on:
17+
pull_request:
18+
branches: [master]
19+
20+
###############
21+
# Set the Job #
22+
###############
23+
jobs:
24+
build:
25+
# Name the Job
26+
name: Lint Code Base
27+
# Set the agent to run on
28+
runs-on: ubuntu-latest
29+
30+
##################
31+
# Load all steps #
32+
##################
33+
steps:
34+
35+
##########################
36+
# Checkout the code base #
37+
##########################
38+
- name: Checkout Code
39+
uses: actions/checkout@v2
40+
with:
41+
# Full git history is needed to get a proper list of changed files within `super-linter`
42+
fetch-depth: 0
43+
44+
################################
45+
# Run Linter against code base #
46+
################################
47+
- name: Lint Code Base
48+
uses: github/super-linter@v3
49+
env:
50+
VALIDATE_ALL_CODEBASE: true
51+
VALIDATE_PYTHON: true
52+
VALIDATE_PYTHON_PYLINT: true
53+
DEFAULT_BRANCH: master
54+
LINTER_RULES_PATH: /.github/linters
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
PYTHON_PYLINT_CONFIG_FILE: .python-lint

0 commit comments

Comments
 (0)