Skip to content

Commit 5ee69ce

Browse files
authored
Merge pull request #4 from stdedos/ci/pre-commit/config
2 parents ab07d5e + ff18b58 commit 5ee69ce

40 files changed

+784
-279
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Add `.pre-commit-config.yaml` + `pre-commit run -a`
2+
85d7e422b36fb86e22990ede8c92f7ec95ac43ec

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A clear and concise description of what the bug is.
1212

1313
**To Reproduce**
1414
Package versions
15-
- pylint
15+
- pylint
1616
- pytest
1717
- pylint-pytest
1818

.github/workflows/run-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
- name: Test with tox
5353
env:
5454
FORCE_COLOR: 1
55+
PYTEST_CI_ARGS: --cov-report=xml --cov-report=html --junitxml=test_artifacts/test_report.xml --color=yes
5556
run: tox ${{ matrix.python-version == '3.6' && '--skip-missing-interpreters=true' || '' }}
5657

5758
- name: Upload coverage reports to Codecov

.pre-commit-config.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
exclude: ^.idea/
7+
- id: trailing-whitespace
8+
- id: pretty-format-json
9+
args: [ "--no-sort-keys", "--autofix", "--indent=4" ]
10+
exclude: ^.vscode/
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v3.15.0
13+
hooks:
14+
- id: pyupgrade
15+
args:
16+
- --py36-plus
17+
- repo: https://github.com/PyCQA/autoflake
18+
rev: v2.2.1
19+
hooks:
20+
- id: autoflake
21+
# - repo: https://github.com/astral-sh/ruff-pre-commit
22+
# rev: v0.0.292
23+
# hooks:
24+
# - id: ruff
25+
- repo: https://github.com/pycqa/isort
26+
rev: 5.12.0
27+
hooks:
28+
- id: isort
29+
args:
30+
- --filter-files
31+
- repo: https://github.com/psf/black
32+
rev: 23.9.1
33+
hooks:
34+
- id: black
35+
- repo: https://github.com/asottile/blacken-docs
36+
rev: 1.16.0
37+
hooks:
38+
- id: blacken-docs
39+
additional_dependencies:
40+
- black==22.6.0
41+
- repo: https://github.com/pre-commit/pygrep-hooks
42+
rev: v1.10.0
43+
hooks:
44+
- id: python-use-type-annotations
45+
- id: python-check-blanket-noqa
46+
- id: python-check-blanket-type-ignore
47+
- id: python-check-mock-methods
48+
- id: python-no-eval
49+
- id: python-no-log-warn
50+
- id: python-use-type-annotations
51+
- id: rst-backticks
52+
- id: rst-directive-colons
53+
- id: rst-inline-touching-normal
54+
- id: text-unicode-replacement-char
55+
# - repo: https://github.com/pycqa/flake8
56+
# rev: 5.0.4
57+
# hooks:
58+
# - id: flake8
59+
# additional_dependencies:
60+
# - flake8-bandit
61+
# - flake8-bugbear
62+
# - flake8-class-attributes-order
63+
# - flake8-comprehensions
64+
# # - flake8-docstrings # it is a mess to clean up; let's only warn user's IDEs instead.
65+
# - flake8-future-annotations
66+
# - flake8-noqa
67+
# - flake8-print
68+
# - flake8-pyproject
69+
# - flake8-pytest-style
70+
# - flake8-type-checking
71+
# - flake8-variables-names
72+
# - pep8-naming
73+
# - repo: https://github.com/pre-commit/mirrors-mypy
74+
# rev: v1.6.0
75+
# hooks:
76+
# - id: mypy
77+
# - repo: local
78+
# hooks:
79+
# - id: pylint
80+
# name: pylint
81+
# entry: bash -c 'test -d .venv && . .venv/bin/activate ; pylint ${CI:+--reports=yes} "$@"' -
82+
# language: system
83+
# types: [ python ]
84+
# args:
85+
# - --disable=R,C

.pylintrc

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
[MASTER]
2+
3+
# A comma-separated list of package or module names from where C extensions may
4+
# be loaded. Extensions are loading into the active Python interpreter and may
5+
# run arbitrary code.
6+
extension-pkg-allow-list=jq
7+
8+
load-plugins=
9+
pylint_pytest,
10+
pylint.extensions.bad_builtin,
11+
pylint.extensions.broad_try_clause,
12+
pylint.extensions.check_elif,
13+
pylint.extensions.code_style,
14+
pylint.extensions.comparetozero,
15+
pylint.extensions.comparison_placement,
16+
pylint.extensions.confusing_elif,
17+
# pylint.extensions.consider_ternary_expression, # Not a pretty refactoring
18+
pylint.extensions.docparams,
19+
pylint.extensions.docstyle,
20+
pylint.extensions.emptystring,
21+
pylint.extensions.eq_without_hash,
22+
pylint.extensions.for_any_all,
23+
pylint.extensions.mccabe,
24+
pylint.extensions.no_self_use,
25+
pylint.extensions.overlapping_exceptions,
26+
pylint.extensions.redefined_loop_name,
27+
pylint.extensions.redefined_variable_type,
28+
pylint.extensions.typing,
29+
# pylint.extensions.while_used, # highly opinionated
30+
pylint.extensions.dict_init_mutate,
31+
pylint.extensions.dunder,
32+
pylint.extensions.typing,
33+
pylint.extensions.magic_value,
34+
35+
# Pickle collected data for later comparisons.
36+
persistent=yes
37+
38+
# When enabled, pylint would attempt to guess common misconfiguration and emit
39+
# user-friendly hints instead of false-positive error messages.
40+
suggestion-mode=yes
41+
42+
# Allow loading of arbitrary C extensions. Extensions are imported into the
43+
# active Python interpreter and may run arbitrary code.
44+
unsafe-load-any-extension=no
45+
46+
47+
[BASIC]
48+
49+
# Naming style matching correct argument names.
50+
argument-naming-style=snake_case
51+
52+
# Regular expression matching correct argument names. Overrides argument-
53+
# naming-style. If left empty, argument names will be checked with the set
54+
# naming style.
55+
#argument-rgx=
56+
57+
# Naming style matching correct attribute names.
58+
attr-naming-style=snake_case
59+
60+
# Regular expression matching correct attribute names. Overrides attr-naming-
61+
# style. If left empty, attribute names will be checked with the set naming
62+
# style.
63+
#attr-rgx=
64+
65+
# Bad variable names which should always be refused, separated by a comma.
66+
bad-names=foo,
67+
bar,
68+
baz,
69+
toto,
70+
tutu,
71+
tata
72+
73+
# Bad variable names regexes, separated by a comma. If names match any regex,
74+
# they will always be refused
75+
bad-names-rgxs=
76+
77+
# Naming style matching correct class attribute names.
78+
class-attribute-naming-style=any
79+
80+
# Regular expression matching correct class attribute names. Overrides class-
81+
# attribute-naming-style. If left empty, class attribute names will be checked
82+
# with the set naming style.
83+
#class-attribute-rgx=
84+
85+
# Naming style matching correct class constant names.
86+
class-const-naming-style=UPPER_CASE
87+
88+
# Regular expression matching correct class constant names. Overrides class-
89+
# const-naming-style. If left empty, class constant names will be checked with
90+
# the set naming style.
91+
#class-const-rgx=
92+
93+
# Naming style matching correct class names.
94+
class-naming-style=PascalCase
95+
96+
# Regular expression matching correct class names. Overrides class-naming-
97+
# style. If left empty, class names will be checked with the set naming style.
98+
#class-rgx=
99+
100+
# Naming style matching correct constant names.
101+
const-naming-style=UPPER_CASE
102+
103+
# Regular expression matching correct constant names. Overrides const-naming-
104+
# style. If left empty, constant names will be checked with the set naming
105+
# style.
106+
#const-rgx=
107+
108+
# Minimum line length for functions/classes that require docstrings, shorter
109+
# ones are exempt.
110+
docstring-min-length=4
111+
112+
# Naming style matching correct function names.
113+
function-naming-style=snake_case
114+
115+
# Regular expression matching correct function names. Overrides function-
116+
# naming-style. If left empty, function names will be checked with the set
117+
# naming style.
118+
#function-rgx=
119+
120+
# Good variable names which should always be accepted, separated by a comma.
121+
good-names=ex,Run,_,i,j,k, # Defaults
122+
rc, # Return variable of `subprocess.xxx` methods
123+
df, # Panda's DataFrame variable
124+
cd, # Method/Context function that does `cd`. `cwd` is not much better
125+
126+
# Good variable names regexes, separated by a comma. If names match any regex,
127+
# they will always be accepted
128+
good-names-rgxs=
129+
130+
# Include a hint for the correct naming format with invalid-name.
131+
include-naming-hint=no
132+
133+
# Naming style matching correct inline iteration names.
134+
inlinevar-naming-style=any
135+
136+
# Regular expression matching correct inline iteration names. Overrides
137+
# inlinevar-naming-style. If left empty, inline iteration names will be checked
138+
# with the set naming style.
139+
#inlinevar-rgx=
140+
141+
# Naming style matching correct method names.
142+
method-naming-style=snake_case
143+
144+
# Regular expression matching correct method names. Overrides method-naming-
145+
# style. If left empty, method names will be checked with the set naming style.
146+
#method-rgx=
147+
148+
# Naming style matching correct module names.
149+
module-naming-style=snake_case
150+
151+
# Regular expression matching correct module names. Overrides module-naming-
152+
# style. If left empty, module names will be checked with the set naming style.
153+
#module-rgx=
154+
155+
# Colon-delimited sets of names that determine each other's naming style when
156+
# the name regexes allow several styles.
157+
name-group=
158+
159+
# Regular expression which should only match function or class names that do
160+
# not require a docstring.
161+
no-docstring-rgx=^_
162+
163+
# List of decorators that produce properties, such as abc.abstractproperty. Add
164+
# to this list to register other decorators that produce valid properties.
165+
# These decorators are taken in consideration only for invalid-name.
166+
property-classes=abc.abstractproperty
167+
168+
# Regular expression matching correct type variable names. If left empty, type
169+
# variable names will be checked with the set naming style.
170+
#typevar-rgx=
171+
172+
# Naming style matching correct variable names.
173+
variable-naming-style=snake_case
174+
175+
# Regular expression matching correct variable names. Overrides variable-
176+
# naming-style. If left empty, variable names will be checked with the set
177+
# naming style.
178+
#variable-rgx=
179+
180+
181+
[DESIGN]
182+
183+
# Maximum number of arguments for function / method.
184+
max-args=7
185+
186+
# Argument names that match this expression will be ignored.
187+
# Defaults to name with leading underscore
188+
ignored-argument-names=_.*
189+
190+
191+
[FORMAT]
192+
193+
# Maximum number of characters on a single line.
194+
max-line-length=120
195+
196+
extension-pkg-allow-list=jq
197+
198+
199+
[LOGGING]
200+
201+
# The type of string formatting that logging methods do. `old` means using %
202+
# formatting, `new` is for `{}` formatting.
203+
logging-format-style=old
204+
205+
# Logging modules to check that the string format arguments are in logging
206+
# function parameter format.
207+
logging-modules=logging
208+
209+
210+
[MAGIC-VALUE]
211+
212+
# List of valid magic values that `magic-value-compare` will not detect.
213+
# Supports integers, floats, negative numbers, for empty string enter ``''``,
214+
# for backslash values just use one backslash e.g \n.
215+
valid-magic-values=0,-1,1,,__main__
216+
217+
218+
[MESSAGES CONTROL]
219+
220+
# Disable the message, report, category or checker with the given id(s). You
221+
# can either give multiple identifiers separated by comma (,) or put this
222+
# option multiple times (only on the command line, not in the configuration
223+
# file where it should appear only once). You can also use "--disable=all" to
224+
# disable everything first and then reenable specific checks. For example, if
225+
# you want to run only the similarities checker, you can use "--disable=all
226+
# --enable=similarities". If you want to run only the classes checker, but have
227+
# no Warning level messages displayed, use "--disable=all --enable=classes
228+
# --disable=W".
229+
disable=
230+
docstring-first-line-empty, # C0199
231+
232+
# Enable the message, report, category or checker with the given id(s). You can
233+
# either give multiple identifier separated by comma (,) or put this option
234+
# multiple time (only on the command line, not in the configuration file where
235+
# it should appear only once). See also the "--disable" option for examples.
236+
enable=
237+
useless-suppression
238+
239+
240+
[MISCELLANEOUS]
241+
242+
# List of note tags to take in consideration, separated by a comma.
243+
notes=FIXME,XXX,TODO
244+
245+
# Regular expression of note tags to take in consideration.
246+
#notes-rgx=
247+
248+
249+
[REFACTORING]
250+
251+
# Complete name of functions that never returns. When checking for
252+
# inconsistent-return-statements if a never returning function is called then
253+
# it will be considered as an explicit return statement and no message will be
254+
# printed.
255+
never-returning-functions=sys.exit,argparse.parse_error
256+
257+
258+
[REPORTS]
259+
260+
# Tells whether to display a full report or only the messages.
261+
reports=no
262+
263+
# Activate the evaluation score.
264+
score=yes
265+
266+
# Set the output format. Available formats are text, parseable, colorized, json
267+
# and msvs (visual studio). You can also give a reporter class, e.g.
268+
# mypackage.mymodule.MyReporterClass.
269+
output-format=colorized
270+
271+
272+
[SIMILARITIES]
273+
274+
# Minimum lines number of a similarity.
275+
min-similarity-lines=4
276+
277+
# Ignore comments when computing similarities.
278+
ignore-comments=no
279+
280+
# Ignore docstrings when computing similarities.
281+
ignore-docstrings=no
282+
283+
# Ignore signatures when computing similarities.
284+
ignore-signatures=yes

0 commit comments

Comments
 (0)