Skip to content

Commit d5c66af

Browse files
committed
Update Pylint version in dependency list; update linting rules; adjust module.
1 parent 441a462 commit d5c66af

File tree

4 files changed

+106
-84
lines changed

4 files changed

+106
-84
lines changed

.pylintrc

Lines changed: 102 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# only in one or another interpreter, leading to false positives when analysed.
66
analyse-fallback-blocks=no
77

8+
# Clear in-memory caches upon conclusion of linting. Useful if running pylint
9+
# in a server-like mode.
10+
clear-cache-post-run=no
11+
812
# Load and enable all available extensions. Use --list-extensions to see a list
913
# all available extensions.
1014
#enable-all-extensions=
@@ -34,7 +38,7 @@ extension-pkg-whitelist=
3438
# specified are enabled, while categories only check already-enabled messages.
3539
fail-on=
3640

37-
# Specify a score threshold to be exceeded before program exits with error.
41+
# Specify a score threshold under which the program will exit with error.
3842
fail-under=10
3943

4044
# Interpret the stdin as a python script, whose filename needs to be passed as
@@ -44,13 +48,15 @@ fail-under=10
4448
# Files or directories to be skipped. They should be base names, not paths.
4549
ignore=CVS
4650

47-
# Add files or directories matching the regex patterns to the ignore-list. The
48-
# regex matches against paths and can be in Posix or Windows format.
51+
# Add files or directories matching the regular expressions patterns to the
52+
# ignore-list. The regex matches against paths and can be in Posix or Windows
53+
# format. Because '\\' represents the directory delimiter on Windows systems,
54+
# it can't be used as an escape character.
4955
ignore-paths=
5056

51-
# Files or directories matching the regex patterns are skipped. The regex
52-
# matches against base names, not paths. The default value ignores Emacs file
53-
# locks
57+
# Files or directories matching the regular expression patterns are skipped.
58+
# The regex matches against base names, not paths. The default value ignores
59+
# Emacs file locks
5460
ignore-patterns=^\.#
5561

5662
# List of module names for which member attributes should not be checked
@@ -64,7 +70,8 @@ ignored-modules=
6470
#init-hook=
6571

6672
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
67-
# number of processors available to use.
73+
# number of processors available to use, and will cap the count on Windows to
74+
# avoid hangs.
6875
jobs=1
6976

7077
# Control the amount of potential inferred values when inferring a single
@@ -86,6 +93,12 @@ py-version=3.10
8693
# Discover python modules and packages in the file system subtree.
8794
recursive=no
8895

96+
# Add paths to the list of the source roots. Supports globbing patterns. The
97+
# source root is an absolute path or a path relative to the current working
98+
# directory used to determine a package namespace for modules located under the
99+
# source root.
100+
source-roots=
101+
89102
# When enabled, pylint would attempt to guess common misconfiguration and emit
90103
# user-friendly hints instead of false-positive error messages.
91104
suggestion-mode=yes
@@ -98,67 +111,6 @@ unsafe-load-any-extension=no
98111
#verbose=
99112

100113

101-
[REPORTS]
102-
103-
# Python expression which should return a score less than or equal to 10. You
104-
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
105-
# 'convention', and 'info' which contain the number of messages in each
106-
# category, as well as 'statement' which is the total number of statements
107-
# analyzed. This score is used by the global evaluation report (RP0004).
108-
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
109-
110-
# Template used to display messages. This is a python new-style format string
111-
# used to format the message information. See doc for all details.
112-
msg-template=
113-
114-
# Set the output format. Available formats are text, parseable, colorized, json
115-
# and msvs (visual studio). You can also give a reporter class, e.g.
116-
# mypackage.mymodule.MyReporterClass.
117-
#output-format=
118-
119-
# Tells whether to display a full report or only the messages.
120-
reports=no
121-
122-
# Activate the evaluation score.
123-
score=yes
124-
125-
126-
[MESSAGES CONTROL]
127-
128-
# Only show warnings with the listed confidence levels. Leave empty to show
129-
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
130-
# UNDEFINED.
131-
confidence=HIGH,
132-
CONTROL_FLOW,
133-
INFERENCE,
134-
INFERENCE_FAILURE,
135-
UNDEFINED
136-
137-
# Disable the message, report, category or checker with the given id(s). You
138-
# can either give multiple identifiers separated by comma (,) or put this
139-
# option multiple times (only on the command line, not in the configuration
140-
# file where it should appear only once). You can also use "--disable=all" to
141-
# disable everything first and then re-enable specific checks. For example, if
142-
# you want to run only the similarities checker, you can use "--disable=all
143-
# --enable=similarities". If you want to run only the classes checker, but have
144-
# no Warning level messages displayed, use "--disable=all --enable=classes
145-
# --disable=W".
146-
disable=raw-checker-failed,
147-
bad-inline-option,
148-
locally-disabled,
149-
file-ignored,
150-
suppressed-message,
151-
useless-suppression,
152-
deprecated-pragma,
153-
use-symbolic-message-instead
154-
155-
# Enable the message, report, category or checker with the given id(s). You can
156-
# either give multiple identifier separated by comma (,) or put this option
157-
# multiple time (only on the command line, not in the configuration file where
158-
# it should appear only once). See also the "--disable" option for examples.
159-
enable=c-extension-no-member
160-
161-
162114
[BASIC]
163115

164116
# Naming style matching correct argument names.
@@ -282,6 +234,10 @@ no-docstring-rgx=^_
282234
# These decorators are taken in consideration only for invalid-name.
283235
property-classes=abc.abstractproperty
284236

237+
# Regular expression matching correct type alias names. If left empty, type
238+
# alias names will be checked with the set naming style.
239+
#typealias-rgx=
240+
285241
# Regular expression matching correct type variable names. If left empty, type
286242
# variable names will be checked with the set naming style.
287243
#typevar-rgx=
@@ -304,21 +260,18 @@ check-protected-access-in-special-methods=no
304260
defining-attr-methods=__init__,
305261
__new__,
306262
setUp,
263+
asyncSetUp,
307264
__post_init__
308265

309266
# List of member names, which should be excluded from the protected access
310267
# warning.
311-
exclude-protected=_asdict,
312-
_fields,
313-
_replace,
314-
_source,
315-
_make
268+
exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
316269

317270
# List of valid names for the first argument in a class method.
318271
valid-classmethod-first-arg=cls
319272

320273
# List of valid names for the first argument in a metaclass class method.
321-
valid-metaclass-classmethod-first-arg=cls
274+
valid-metaclass-classmethod-first-arg=mcs
322275

323276

324277
[DESIGN]
@@ -365,8 +318,7 @@ min-public-methods=2
365318
[EXCEPTIONS]
366319

367320
# Exceptions that will emit a warning when caught.
368-
overgeneral-exceptions=BaseException,
369-
Exception
321+
overgeneral-exceptions=builtins.BaseException,builtins.Exception
370322

371323

372324
[FORMAT]
@@ -405,6 +357,9 @@ single-line-if-stmt=no
405357
# one.
406358
allow-any-import-level=
407359

360+
# Allow explicit reexports by alias from a package __init__.
361+
allow-reexport-from-package=no
362+
408363
# Allow wildcard imports from modules that define __all__.
409364
allow-wildcard-with-all=no
410365

@@ -446,6 +401,49 @@ logging-format-style=old
446401
logging-modules=logging
447402

448403

404+
[MESSAGES CONTROL]
405+
406+
# Only show warnings with the listed confidence levels. Leave empty to show
407+
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
408+
# UNDEFINED.
409+
confidence=HIGH,
410+
CONTROL_FLOW,
411+
INFERENCE,
412+
INFERENCE_FAILURE,
413+
UNDEFINED
414+
415+
# Disable the message, report, category or checker with the given id(s). You
416+
# can either give multiple identifiers separated by comma (,) or put this
417+
# option multiple times (only on the command line, not in the configuration
418+
# file where it should appear only once). You can also use "--disable=all" to
419+
# disable everything first and then re-enable specific checks. For example, if
420+
# you want to run only the similarities checker, you can use "--disable=all
421+
# --enable=similarities". If you want to run only the classes checker, but have
422+
# no Warning level messages displayed, use "--disable=all --enable=classes
423+
# --disable=W".
424+
disable=raw-checker-failed,
425+
bad-inline-option,
426+
locally-disabled,
427+
file-ignored,
428+
suppressed-message,
429+
useless-suppression,
430+
deprecated-pragma,
431+
use-symbolic-message-instead
432+
433+
# Enable the message, report, category or checker with the given id(s). You can
434+
# either give multiple identifier separated by comma (,) or put this option
435+
# multiple time (only on the command line, not in the configuration file where
436+
# it should appear only once). See also the "--disable" option for examples.
437+
enable=c-extension-no-member
438+
439+
440+
[METHOD_ARGS]
441+
442+
# List of qualified names (i.e., library.method) which require a timeout
443+
# parameter e.g. 'requests.api.get,requests.api.post'
444+
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
445+
446+
449447
[MISCELLANEOUS]
450448

451449
# List of note tags to take in consideration, separated by a comma.
@@ -469,6 +467,31 @@ max-nested-blocks=5
469467
never-returning-functions=sys.exit,argparse.parse_error
470468

471469

470+
[REPORTS]
471+
472+
# Python expression which should return a score less than or equal to 10. You
473+
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
474+
# 'convention', and 'info' which contain the number of messages in each
475+
# category, as well as 'statement' which is the total number of statements
476+
# analyzed. This score is used by the global evaluation report (RP0004).
477+
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
478+
479+
# Template used to display messages. This is a python new-style format string
480+
# used to format the message information. See doc for all details.
481+
msg-template=
482+
483+
# Set the output format. Available formats are text, parseable, colorized, json
484+
# and msvs (visual studio). You can also give a reporter class, e.g.
485+
# mypackage.mymodule.MyReporterClass.
486+
#output-format=
487+
488+
# Tells whether to display a full report or only the messages.
489+
reports=no
490+
491+
# Activate the evaluation score.
492+
score=yes
493+
494+
472495
[SIMILARITIES]
473496

474497
# Comments are removed from the similarity computation
@@ -492,8 +515,8 @@ min-similarity-lines=4
492515
# Limits count of emitted suggestions for spelling mistakes.
493516
max-spelling-suggestions=4
494517

495-
# Spelling dictionary name. Available dictionaries: none. To make it work,
496-
# install the 'python-enchant' package.
518+
# Spelling dictionary name. No available dictionaries : You need to install
519+
# both the python package and the system dependency for enchant to work..
497520
spelling-dict=
498521

499522
# List of comma separated words that should be considered directives if they
@@ -597,8 +620,7 @@ callbacks=cb_,
597620
# not be used).
598621
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
599622

600-
# Argument names that match this expression will be ignored. Default to name
601-
# with leading underscore.
623+
# Argument names that match this expression will be ignored.
602624
ignored-argument-names=_.*|^ignored_|^unused_
603625

604626
# Tells whether we should check for unused import in __init__ files.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Alternatively, all unit tests are included in the module itself and can be execu
152152

153153
python src/modulo/modulo.py -v
154154

155-
Style conventions are enforced using `Pylint <https://pylint.pycqa.org>`__::
155+
Style conventions are enforced using `Pylint <https://pylint.readthedocs.io>`__::
156156

157157
python -m pip install .[lint]
158158
python -m pylint src/modulo

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test = [
3131
"pytest-cov~=3.0"
3232
]
3333
lint = [
34-
"pylint~=2.14.0"
34+
"pylint~=2.17.0"
3535
]
3636
coveralls = [
3737
"coveralls~=3.3.1"

src/modulo/modulo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class _symbol(type): # pylint: disable=invalid-name # Private/internal class.
1414
Metaclass to enable the use of a class as a mathematical symbol within
1515
expressions.
1616
"""
17-
def __new__(cls, clsname, bases, attrs):
18-
return super(_symbol, cls).__new__(cls, clsname, bases, attrs)
17+
def __new__(mcs, clsname, bases, attrs):
18+
return super(_symbol, mcs).__new__(mcs, clsname, bases, attrs)
1919

2020
def __rmul__(cls: _symbol, other: int) -> modulo:
2121
"""

0 commit comments

Comments
 (0)