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
pyreverse
now 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-palette
option 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.vcg
output format (Visualaization ofCompiler Graphs) has been dropped.
Closes Deprecate / remove support for
.vcg
files 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.Exception
notException
). 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
MASTER
or
master
as configuration section insetup.cfg
ortox.ini
. It'sbad practice
to not start sections titles with the tool name. Please use
pylint.main
instead.
Refs [deprecation]
setup.cfg
andtox.ini
sections need to start by 'pylint' #8465New Features
Add new option (
--show-stdlib
,-L
) topyreverse
.This is similar to the behavior of
--show-builtin
in 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
asyncSetUp
to the defaultdefining-attr-methods
list to silenceattribute-defined-outside-init
warning when usingunittest.IsolatedAsyncioTestCase
.Refs Add Python 3.8+
asyncSetUp
to "defining-attr-methods" list #8403invalid-name
now allows for integers intypealias
names:Good2Name
,GoodName2
._1BadName
.Closes invalid-name check for TypeAlias should allow for digits in names #8485
No longer consider
Union
as type annotation as type alias for namingchecks.
Closes
invalid-name
type alias false-positive for union values #8487unnecessary-lambda
no 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-lambda
false positive if parameter is used in lambda body #8496Other Bug Fixes
--clear-cache-post-run
now 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_CHECKING
is used without importing it.Closes
in_type_checking_block
can crash if you haven't importedTYPE_CHECKING
#8434Fix a
used-before-assignment
false positive when importsare made under the
TYPE_CHECKING
else if branch.Closes
used-before-assignment
false positive for import nodes underelif
afterTYPE_CHECKING
#8437Fix a regression of
preferred-modules
where 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
optparse
config parsing. #8405Internal Changes
get_message_definition
was removed from the base checker API. You canaccess
message definitions through the
MessageStore
.Refs [deprecation] Remove
get_message_definitions
fromBaseChecker
#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
Interface
inpylint.interfaces
wereremoved.
Checker
should only inheritBaseChecker
or any of the other checkertypes
from
pylint.checkers
.Reporter
should only inheritBaseReporter
.Refs [__implements__] Remove everything related to the rejected PEP245 #8404
modname
andmsg_store
are now required to be given inFileState
.collect_block_lines
has also been removed.Pylinter.current_name
cannot 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_data
andreduce_map_data
.is_inside_lambda
: Useutils.get_node_first_ancestor_of_type(x, nodes.Lambda)
check_messages
: Useutils.only_required_for_messages
is_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_path
and pass source root(s).
fix_import_path
: Useaugmented_sys_path
and pass additionalsys.path
entries as an argument obtained from
discover_package_path
.get_global_option
: Usechecker.linter.config
to get all globaloptions.
Related private objects have been removed as well.
Refs Remove deprecated functions and classes #8409
colorize_ansi
now only accept aMessageStyle
object.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_block
and will be removed in pylint 3.0:
is_node_in_guarded_import_block
is_node_in_typing_guarded_import_block
is_typing_guard
is_sys_guard
is still available, which was part ofis_node_in_guarded_import_block
.Refs Deprecate redundant type checking guard utils #8433
Following a deprecation period,
Pylinter.check
now only work withsequences of strings, not strings.
Refs [deprecation] 'Pylinter.check' now takes sequence of str only #8463
Following a deprecation period,
ColorizedTextReporter
only acceptsColorMappingDict
.Refs [deprecation] 'ColorizedTextReporter' only accepts 'ColorMappingDict' #8464
Following a deprecation period,
MessageTest
'send_line
andend_col_offset
must 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_exit
argument of theRun
class(and of the
_Run
class in testutils) were removed.
Refs [deprecation] Remove 'do_exit' from the 'Run' constructor #8472
Following a deprecation period, the
py_version
argument of theMessageDefinition.may_be_emitted
function 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
OutputLine
class 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_block
andis_node_in_guarded_import_block
: frompylint.utils
were removed: usea combination of
is_sys_guard
andin_type_checking_block
instead.Refs [deprecation] Remove all duplicated typing guard check functions #8475
Following a deprecation period, the
location
argument of theMessage
class must now be aMessageLocationTuple
.Refs [deprecation] Message.location must be a 'MessageLocationTuple' #8477
Following a deprecation period, the
check_single_file
function of thePylinter
is replaced byPylinter.check_single_file_item
.Refs [deprecation] 'check_single_file' replaced by 'check_single_file_item' #8478