gto
gto copied to clipboard
Update dependency pylint to <2.16
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| pylint (changelog) | <2.14 -> <2.16 |
Release Notes
PyCQA/pylint
v2.15.5
What's new in Pylint 2.15.5?
Release date: 2022-10-21
False Positives Fixed
-
Fix a false positive for
simplify-boolean-expressionwhen multiple values are inferred for a constant.Closes #β7626
Other Bug Fixes
-
Remove
__index__dunder method call fromunnecessary-dunder-callcheck.Closes #β6795
-
Fixed a multi-processing crash that prevents using any more than 1 thread on MacOS.
The returned module objects and errors that were cached by the linter plugin loader cannot be reliably pickled. This means that
dillwould throw an error when attempting to serialise the linter object for multi-processing use.Closes #β7635.
Other Changes
-
Add a keyword-only
compare_constantsargument tosafe_infer.Refs #β7626
-
Sort
--generated-rcfileoutput.Refs #β7655
v2.15.4
False Positives Fixed
-
Fix the message for
unnecessary-dunder-callfor__aiter__and__anext__. Also only emit the warning whenpy-version>= 3.10.Closes #β7529
Other Bug Fixes
-
Fix bug in detecting
unused-variablewhen iterating on variable.Closes #β3044
-
Fixed handling of
--as separator between positional arguments and flags. This was not actually fixed in 2.14.5. -
Report
no-self-argumentrather thanno-method-argumentfor methods with variadic arguments.Closes #β7507
-
Fixed an issue where
syntax-errorcouldn't be raised on files with invalid encodings.Closes #β7522
-
Fix false positive for
redefined-outer-namewhen aliasingtypinge.g. astand guarding imports undert.TYPE_CHECKING.Closes #β7524
-
Fixed a crash of the
modified_iteratingchecker when iterating on a set defined as a class attribute.Closes #β7528
-
Fix bug in scanning of names inside arguments to
typing.Literal. See https://peps.python.org/pep-0586/#literals-enums-and-forward-references for details.Refs #β3299
Other Changes
-
Add method name to the error messages of
no-method-argumentandno-self-argument.Closes #β7507
v2.15.3
-
Fixed a crash in the
unhashable-memberchecker when using alambdaas a dict key.Closes #β7453
-
Fix a crash in the
modified-iterating-dictchecker involving instance attributes.Closes #β7461
-
invalid-class-objectdoes not crash anymore when__class__is assigned alongside another variable.Closes #β7467
-
Fix false positive for
global-variable-not-assignedwhen a global variable is re-assigned via anImportFromnode.Closes #β4809
-
Fix false positive for
undefined-loop-variableinfor-elseloops that use a function having a return type annotation ofNoReturnorNever.Closes #β7311
-
--help-msgnow accepts a comma-separated list of message IDs again.Closes #β7471
v2.15.2
-
Fixed a case where custom plugins specified by command line could silently fail.
Specifically, if a plugin relies on the
init-hookoption changingsys.pathbefore it can be imported, this will now emit abad-plugin-valuemessage. Before this change, it would silently fail to register the plugin for use, but would load any configuration, which could have unintended effects.Fixes part of #β7264.
-
Fix
used-before-assignmentfor functions/classes defined in type checking guard.Closes #β7368
-
Update
modified_iteratingchecker to fix a crash withforloops on empty list.Closes #β7380
-
The
docparamsextension now considers typing in Numpy style docstrings as "documentation" for themissing-param-docmessage.Refs #β7398
-
Fix false positive for
unused-variableandunused-importwhen a name is only used in a string literal type annotation.Closes #β3299
-
Fix false positive for
too-many-function-argswhen a function call is assigned to a class attribute inside the class where the function is defined.Closes #β6592
-
Fix
used-before-assignmentfor functions/classes defined in type checking guard.Closes #β7368
-
Fix ignored files being linted when passed on stdin.
Closes #β4354
-
missing-return-doc,missing-raises-docandmissing-yields-docnow respect theno-docstring-rgxoption.Closes #β4743
-
Don't crash on
OSErrorin config file discovery.Closes #β7169
-
disable-nextis now correctly scoped to only the succeeding line.Closes #β7401
-
Update
modified_iteratingchecker to fix a crash withforloops on empty list.Closes #β7380
v2.15.0
In pylint 2.15.0, we added a new check missing-timeout to warn of default timeout values that could cause a program to be hanging indefinitely.
We improved pylint's handling of namespace packages. More packages should be linted without resorting to using the --recursive=y option.
We still welcome any community effort to help review, integrate, and add good/bad examples to the doc for https://github.com/PyCQA/pylint/issues/5953. This should be doable without any pylint or astroid knowledge, so this is the perfect entrypoint if you want to contribute to pylint or open source without any experience with our code!
Internally, we changed the way we generate the release notes, thanks to DudeNr33. There will be no more conflict resolution to do in the changelog, and every contributor rejoice.
Marc Byrne became a maintainer, welcome to the team !
New Checks
-
Added new checker
missing-timeoutto warn of default timeout values that could cause a program to be hanging indefinitely.Refs #β6780
False Positives Fixed
-
Don't report
super-init-not-calledfor abstract__init__methods.Closes #β3975
-
Don't report
unsupported-binary-operationon Python <= 3.9 when using the|operator with types, if one has a metaclass that overloads__or__or__ror__as appropriate.Closes #β4951
-
Don't report
no-value-for-parameterfor dataclasses fields annotated withKW_ONLY.Closes #β5767
-
Fixed inference of
Enumswhen they are imported under an alias.Closes #β5776
-
Prevent false positives when accessing
PurePath.parentsby index (not slice) on Python 3.10+.Closes #β5832
-
unnecessary-list-index-lookupis now more conservative to avoid potential false positives.Closes #β6896
-
Fix double emitting
trailing-whitespacefor multi-line docstrings.Closes #β6936
-
import-errornow correctly checks forcontextlib.suppressguards on import statements.Closes #β7270
-
Fix false positive for
no-self-argument/no-method-argumentwhen a staticmethod is applied to a function but uses a different name.Closes #β7300
-
Fix
undefined-loop-variablewithbreakandcontinuestatements inelseblocks.Refs #β7311
False Negatives Fixed
-
Emit
used-before-assignmentwhen relying on a name that is reimported later in a function.Closes #β4624
-
Emit
used-before-assignmentfor self-referencing named expressions (:=) lacking prior assignments.Closes #β5653
-
Emit
used-before-assignmentfor self-referencing assignments under if conditions.Closes #β6643
-
Emit
modified-iterating-listand analogous messages for dicts and sets when iterating literals, or when using thedelkeyword.Closes #β6648
-
Emit
used-before-assignmentwhen calling nested functions before assignment.Closes #β6812
-
Emit
nonlocal-without-bindingwhen a nonlocal name has been assigned at a later point in the same scope.Closes #β6883
-
Emit
using-constant-testwhen testing the truth value of a variable or call result holding a generator.Closes #β6909
-
Rename
unhashable-dict-keytounhashable-memberand emit when creating sets and dicts, not just when accessing dicts.
Other Bug Fixes
-
Fix a failure to lint packages with
__init__.pycontained in directories lacking__init__.py.Closes #β1667
-
Fixed a syntax-error crash that was not handled properly when the declared encoding of a file was
utf-9.Closes #β3860
-
Fix a crash in the
not-callablecheck when there is ambiguity whether an instance is being incorrectly provided to__new__().Closes #β7109
-
Fix crash when regex option raises a
re.errorexception.Closes #β7202
-
Fix
undefined-loop-variablefrom walrus in comprehension test.Closes #β7222
-
Check for
<cwd>before removing first item fromsys.pathinmodify_sys_path.Closes #β7231
-
Fix sys.path pollution in parallel mode.
Closes #β7246
-
Prevent
useless-parent-delegationfor delegating to a builtin written in C (e.g.Exception.__init__) with non-self arguments.Closes #β7319
Other Changes
-
bad-exception-contexthas been renamed tobad-exception-causeas it is about the cause and not the context.Closes #β3694
-
The message for
literal-comparisonis now more explicit about the problem and the solution.Closes #β5237
-
useless-super-delegationhas been renamed touseless-parent-delegationin order to be more generic.Closes #β6953
-
Pylint now uses
towncrierfor changelog generation.Refs #β6974
-
Update
astroidto 2.12.Refs #β7153
-
Fix crash when a type-annotated
__slots__with no value is declared.Closes #β7280
Internal Changes
-
Fixed an issue where it was impossible to update functional tests output when the existing output was impossible to parse. Instead of raising an error we raise a warning message and let the functional test fail with a default value.
Refs #β6891
-
pylint.testutils.primeris now a private API.Refs #β6905
-
We changed the way we handle the changelog internally by using towncrier. If you're a contributor you won't have to fix merge conflicts in the changelog anymore.
Closes #β6974
-
Pylint is now using Scorecards to implement security recommendations from the
OpenSSF <https://openssf.org/>_. This is done in order to secure our supply chains using a combination of automated tooling and best practices, most of which were already implemented before.Refs #β7267
v2.14.5
-
Fixed a crash in the
undefined-loop-variablecheck whenenumerate()is used in a ternary expression.Closes #β7131
-
Fixed handling of
--as separator between positional arguments and flags.Closes #β7003
-
Fixed the disabling of
fixmeand its interaction withuseless-suppression. -
Allow lists of default values in parameter documentation for
Numpystyle.Closes #β4035
v2.14.4
-
The
differing-param-doccheck was triggered by positional only arguments.Closes #β6950
-
Fixed an issue where scanning
.directory recursively with--ignore-path=^path/to/diris not ignoring thepath/to/dirdirectory.Closes #β6964
-
Fixed regression that didn't allow quoted
init-hooksin option files.Closes #β7006
-
Fixed a false positive for
modified-iterating-dictwhen updating an existing key.Closes #β6179
-
Fixed an issue where many-core Windows machines (>~60 logical processors) would hang when using the default jobs count.
Closes #β6965
-
Fixed an issue with the recognition of
setup.cfgfiles. Only.cfgfiles that are exactly namedsetup.cfgrequire section names that start withpylint..Closes #β3630
-
Don't report
import-private-namefor relative imports.Closes #β7078
v2.14.3
-
Fixed two false positives for
bad-super-callfor calls that refer to a non-direct parent. -
Fixed a false positive for
useless-super-delegationfor subclasses that specify the number of of parameters against a parent that uses a variadic argument.Closes #β2270
-
Allow suppressing
undefined-loop-variableandundefined-variablewithout raisinguseless-suppression. -
Fixed false positive for
undefined-variablefor__class__in inner methods.Closes #β4032
v2.14.2
-
Fixed a false positive for
unused-variablewhen a function returns anargparse.Namespaceobject.Closes #β6895
-
Avoided raising an identical
undefined-loop-variablemessage twice on the same line. -
Don't crash if
lint.run._query_cpu()is run within a Kubernetes Pod, that has only a fraction of a cpu core assigned. Just go with one process then.Closes #β6902
-
Fixed a false positive in
consider-using-f-stringif the left side of a%is not a string.Closes #β6689
-
Fixed a false positive in
unnecessary-list-index-lookupandunnecessary-dict-index-lookupwhen the subscript is updated in the body of a nested loop.Closes #β6818
-
Fixed an issue with multi-line
init-hookoptions which did not record the line endings.Closes #β6888
-
Fixed a false positive for
used-before-assignmentwhen a try block returns but an except handler defines a name via type annotation. -
--errors-onlyno longer enables previously disabled messages. It was acting as "emit all and only error messages" without being clearly documented that way.Closes #β6811
v2.14.1
-
Avoid reporting
unnecessary-dict-index-lookuporunnecessary-list-index-lookupwhen the index lookup is part of a destructuring assignment.Closes #β6788
-
Fixed parsing of unrelated options in
tox.ini.Closes #β6800
-
Fixed a crash when linting
__new__()methods that return a call expression.Closes #β6805
-
Don't crash if we can't find the user's home directory.
Closes #β6802
-
Fixed false positives for
unused-importwhen aliasingtypinge.g. astand guarding imports undert.TYPE_CHECKING.Closes #β3846
-
Fixed a false positive regression in 2.13 for
used-before-assignmentwhere it is safe to rely on a name defined only in anexceptblock because theelseblock returned.Closes #β6790
-
Fixed the use of abbreviations for some special options on the command line.
Closes #β6810
-
Fix a crash in the optional
pylint.extensions.private_importextension.Closes #β6624
-
bad-option-value(E0012) is now a warningunknown-option-value(W0012). Deleted messages that do not exist anymore in pylint now raiseuseless-option-value(R0022) instead ofbad-option-value. This allows to distinguish between genuine typos and configuration that could be cleaned up. Existing message disables forbad-option-valuewill still work on both new messages.Refs #β6794
v2.14.0
Summary -- Release highlights
With 2.14 pylint only supports Python version 3.7.2 and above.
We introduced several new checks among which duplicate-value for sets,
comparison-of-constants, and checks related to lambdas. We removed no-init and
made no-self-use optional as they were too opinionated. We also added an option
to generate a toml configuration: --generate-toml-config.
We migrated to argparse from optparse and refactored the configuration handling
thanks to DaniΓ«l van Noord. On the user side it should change the output of the
--help command, and some inconsistencies and bugs should disappear. The behavior
between options set in a config file versus on the command line will be more consistent. For us,
it will permit to maintain this part of the code easily in the future and anticipate
optparse's removal in Python 3.12.
As a result of the refactor there are a lot of internal deprecations. If you're a library maintainer that depends on pylint, please verify that you're ready for pylint 3.0 by activating deprecation warnings.
We continued the integration of pylint-error and are now at 33%!. We still welcome
any community effort to help review, integrate, and add good/bad examples in #β5953.
This should be doable without any pylint or astroid knowledge, so this is the perfect
entrypoint if you want to contribute to pylint or open source without any experience
with our code!
New checkers
-
Added new checker
comparison-of-constants.Closes #β6076
-
Added new checker
typevar-name-mismatch: TypeVar must be assigned to a variable with the same name as its name argument.Closes #β5224
-
invalid-enum-extension: Used when a class tries to extend an inherited Enum class.Closes #β5501
-
Added new checker
typevar-double-variance: The "covariant" and "contravariant" keyword arguments cannot both be set to "True" in a TypeVar.Closes #β5895
-
Add new check
unnecessary-dunder-callfor unnecessary dunder method calls.Closes #β5936
-
unnecessary-lambda-assignment: Lambda expression assigned to a variable. Define a function using the "def" keyword instead.unnecessary-direct-lambda-call: Lambda expression called directly. Execute the expression inline instead.Closes #β5976
-
potential-index-error: Emitted when the index of a list or tuple exceeds its length. This checker is currently quite conservative to avoid false positives. We welcome suggestions for improvements.Closes #β578
-
Added new checker
unnecessary-list-index-lookupfor indexing into a list while iterating overenumerate().Closes #β4525
-
Added new message called
duplicate-valuewhich identifies duplicate values inside sets.Closes #β5880
-
Added the
super-without-bracketschecker, raised when a super call is missing its brackets.Closes #β4008
Removed checkers
-
The
no-init(W0232) warning has been removed. It's ok to not have an__init__in a class.Closes #β2409
-
Removed the
assign-to-new-keywordmessage as there are no new keywords in the supported Python versions any longer.Closes #β4683
-
Moved
no-self-usecheck to optional extension. You now need to explicitly enable this check usingload-plugins=pylint.extensions.no_self_use.Closes #β5502
Extensions
-
RedefinedLoopNameChecker- Added optional extension
redefined-loop-nameto emit messages when a loop variable is redefined in the loop body.
Closes #β5072
- Added optional extension
-
DocStringStyleChecker- Re-enable checker
bad-docstring-quotesfor Python <= 3.7.
Closes #β6087
- Re-enable checker
-
NoSelfUseChecker- Added
no-self-usecheck, previously enabled by default.
Closes #β5502
- Added
Other Changes
-
Started ignoring underscore as a local variable for
too-many-locals.Closes #β6488
-
Pylint can now be installed with an extra-require called
spelling(pip install pylint[spelling]). This will addpyenchantto pylint's dependencies. You will still need to install the requirements forpyenchant(theenchantlibrary and any dictionaries) yourself. You will also need to set thespelling-dictoption.Refs #β6462
-
Improved wording of the message of
deprecated-moduleCloses #β6169
-
Pylintnow requires Python 3.7.2 or newer to run.Closes #β4301
-
We made a greater effort to reraise failures stemming from the
astroidlibrary asAstroidError, with the effect that pylint emitsastroid-errorrather than merelyfatal. Regardless, please report any such issues you encounter! -
We have improved our recognition of inline disable and enable comments. It is now possible to disable
bad-option-valueinline (as long as you disable it before the bad option value is raised, i.e.disable=bad-option-value,bad-messagenotdisable=bad-message,bad-option-value) as well as certain other previously unsupported messages.Closes #β3312
-
The main checker name is now
maininstead ofmaster. The configuration does not need to be updated as sections' name are optional.Closes #β5467
-
Update
invalid-slots-objectmessage to show bad object rather than its inferred value.Closes #β6101
-
Fixed a crash in the
not-an-iterablechecker involving multiple starred expressions inside a call.Closes #β6372
-
Fixed a crash in the
unused-private-memberchecker involving chained private attributes.Closes #β6709
-
Disable spellchecking of mypy rule names in ignore directives.
Closes #β5929
-
implicit-str-concatwill now be raised on calls likeopen("myfile.txt" "a+b")too.Closes #β6441
-
Fix a failure to respect inline disables for
fixmeoccurring on the last line of a module when pylint is launched with--enable=fixme. -
Removed the broken
generate-manoption. -
Fixed failure to enable
deprecated-moduleafter adisable=allby makingImportsCheckersolely responsible for emittingdeprecated-moduleinstead of sharing responsibility withStdlibChecker. (This could have led to double messages.) -
Added the
generate-toml-configoption.Refs #β5462
-
bad-option-valuewill be emitted whenever a configuration value or command line invocation includes an unknown message.Closes #β4324
-
Added the
unrecognized-optionmessage. Raised if we encounter any unrecognized options.Closes #β5259
-
Fix false negative for
bad-string-format-typeif the value to be formatted is passed in as a variable holding a constant. -
The concept of checker priority has been removed.
-
The
cache-max-size-nonechecker has been renamed tomethod-cache-max-size-none.Closes #β5670
-
The
method-cache-max-size-nonechecker will now also checkfunctools.cache.Closes #β5670
-
BaseCheckerclasses now require thelinterargument to be passed. -
The
set_config_directlydecorator has been removed. -
Don't report
useless-super-delegationfor the__hash__method in classes that also override the__eq__method.Closes #β3934
-
Fix falsely issuing
useless-suppressionon thewrong-import-positionchecker.Closes #β5219
-
Fixed false positive
no-memberfor Enums with self-defined members.Closes #β5138
-
Fix false negative for
no-memberwhen attempting to assign an instance attribute to itself without any prior assignment.Closes #β1555
-
Changed message type from
redefined-outer-nametoredefined-loop-name(optional extension) for redefinitions of outer loop variables by inner loops.Closes #β5608
-
By default the similarity checker will now ignore imports and ignore function signatures when computing duplication. If you want to keep the previous behaviour set
ignore-importsandignore-signaturestoFalse. -
Pylint now expands the user path (i.e.
~tohome/yusef/) and expands environment variables (i.e.home/$USER/$projecttohome/yusef/pylintforUSER=yusefandproject=pylint) for pyreverse'soutput-directory,import-graph,ext-import-graph,int-import-graphoptions, and the spell checker'sspelling-private-dict-fileoption.Refs #β6493
-
Don't emit
unsubscriptable-objectfor string annotations. Pylint doesn't check if class is only generic in type stubs only. -
Fix pyreverse crash
RuntimeError: dictionary changed size during iterationRefs #β6612
-
Fix syntax for return type annotations in MermaidJS diagrams produced with
pyreverse.Closes #β6467
-
Fix type annotations of class and instance attributes using the alternative union syntax in
pyreversediagrams. -
Fix bug where it writes a plain text error message to stdout, invalidating output formats.
Closes #β6597
-
The refactoring checker now also raises 'consider-using-a-generator' messages for
max(),min()andsum().Refs #β6595
-
Update ranges for
using-constant-testandmissing-parentheses-for-call-in-testerror messages. -
Don't emit
no-memberinside type annotations withfrom __future__ import annotations.Closes #β6594
-
Fix
unexpected-special-method-signaturefalse positive for__init_subclass__methods with one or more arguments.Closes #β6644
Deprecations
-
The
ignore-mixin-membersoption has been deprecated. You should now use the newignored-checks-for-mixinsoption.Closes #β5205
-
interfaces.implementshas been deprecated and will be removed in 3.0. Please use standard inheritance patterns instead of__implements__.Refs #β2287
-
All
Interfaceclasses inpylint.interfaceshave been deprecated. You can subclass the respective normal classes to get the same behaviour. The__implements__functionality was based on a rejected PEP from 2001: https://peps.python.org/pep-0245/Closes #β2287
-
MapReduceMixinhas been deprecated.BaseCheckernow implementsget_map_dataandreduce_map_data. If a checker actually needs to reduce data it should defineget_map_dataas returning something different thanNoneand let itsreduce_map_datahandle a list of the types returned byget_map_data. An example can be seen by looking atpylint/checkers/similar.py. -
The
configattribute ofBaseCheckerhas been deprecated. You can usechecker.linter.configto access the global configuration object instead of a checker-specific object.Refs #β5392
-
The
levelattribute ofBaseCheckerhas been deprecated: everything is now displayed in--help, all the time.Refs #β5392
-
The
set_optionmethod ofBaseCheckerhas been deprecated. You can usechecker.linter.set_optionto set an option on the global configuration object instead of a checker-specific object.Refs #β5392
-
The
options_providersattribute ofArgumentsManagerhas been deprecated.Refs #β5392
-
Fix saving of persistent data files in environments where the user's cache directory and the linted file are on a different drive.
Closes #β6394
-
The
method-cache-max-size-nonechecker will now also checkfunctools.cache. -
The
configattribute ofPyLinteris now of theargparse.Namespacetype instead ofoptparse.Values.Refs #β5392
-
UnsupportedActionhas been deprecated.Refs #β5392
-
OptionsManagerMixInhas been deprecated.Refs #β5392
-
OptionParserhas been deprecated.Refs #β5392
-
Optionhas been deprecated.Refs #β5392
-
OptionsProviderMixInhas been deprecated.Refs #β5392
-
ConfigurationMixInhas been deprecated. -
The
option_groupsattribute ofPyLinterhas been deprecated.Refs #β5392
-
get_global_confighas been deprecated. You can now access all global options fromchecker.linter.config.Refs #β5392
-
OptionsManagerMixInhas been replaced withArgumentsManager.ArgumentsManageris considered private API and most methods that were public onOptionsManagerMixInhave now been deprecated and will be removed in a future release.Refs #β5392
-
OptionsProviderMixInhas been replaced withArgumentsProvider.ArgumentsProvideris considered private API and most methods that were public onOptionsProviderMixInhave now been deprecated and will be removed in a future release.Refs #β5392
-
pylint.pyreverse.ASTWalkerhas been removed, as it was only used internally by a single child class.Refs #β6712
-
pyreverse: Resolving and displaying implemented interfaces that are defined by the__implements__attribute has been deprecated and will be removed in 3.0.Refs #β6713
-
is_class_subscriptable_pep585_with_postponed_evaluation_enabledhas been deprecated. Useis_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node)instead.Refs #β6536
Configuration
π Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
π¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
β» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by Mend Renovate. View repository job log here.
Codecov Report
Patch coverage has no change and project coverage change: -0.32% :warning:
Comparison is base (
73b1dfb) 85.36% compared to head (46d5299) 85.05%. Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #192 +/- ##
==========================================
- Coverage 85.36% 85.05% -0.32%
==========================================
Files 18 18
Lines 2125 2087 -38
==========================================
- Hits 1814 1775 -39
- Misses 311 312 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.