Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking Changes
pyreversenow uses a new default color palette that is more colorblindfriendly.
The color scheme is taken from
Paul Tol's Notes <https://personal.sron.nl/~pault/>_.If you prefer other colors, you can use the
--color-paletteoption tospecify custom colors.
Closes Use better default colors for
pyreverse#8251Everything related to the
__implements__construct was removed. It wasbased on PEP245
that was proposed in 2001 and rejected in 2006.
The capability from pyreverse to take
__implements__into account whengenerating diagrams
was also removed.
Refs [__implements__] Remove everything related to the rejected PEP245 #8404
pyreverse: Support for the.vcgoutput format (Visualaization ofCompiler Graphs) has been dropped.
Closes Deprecate / remove support for
.vcgfiles inpyreverse#8416The warning when the now useless old pylint cache directory (pylint.d) was
found was removed. The cache dir is documented in
the
FAQ.
Refs [deprecation] Remove the warning about the old pylint home #8462
Changes requiring user actions
epylint was removed. It now lives at:
https://github.com/emacsorphanage/pylint.
Refs Please consider maintaining the Emacs-Lisp files in a separate repository #7737
The 'overgeneral-exceptions' option now only takes fully qualified name
into account (
builtins.ExceptionnotException). If you overrodethis option, you need to use the fully qualified name now.
There's still a warning, but it will be removed in 3.1.0.
Refs [overgeneral-exceptions] Only handle qualified names #8411
Following a deprecation period, it's no longer possible to use
MASTERor
masteras configuration section insetup.cfgortox.ini. It'sbad practice
to not start sections titles with the tool name. Please use
pylint.maininstead.
Refs [deprecation]
setup.cfgandtox.inisections need to start by 'pylint' #8465New Features
Add new option (
--show-stdlib,-L) topyreverse.This is similar to the behavior of
--show-builtinin that standardlibrary
modules are now not included by default, and this option will include them.
Closes pyreverse: Add option to exclude standard library #8181
False Positives Fixed
Adds
asyncSetUpto the defaultdefining-attr-methodslist to silenceattribute-defined-outside-initwarning when usingunittest.IsolatedAsyncioTestCase.Refs Add Python 3.8+
asyncSetUpto "defining-attr-methods" list #8403invalid-namenow allows for integers intypealiasnames:Good2Name,GoodName2._1BadName.Closes invalid-name check for TypeAlias should allow for digits in names #8485
No longer consider
Unionas type annotation as type alias for namingchecks.
Closes
invalid-nametype alias false-positive for union values #8487unnecessary-lambdano longer warns on lambdas which use its parameters intheir body (other than the final arguments), e.g.
lambda foo: (bar if foo else baz)(foo).Closes
unnecessary-lambdafalse positive if parameter is used in lambda body #8496Other Bug Fixes
--clear-cache-post-runnow also clears LRU caches for pylint utilitiesholding references to AST nodes.
Closes Clear pylint's LRU caches when using
--clear-cache-post-run#8361Fix a crash when
TYPE_CHECKINGis used without importing it.Closes
in_type_checking_blockcan crash if you haven't importedTYPE_CHECKING#8434Fix a
used-before-assignmentfalse positive when importsare made under the
TYPE_CHECKINGelse if branch.Closes
used-before-assignmentfalse positive for import nodes underelifafterTYPE_CHECKING#8437Fix a regression of
preferred-moduleswhere a partial match was usedinstead of the required full match.
Closes v2.17.0 regression related to W0407: preferred-modules #8453
Other Changes
Pylint now exposes its type annotations.
Closes Expose types #5488 and Annotate pylint code with type annotations #2079
All code related to the optparse config parsing has been removed.
Refs Remove all old code related to
optparseconfig parsing. #8405Internal Changes
get_message_definitionwas removed from the base checker API. You canaccess
message definitions through the
MessageStore.Refs [deprecation] Remove
get_message_definitionsfromBaseChecker#8401Everything related to the
__implements__construct was removed. It wasbased on PEP245
that was proposed in 2001 and rejected in 2006.
All the classes inheriting
Interfaceinpylint.interfaceswereremoved.
Checkershould only inheritBaseCheckeror any of the other checkertypes
from
pylint.checkers.Reportershould only inheritBaseReporter.Refs [__implements__] Remove everything related to the rejected PEP245 #8404
modnameandmsg_storeare now required to be given inFileState.collect_block_lineshas also been removed.Pylinter.current_namecannot be null anymore.
Refs [FileState] Deprecation enactment for 3.0.0 #8407
'Reporter.set_output' was removed in favor of 'reporter.out = stream'.
Refs [Reporter] Remove 'set_output' in favor of reporter.out #8408
A number of old utility functions and classes have been removed:
MapReduceMixin: To make a checker reduce map data simply implementget_map_dataandreduce_map_data.is_inside_lambda: Useutils.get_node_first_ancestor_of_type(x, nodes.Lambda)check_messages: Useutils.only_required_for_messagesis_class_subscriptable_pep585_with_postponed_evaluation_enabled: Useis_postponed_evaluation_enabled(node)andis_node_in_type_annotation_context(node)get_python_path: assumption that there's always an init.py is nottrue since
python 3.3 and is causing problems, particularly with PEP 420. Use
discover_package_pathand pass source root(s).
fix_import_path: Useaugmented_sys_pathand pass additionalsys.pathentries as an argument obtained from
discover_package_path.get_global_option: Usechecker.linter.configto get all globaloptions.
Related private objects have been removed as well.
Refs Remove deprecated functions and classes #8409
colorize_ansinow only accept aMessageStyleobject.Refs [colorize_ansi] Remove the possibility to use anything else than a MessageStyle #8412
The following utilities are deprecated in favor of the more robust
in_type_checking_blockand will be removed in pylint 3.0:
is_node_in_guarded_import_blockis_node_in_typing_guarded_import_blockis_typing_guardis_sys_guardis still available, which was part ofis_node_in_guarded_import_block.Refs Deprecate redundant type checking guard utils #8433
Following a deprecation period,
Pylinter.checknow only work withsequences of strings, not strings.
Refs [deprecation] 'Pylinter.check' now takes sequence of str only #8463
Following a deprecation period,
ColorizedTextReporteronly acceptsColorMappingDict.Refs [deprecation] 'ColorizedTextReporter' only accepts 'ColorMappingDict' #8464
Following a deprecation period,
MessageTest'send_lineandend_col_offsetmust be accurate in functional tests (for python 3.8 or above on cpython, and
for
python 3.9 or superior on pypy).
Refs [deprecation] end_line and end_col_offset required in functional tests #8466
Following a deprecation period, the
do_exitargument of theRunclass(and of the
_Runclass in testutils) were removed.
Refs [deprecation] Remove 'do_exit' from the 'Run' constructor #8472
Following a deprecation period, the
py_versionargument of theMessageDefinition.may_be_emittedfunction is now required. The mostlikely solution
is to use 'linter.config.py_version' if you need to keep using this
function, or to use 'MessageDefinition.is_message_enabled' instead.
Refs [deprecation] Make 'py_version' required for 'MessageDefinition.may_be_emitted' #8473
Following a deprecation period, the
OutputLineclass now requiresthe right number of argument all the time. The functional output can be
regenerated automatically to achieve that easily.
Refs [deprecation] Make 'OutputLine' require a fixed number of args #8474
Following a deprecation period,
is_typing_guard,is_node_in_typing_guarded_import_blockandis_node_in_guarded_import_block: frompylint.utilswere removed: usea combination of
is_sys_guardandin_type_checking_blockinstead.Refs [deprecation] Remove all duplicated typing guard check functions #8475
Following a deprecation period, the
locationargument of theMessageclass must now be aMessageLocationTuple.Refs [deprecation] Message.location must be a 'MessageLocationTuple' #8477
Following a deprecation period, the
check_single_filefunction of thePylinteris replaced byPylinter.check_single_file_item.Refs [deprecation] 'check_single_file' replaced by 'check_single_file_item' #8478