Skip to content

Commit d2c5f97

Browse files
committedMay 18, 2021
Update pre-commit setup
1 parent b793aa5 commit d2c5f97

File tree

3 files changed

+109
-65
lines changed

3 files changed

+109
-65
lines changed
 

‎.isort.cfg

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
[settings]
2-
line_length=80
3-
multi_line_output=3
4-
default_section=FIRSTPARTY
2+
profile=black

‎.pre-commit-config.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ repos:
1010
hooks:
1111
- id: black
1212
language_version: python3
13+
- repo: https://github.com/pycqa/isort
14+
rev: 5.8.0
15+
hooks:
16+
- id: isort
17+
name: isort (python)
18+
- id: isort
19+
name: isort (cython)
20+
types: [cython]
21+
- id: isort
22+
name: isort (pyi)
23+
types: [pyi]
24+
- repo: https://github.com/pycqa/pylint
25+
rev: v2.8.2
26+
hooks:
27+
- id: pylint

‎.pylintrc

+93-62
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
# A comma-separated list of package or module names from where C extensions may
44
# be loaded. Extensions are loading into the active Python interpreter and may
55
# run arbitrary code.
6+
extension-pkg-allow-list=
7+
8+
# A comma-separated list of package or module names from where C extensions may
9+
# be loaded. Extensions are loading into the active Python interpreter and may
10+
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
11+
# for backward compatibility.)
612
extension-pkg-whitelist=
713

8-
# Add files or directories to the blacklist. They should be base names, not
9-
# paths.
10-
ignore=native_client/kenlm
14+
# Specify a score threshold to be exceeded before program exits with error.
15+
fail-under=10.0
1116

12-
# Add files or directories matching the regex patterns to the blacklist. The
13-
# regex matches against base names, not paths.
17+
# Files or directories to be skipped. They should be base names, not paths.
18+
ignore=CVS
19+
20+
# Files or directories matching the regex patterns are skipped. The regex
21+
# matches against base names, not paths.
1422
ignore-patterns=
1523

1624
# Python code to execute, usually for sys.path manipulation such as
@@ -26,16 +34,13 @@ jobs=1
2634
# complex, nested conditions.
2735
limit-inference-results=100
2836

29-
# List of plugins (as comma separated values of python modules names) to load,
37+
# List of plugins (as comma separated values of python module names) to load,
3038
# usually to register additional checkers.
3139
load-plugins=
3240

3341
# Pickle collected data for later comparisons.
3442
persistent=yes
3543

36-
# Specify a configuration file.
37-
#rcfile=
38-
3944
# When enabled, pylint would attempt to guess common misconfiguration and emit
4045
# user-friendly hints instead of false-positive error messages.
4146
suggestion-mode=yes
@@ -60,16 +65,7 @@ confidence=
6065
# --enable=similarities". If you want to run only the classes checker, but have
6166
# no Warning level messages displayed, use "--disable=all --enable=classes
6267
# --disable=W".
63-
disable=missing-docstring,
64-
line-too-long,
65-
wrong-import-order,
66-
ungrouped-imports,
67-
wrong-import-position,
68-
import-error,
69-
no-name-in-module,
70-
no-member,
71-
unsubscriptable-object,
72-
print-statement,
68+
disable=print-statement,
7369
parameter-unpacking,
7470
unpacking-in-except,
7571
old-raise-syntax,
@@ -87,12 +83,6 @@ disable=missing-docstring,
8783
useless-suppression,
8884
deprecated-pragma,
8985
use-symbolic-message-instead,
90-
useless-object-inheritance,
91-
too-few-public-methods,
92-
too-many-branches,
93-
too-many-arguments,
94-
too-many-locals,
95-
too-many-statements,
9686
apply-builtin,
9787
basestring-builtin,
9888
buffer-builtin,
@@ -153,7 +143,8 @@ disable=missing-docstring,
153143
xreadlines-attribute,
154144
deprecated-sys-function,
155145
exception-escape,
156-
comprehension-escape
146+
comprehension-escape,
147+
format
157148

158149
# Enable the message, report, category or checker with the given id(s). You can
159150
# either give multiple identifier separated by comma (,) or put this option
@@ -164,11 +155,11 @@ enable=c-extension-no-member
164155

165156
[REPORTS]
166157

167-
# Python expression which should return a note less than 10 (10 is the highest
168-
# note). You have access to the variables errors warning, statement which
169-
# respectively contain the number of errors / warnings messages and the total
170-
# number of statements analyzed. This is used by the global evaluation report
171-
# (RP0004).
158+
# Python expression which should return a score less than or equal to 10. You
159+
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
160+
# which contain the number of messages in each category, as well as 'statement'
161+
# which is the total number of statements analyzed. This score is used by the
162+
# global evaluation report (RP0004).
172163
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
173164

174165
# Template used to display messages. This is a python new-style format string
@@ -196,13 +187,13 @@ max-nested-blocks=5
196187
# inconsistent-return-statements if a never returning function is called then
197188
# it will be considered as an explicit return statement and no message will be
198189
# printed.
199-
never-returning-functions=sys.exit
190+
never-returning-functions=sys.exit,argparse.parse_error
200191

201192

202193
[LOGGING]
203194

204-
# Format style used to check logging format string. `old` means using %
205-
# formatting, while `new` is for `{}` formatting.
195+
# The type of string formatting that logging methods do. `old` means using %
196+
# formatting, `new` is for `{}` formatting.
206197
logging-format-style=old
207198

208199
# Logging modules to check that the string format arguments are in logging
@@ -215,18 +206,22 @@ logging-modules=logging
215206
# Limits count of emitted suggestions for spelling mistakes.
216207
max-spelling-suggestions=4
217208

218-
# Spelling dictionary name. Available dictionaries: none. To make it working
219-
# install python-enchant package..
209+
# Spelling dictionary name. Available dictionaries: none. To make it work,
210+
# install the 'python-enchant' package.
220211
spelling-dict=
221212

213+
# List of comma separated words that should be considered directives if they
214+
# appear and the beginning of a comment and should not be checked.
215+
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
216+
222217
# List of comma separated words that should not be checked.
223218
spelling-ignore-words=
224219

225-
# A path to a file that contains private dictionary; one word per line.
220+
# A path to a file that contains the private dictionary; one word per line.
226221
spelling-private-dict-file=
227222

228-
# Tells whether to store unknown words to indicated private dictionary in
229-
# --spelling-private-dict-file option instead of raising a message.
223+
# Tells whether to store unknown words to the private dictionary (see the
224+
# --spelling-private-dict-file option) instead of raising a message.
230225
spelling-store-unknown-words=no
231226

232227

@@ -237,6 +232,9 @@ notes=FIXME,
237232
XXX,
238233
TODO
239234

235+
# Regular expression of note tags to take in consideration.
236+
#notes-rgx=
237+
240238

241239
[TYPECHECK]
242240

@@ -273,7 +271,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local
273271

274272
# List of module names for which member attributes should not be checked
275273
# (useful for modules/projects where namespaces are manipulated during runtime
276-
# and thus existing member attributes cannot be deduced by static analysis. It
274+
# and thus existing member attributes cannot be deduced by static analysis). It
277275
# supports qualified module names, as well as Unix pattern matching.
278276
ignored-modules=
279277

@@ -289,6 +287,9 @@ missing-member-hint-distance=1
289287
# showing a hint for a missing member.
290288
missing-member-max-choices=1
291289

290+
# List of decorators that change the signature of a decorated function.
291+
signature-mutators=
292+
292293

293294
[VARIABLES]
294295

@@ -299,6 +300,9 @@ additional-builtins=
299300
# Tells whether unused global variables should be treated as a violation.
300301
allow-global-unused-variables=yes
301302

303+
# List of names allowed to shadow builtins
304+
allowed-redefined-builtins=
305+
302306
# List of strings which can identify a callback function by name. A callback
303307
# name must start or end with one of those strings.
304308
callbacks=cb_,
@@ -341,13 +345,6 @@ max-line-length=100
341345
# Maximum number of lines in a module.
342346
max-module-lines=1000
343347

344-
# List of optional constructs for which whitespace checking is disabled. `dict-
345-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
346-
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
347-
# `empty-line` allows space-only lines.
348-
no-space-check=trailing-comma,
349-
dict-separator
350-
351348
# Allow the body of a class to be on the same line as the declaration if body
352349
# contains single statement.
353350
single-line-class-stmt=no
@@ -379,7 +376,7 @@ argument-naming-style=snake_case
379376

380377
# Regular expression matching correct argument names. Overrides argument-
381378
# naming-style.
382-
argument-rgx=[a-z_][a-z0-9_]{0,30}$
379+
#argument-rgx=
383380

384381
# Naming style matching correct attribute names.
385382
attr-naming-style=snake_case
@@ -389,7 +386,16 @@ attr-naming-style=snake_case
389386
#attr-rgx=
390387

391388
# Bad variable names which should always be refused, separated by a comma.
392-
bad-names=
389+
bad-names=foo,
390+
bar,
391+
baz,
392+
toto,
393+
tutu,
394+
tata
395+
396+
# Bad variable names regexes, separated by a comma. If names match any regex,
397+
# they will always be refused
398+
bad-names-rgxs=
393399

394400
# Naming style matching correct class attribute names.
395401
class-attribute-naming-style=any
@@ -398,6 +404,13 @@ class-attribute-naming-style=any
398404
# attribute-naming-style.
399405
#class-attribute-rgx=
400406

407+
# Naming style matching correct class constant names.
408+
class-const-naming-style=UPPER_CASE
409+
410+
# Regular expression matching correct class constant names. Overrides class-
411+
# const-naming-style.
412+
#class-const-rgx=
413+
401414
# Naming style matching correct class names.
402415
class-naming-style=PascalCase
403416

@@ -427,11 +440,14 @@ function-naming-style=snake_case
427440
good-names=i,
428441
j,
429442
k,
430-
x,
431443
ex,
432444
Run,
433445
_
434446

447+
# Good variable names regexes, separated by a comma. If names match any regex,
448+
# they will always be accepted
449+
good-names-rgxs=
450+
435451
# Include a hint for the correct naming format with invalid-name.
436452
include-naming-hint=no
437453

@@ -474,19 +490,26 @@ variable-naming-style=snake_case
474490

475491
# Regular expression matching correct variable names. Overrides variable-
476492
# naming-style.
477-
variable-rgx=[a-z_][a-z0-9_]{0,30}$
493+
#variable-rgx=
478494

479495

480496
[STRING]
481497

482-
# This flag controls whether the implicit-str-concat-in-sequence should
483-
# generate a warning on implicit string concatenation in sequences defined over
484-
# several lines.
498+
# This flag controls whether inconsistent-quotes generates a warning when the
499+
# character used as a quote delimiter is used inconsistently within a module.
500+
check-quote-consistency=no
501+
502+
# This flag controls whether the implicit-str-concat should generate a warning
503+
# on implicit string concatenation in sequences defined over several lines.
485504
check-str-concat-over-line-jumps=no
486505

487506

488507
[IMPORTS]
489508

509+
# List of modules that can be imported at any level, not just the top level
510+
# one.
511+
allow-any-import-level=
512+
490513
# Allow wildcard imports from modules that define __all__.
491514
allow-wildcard-with-all=no
492515

@@ -498,16 +521,17 @@ analyse-fallback-blocks=no
498521
# Deprecated modules which should not be used, separated by a comma.
499522
deprecated-modules=optparse,tkinter.tix
500523

501-
# Create a graph of external dependencies in the given file (report RP0402 must
502-
# not be disabled).
524+
# Output a graph (.gv or any supported image format) of external dependencies
525+
# to the given file (report RP0402 must not be disabled).
503526
ext-import-graph=
504527

505-
# Create a graph of every (i.e. internal and external) dependencies in the
506-
# given file (report RP0402 must not be disabled).
528+
# Output a graph (.gv or any supported image format) of all (i.e. internal and
529+
# external) dependencies to the given file (report RP0402 must not be
530+
# disabled).
507531
import-graph=
508532

509-
# Create a graph of internal dependencies in the given file (report RP0402 must
510-
# not be disabled).
533+
# Output a graph (.gv or any supported image format) of internal dependencies
534+
# to the given file (report RP0402 must not be disabled).
511535
int-import-graph=
512536

513537
# Force import order to recognize a module as part of the standard
@@ -517,13 +541,20 @@ known-standard-library=
517541
# Force import order to recognize a module as part of a third party library.
518542
known-third-party=enchant
519543

544+
# Couples of modules and preferred modules, separated by a comma.
545+
preferred-modules=
546+
520547

521548
[CLASSES]
522549

550+
# Warn about protected attribute access inside special methods
551+
check-protected-access-in-special-methods=no
552+
523553
# List of method names used to declare (i.e. assign) instance attributes.
524554
defining-attr-methods=__init__,
525555
__new__,
526-
setUp
556+
setUp,
557+
__post_init__
527558

528559
# List of member names, which should be excluded from the protected access
529560
# warning.
@@ -548,7 +579,7 @@ max-args=5
548579
# Maximum number of attributes for a class (see R0902).
549580
max-attributes=7
550581

551-
# Maximum number of boolean expressions in an if statement.
582+
# Maximum number of boolean expressions in an if statement (see R0916).
552583
max-bool-expr=5
553584

554585
# Maximum number of branch for function / method body.

0 commit comments

Comments
 (0)
Please sign in to comment.