PyCQA/pylint
### [`v2.15.4`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.4)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.15.3...v2.15.4)
## False Positives Fixed
- Fix the message for `unnecessary-dunder-call` for `__aiter__` and
`__aneext__`. Also
only emit the warning when `py-version` >= 3.10.
Closes [#7529](https://togithub.com/PyCQA/pylint/issues/7529)
## Other Bug Fixes
- Fix bug in detecting `unused-variable` when iterating on variable.
Closes [#3044](https://togithub.com/PyCQA/pylint/issues/3044)
- Fixed handling of `--` as separator between positional arguments and flags.
This was not actually fixed in 2.14.5.
Closes [#7003](https://togithub.com/PyCQA/pylint/issues/7003), Refs [#7096](https://togithub.com/PyCQA/pylint/issues/7096)
- Report `no-self-argument` rather than `no-method-argument` for methods
with variadic arguments.
Closes [#7507](https://togithub.com/PyCQA/pylint/issues/7507)
- Fixed an issue where `syntax-error` couldn't be raised on files with
invalid encodings.
Closes [#7522](https://togithub.com/PyCQA/pylint/issues/7522)
- Fix false positive for `redefined-outer-name` when aliasing `typing`
e.g. as `t` and guarding imports under `t.TYPE_CHECKING`.
Closes [#7524](https://togithub.com/PyCQA/pylint/issues/7524)
- Fixed a crash of the `modified_iterating` checker when iterating on a set
defined as a class attribute.
Closes [#7528](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/3299)
## Other Changes
- Add method name to the error messages of `no-method-argument` and
`no-self-argument`.
Closes [#7507](https://togithub.com/PyCQA/pylint/issues/7507)
### [`v2.15.3`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.3)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.15.2...v2.15.3)
- Fixed a crash in the `unhashable-member` checker when using a `lambda` as a dict key.
Closes [#7453](https://togithub.com/PyCQA/pylint/issues/7453)
- Fix a crash in the `modified-iterating-dict` checker involving instance attributes.
Closes [#7461](https://togithub.com/PyCQA/pylint/issues/7461)
- `invalid-class-object` does not crash anymore when `__class__` is assigned alongside another variable.
Closes [#7467](https://togithub.com/PyCQA/pylint/issues/7467)
- Fix false positive for `global-variable-not-assigned` when a global variable is re-assigned via an `ImportFrom` node.
Closes [#4809](https://togithub.com/PyCQA/pylint/issues/4809)
- Fix false positive for `undefined-loop-variable` in `for-else` loops that use a function
having a return type annotation of `NoReturn` or `Never`.
Closes [#7311](https://togithub.com/PyCQA/pylint/issues/7311)
- `--help-msg` now accepts a comma-separated list of message IDs again.
Closes [#7471](https://togithub.com/PyCQA/pylint/issues/7471)
### [`v2.15.2`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.2)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.15.0...v2.15.2)
- Fixed a case where custom plugins specified by command line could silently fail.
Specifically, if a plugin relies on the `init-hook` option changing `sys.path` before
it can be imported, this will now emit a `bad-plugin-value` message. 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](https://togithub.com/PyCQA/pylint/issues/7264).
- Fix `used-before-assignment` for functions/classes defined in type checking guard.
Closes [#7368](https://togithub.com/PyCQA/pylint/issues/7368)
- Update `modified_iterating` checker to fix a crash with `for` loops on empty list.
Closes [#7380](https://togithub.com/PyCQA/pylint/issues/7380)
- The `docparams` extension now considers typing in Numpy style docstrings
as "documentation" for the `missing-param-doc` message.
Refs [#7398](https://togithub.com/PyCQA/pylint/issues/7398)
- Fix false positive for `unused-variable` and `unused-import` when a name is only used in a string literal type annotation.
Closes [#3299](https://togithub.com/PyCQA/pylint/issues/3299)
- Fix false positive for `too-many-function-args` when a function call is assigned to a class attribute inside the class where the function is defined.
Closes [#6592](https://togithub.com/PyCQA/pylint/issues/6592)
- Fix `used-before-assignment` for functions/classes defined in type checking guard.
Closes [#7368](https://togithub.com/PyCQA/pylint/issues/7368)
- Fix ignored files being linted when passed on stdin.
Closes [#4354](https://togithub.com/PyCQA/pylint/issues/4354)
- `missing-return-doc`, `missing-raises-doc` and `missing-yields-doc` now respect
the `no-docstring-rgx` option.
Closes [#4743](https://togithub.com/PyCQA/pylint/issues/4743)
- Don't crash on `OSError` in config file discovery.
Closes [#7169](https://togithub.com/PyCQA/pylint/issues/7169)
- `disable-next` is now correctly scoped to only the succeeding line.
Closes [#7401](https://togithub.com/PyCQA/pylint/issues/7401)
- Update `modified_iterating` checker to fix a crash with `for` loops on empty list.
Closes [#7380](https://togithub.com/PyCQA/pylint/issues/7380)
### [`v2.15.0`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.0)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.5...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](https://togithub.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-timeout` to warn of default timeout values that could cause
a program to be hanging indefinitely.
Refs [#6780](https://togithub.com/PyCQA/pylint/issues/6780)
## False Positives Fixed
- Don't report `super-init-not-called` for abstract `__init__` methods.
Closes [#3975](https://togithub.com/PyCQA/pylint/issues/3975)
- Don't report `unsupported-binary-operation` on Python <= 3.9 when using the `|` operator
with types, if one has a metaclass that overloads `__or__` or `__ror__` as appropriate.
Closes [#4951](https://togithub.com/PyCQA/pylint/issues/4951)
- Don't report `no-value-for-parameter` for dataclasses fields annotated with `KW_ONLY`.
Closes [#5767](https://togithub.com/PyCQA/pylint/issues/5767)
- Fixed inference of `Enums` when they are imported under an alias.
Closes [#5776](https://togithub.com/PyCQA/pylint/issues/5776)
- Prevent false positives when accessing `PurePath.parents` by index (not slice) on Python 3.10+.
Closes [#5832](https://togithub.com/PyCQA/pylint/issues/5832)
- `unnecessary-list-index-lookup` is now more conservative to avoid potential false positives.
Closes [#6896](https://togithub.com/PyCQA/pylint/issues/6896)
- Fix double emitting `trailing-whitespace` for multi-line docstrings.
Closes [#6936](https://togithub.com/PyCQA/pylint/issues/6936)
- `import-error` now correctly checks for `contextlib.suppress` guards on import statements.
Closes [#7270](https://togithub.com/PyCQA/pylint/issues/7270)
- Fix false positive for `no-self-argument`/`no-method-argument` when a staticmethod is applied to a function but uses a different name.
Closes [#7300](https://togithub.com/PyCQA/pylint/issues/7300)
- Fix `undefined-loop-variable` with `break` and `continue` statements in `else` blocks.
Refs [#7311](https://togithub.com/PyCQA/pylint/issues/7311)
## False Negatives Fixed
- Emit `used-before-assignment` when relying on a name that is reimported later in a function.
Closes [#4624](https://togithub.com/PyCQA/pylint/issues/4624)
- Emit `used-before-assignment` for self-referencing named expressions (`:=`) lacking
prior assignments.
Closes [#5653](https://togithub.com/PyCQA/pylint/issues/5653)
- Emit `used-before-assignment` for self-referencing assignments under if conditions.
Closes [#6643](https://togithub.com/PyCQA/pylint/issues/6643)
- Emit `modified-iterating-list` and analogous messages for dicts and sets when iterating
literals, or when using the `del` keyword.
Closes [#6648](https://togithub.com/PyCQA/pylint/issues/6648)
- Emit `used-before-assignment` when calling nested functions before assignment.
Closes [#6812](https://togithub.com/PyCQA/pylint/issues/6812)
- Emit `nonlocal-without-binding` when a nonlocal name has been assigned at a later point in the same scope.
Closes [#6883](https://togithub.com/PyCQA/pylint/issues/6883)
- Emit `using-constant-test` when testing the truth value of a variable or call result
holding a generator.
Closes [#6909](https://togithub.com/PyCQA/pylint/issues/6909)
- Rename `unhashable-dict-key` to `unhashable-member` and emit when creating sets and dicts,
not just when accessing dicts.
Closes [#7034](https://togithub.com/PyCQA/pylint/issues/7034), Closes [#7055](https://togithub.com/PyCQA/pylint/issues/7055)
## Other Bug Fixes
- Fix a failure to lint packages with `__init__.py` contained in directories lacking `__init__.py`.
Closes [#1667](https://togithub.com/PyCQA/pylint/issues/1667)
- Fixed a syntax-error crash that was not handled properly when the declared encoding of a file
was `utf-9`.
Closes [#3860](https://togithub.com/PyCQA/pylint/issues/3860)
- Fix a crash in the `not-callable` check when there is ambiguity whether an instance is being incorrectly provided to `__new__()`.
Closes [#7109](https://togithub.com/PyCQA/pylint/issues/7109)
- Fix crash when regex option raises a `re.error` exception.
Closes [#7202](https://togithub.com/PyCQA/pylint/issues/7202)
- Fix `undefined-loop-variable` from walrus in comprehension test.
Closes [#7222](https://togithub.com/PyCQA/pylint/issues/7222)
- Check for `` before removing first item from `sys.path` in `modify_sys_path`.
Closes [#7231](https://togithub.com/PyCQA/pylint/issues/7231)
- Fix sys.path pollution in parallel mode.
Closes [#7246](https://togithub.com/PyCQA/pylint/issues/7246)
- Prevent `useless-parent-delegation` for delegating to a builtin
written in C (e.g. `Exception.__init__`) with non-self arguments.
Closes [#7319](https://togithub.com/PyCQA/pylint/issues/7319)
## Other Changes
- `bad-exception-context` has been renamed to `bad-exception-cause` as it is about the cause and not the context.
Closes [#3694](https://togithub.com/PyCQA/pylint/issues/3694)
- The message for `literal-comparison` is now more explicit about the problem and the
solution.
Closes [#5237](https://togithub.com/PyCQA/pylint/issues/5237)
- `useless-super-delegation` has been renamed to `useless-parent-delegation` in order to be more generic.
Closes [#6953](https://togithub.com/PyCQA/pylint/issues/6953)
- Pylint now uses `towncrier` for changelog generation.
Refs [#6974](https://togithub.com/PyCQA/pylint/issues/6974)
- Update `astroid` to 2.12.
Refs [#7153](https://togithub.com/PyCQA/pylint/issues/7153)
- Fix crash when a type-annotated `__slots__` with no value is declared.
Closes [#7280](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/6891)
- `pylint.testutils.primer` is now a private API.
Refs [#6905](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/6974)
- Pylint is now using Scorecards to implement security recommendations from the
`OpenSSF `\_. 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](https://togithub.com/PyCQA/pylint/issues/7267)
### [`v2.14.5`](https://togithub.com/PyCQA/pylint/releases/tag/v2.14.5)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.4...v2.14.5)
- Fixed a crash in the `undefined-loop-variable` check when `enumerate()` is used
in a ternary expression.
Closes [#7131](https://togithub.com/PyCQA/pylint/issues/7131)
- Fixed handling of `--` as separator between positional arguments and flags.
Closes [#7003](https://togithub.com/PyCQA/pylint/issues/7003)
- Fixed the disabling of `fixme` and its interaction with `useless-suppression`.
- Allow lists of default values in parameter documentation for `Numpy` style.
Closes [#4035](https://togithub.com/PyCQA/pylint/issues/4035)
### [`v2.14.4`](https://togithub.com/PyCQA/pylint/releases/tag/v2.14.4)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.3...v2.14.4)
- The `differing-param-doc` check was triggered by positional only arguments.
Closes [#6950](https://togithub.com/PyCQA/pylint/issues/6950)
- Fixed an issue where scanning `.` directory recursively with `--ignore-path=^path/to/dir` is not
ignoring the `path/to/dir` directory.
Closes [#6964](https://togithub.com/PyCQA/pylint/issues/6964)
- Fixed regression that didn't allow quoted `init-hooks` in option files.
Closes [#7006](https://togithub.com/PyCQA/pylint/issues/7006)
- Fixed a false positive for `modified-iterating-dict` when updating an existing key.
Closes [#6179](https://togithub.com/PyCQA/pylint/issues/6179)
- Fixed an issue where many-core Windows machines (>~60 logical processors) would hang when
using the default jobs count.
Closes [#6965](https://togithub.com/PyCQA/pylint/issues/6965)
- Fixed an issue with the recognition of `setup.cfg` files.
Only `.cfg` files that are exactly named `setup.cfg` require section names that
start with `pylint.`.
Closes [#3630](https://togithub.com/PyCQA/pylint/issues/3630)
- Don't report `import-private-name` for relative imports.
Closes [#7078](https://togithub.com/PyCQA/pylint/issues/7078)
### [`v2.14.3`](https://togithub.com/PyCQA/pylint/releases/tag/v2.14.3)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.2...v2.14.3)
- Fixed two false positives for `bad-super-call` for calls that refer to a non-direct parent.
Closes [#4922](https://togithub.com/PyCQA/pylint/issues/4922), Closes [#2903](https://togithub.com/PyCQA/pylint/issues/2903)
- Fixed a false positive for `useless-super-delegation` for subclasses that specify the number of
of parameters against a parent that uses a variadic argument.
Closes [#2270](https://togithub.com/PyCQA/pylint/issues/2270)
- Allow suppressing `undefined-loop-variable` and `undefined-variable` without raising `useless-suppression`.
- Fixed false positive for `undefined-variable` for `__class__` in inner methods.
Closes [#4032](https://togithub.com/PyCQA/pylint/issues/4032)
### [`v2.14.2`](https://togithub.com/PyCQA/pylint/releases/tag/v2.14.2)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.1...v2.14.2)
- Fixed a false positive for `unused-variable` when a function returns an
`argparse.Namespace` object.
Closes [#6895](https://togithub.com/PyCQA/pylint/issues/6895)
- Avoided raising an identical `undefined-loop-variable` message 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](https://togithub.com/PyCQA/pylint/issues/6902)
- Fixed a false positive in `consider-using-f-string` if the left side of a `%` is not a string.
Closes [#6689](https://togithub.com/PyCQA/pylint/issues/6689)
- Fixed a false positive in `unnecessary-list-index-lookup` and `unnecessary-dict-index-lookup`
when the subscript is updated in the body of a nested loop.
Closes [#6818](https://togithub.com/PyCQA/pylint/issues/6818)
- Fixed an issue with multi-line `init-hook` options which did not record the line endings.
Closes [#6888](https://togithub.com/PyCQA/pylint/issues/6888)
- Fixed a false positive for `used-before-assignment` when a try block returns
but an except handler defines a name via type annotation.
- `--errors-only` no longer enables previously disabled messages. It was acting as
"emit *all* and only error messages" without being clearly documented that way.
Closes [#6811](https://togithub.com/PyCQA/pylint/issues/6811)
### [`v2.14.1`](https://togithub.com/PyCQA/pylint/releases/tag/v2.14.1)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.0...v2.14.1)
- Avoid reporting `unnecessary-dict-index-lookup` or `unnecessary-list-index-lookup`
when the index lookup is part of a destructuring assignment.
Closes [#6788](https://togithub.com/PyCQA/pylint/issues/6788)
- Fixed parsing of unrelated options in `tox.ini`.
Closes [#6800](https://togithub.com/PyCQA/pylint/issues/6800)
- Fixed a crash when linting `__new__()` methods that return a call expression.
Closes [#6805](https://togithub.com/PyCQA/pylint/issues/6805)
- Don't crash if we can't find the user's home directory.
Closes [#6802](https://togithub.com/PyCQA/pylint/issues/6802)
- Fixed false positives for `unused-import` when aliasing `typing` e.g. as `t`
and guarding imports under `t.TYPE_CHECKING`.
Closes [#3846](https://togithub.com/PyCQA/pylint/issues/3846)
- Fixed a false positive regression in 2.13 for `used-before-assignment` where it is safe to rely
on a name defined only in an `except` block because the `else` block returned.
Closes [#6790](https://togithub.com/PyCQA/pylint/issues/6790)
- Fixed the use of abbreviations for some special options on the command line.
Closes [#6810](https://togithub.com/PyCQA/pylint/issues/6810)
- Fix a crash in the optional `pylint.extensions.private_import` extension.
Closes [#6624](https://togithub.com/PyCQA/pylint/issues/6624)
- `bad-option-value` (E0012) is now a warning `unknown-option-value` (W0012). Deleted messages that do not exist
anymore in pylint now raise `useless-option-value` (R0022) instead of `bad-option-value`. This allows to
distinguish between genuine typos and configuration that could be cleaned up. Existing message disables for
`bad-option-value` will still work on both new messages.
Refs [#6794](https://togithub.com/PyCQA/pylint/issues/6794)
### [`v2.14.0`](https://togithub.com/PyCQA/pylint/releases/tag/v2.14.0)
[Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.13.9...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](https://togithub.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!
# New checkers
- Added new checker `comparison-of-constants`.
Closes [#6076](https://togithub.com/PyCQA/pylint/issues/6076)
- Added new checker `typevar-name-mismatch`: TypeVar must be assigned to a variable with the same name as its name argument.
Closes [#5224](https://togithub.com/PyCQA/pylint/issues/5224)
- `invalid-enum-extension`: Used when a class tries to extend an inherited Enum class.
Closes [#5501](https://togithub.com/PyCQA/pylint/issues/5501)
- Added new checker `typevar-double-variance`: The "covariant" and "contravariant" keyword arguments
cannot both be set to "True" in a TypeVar.
Closes [#5895](https://togithub.com/PyCQA/pylint/issues/5895)
- Add new check `unnecessary-dunder-call` for unnecessary dunder method calls.
Closes [#5936](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/578)
- Added new checker `unnecessary-list-index-lookup` for indexing into a list while
iterating over `enumerate()`.
Closes [#4525](https://togithub.com/PyCQA/pylint/issues/4525)
- Added new message called `duplicate-value` which identifies duplicate values inside sets.
Closes [#5880](https://togithub.com/PyCQA/pylint/issues/5880)
- Added the `super-without-brackets` checker, raised when a super call is missing its brackets.
Closes [#4008](https://togithub.com/PyCQA/pylint/issues/4008)
# Removed checkers
- The `no-init` (W0232) warning has been removed. It's ok to not have an `__init__` in a class.
Closes [#2409](https://togithub.com/PyCQA/pylint/issues/2409)
- Removed the `assign-to-new-keyword` message as there are no new keywords in the supported Python
versions any longer.
Closes [#4683](https://togithub.com/PyCQA/pylint/issues/4683)
- Moved `no-self-use` check to optional extension.
You now need to explicitly enable this check using
`load-plugins=pylint.extensions.no_self_use`.
Closes [#5502](https://togithub.com/PyCQA/pylint/issues/5502)
# Extensions
- `RedefinedLoopNameChecker`
- Added optional extension `redefined-loop-name` to emit messages when a loop variable
is redefined in the loop body.
Closes [#5072](https://togithub.com/PyCQA/pylint/issues/5072)
- `DocStringStyleChecker`
- Re-enable checker `bad-docstring-quotes` for Python <= 3.7.
Closes [#6087](https://togithub.com/PyCQA/pylint/issues/6087)
- `NoSelfUseChecker`
- Added `no-self-use` check, previously enabled by default.
Closes [#5502](https://togithub.com/PyCQA/pylint/issues/5502)
# Other Changes
- Started ignoring underscore as a local variable for `too-many-locals`.
Closes [#6488](https://togithub.com/PyCQA/pylint/issues/6488)
- Pylint can now be installed with an extra-require called `spelling` (`pip install pylint[spelling]`).
This will add `pyenchant` to pylint's dependencies. You will still need to install the
requirements for `pyenchant` (the `enchant` library and any dictionaries) yourself. You will also
need to set the `spelling-dict` option.
Refs [#6462](https://togithub.com/PyCQA/pylint/issues/6462)
- Improved wording of the message of `deprecated-module`
Closes [#6169](https://togithub.com/PyCQA/pylint/issues/6169)
- `Pylint` now requires Python 3.7.2 or newer to run.
Closes [#4301](https://togithub.com/PyCQA/pylint/issues/4301)
- We made a greater effort to reraise failures stemming from the `astroid`
library as `AstroidError`, with the effect that pylint emits `astroid-error`
rather than merely `fatal`. 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-value` inline (as long as you disable it before
the bad option value is raised, i.e. `disable=bad-option-value,bad-message` not `disable=bad-message,bad-option-value` ) as well as certain other
previously unsupported messages.
Closes [#3312](https://togithub.com/PyCQA/pylint/issues/3312)
- The main checker name is now `main` instead of `master`. The configuration does not need to be updated as sections' name are optional.
Closes [#5467](https://togithub.com/PyCQA/pylint/issues/5467)
- Update `invalid-slots-object` message to show bad object rather than its inferred value.
Closes [#6101](https://togithub.com/PyCQA/pylint/issues/6101)
- Fixed a crash in the `not-an-iterable` checker involving multiple starred expressions
inside a call.
Closes [#6372](https://togithub.com/PyCQA/pylint/issues/6372)
- Fixed a crash in the `unused-private-member` checker involving chained private attributes.
Closes [#6709](https://togithub.com/PyCQA/pylint/issues/6709)
- Disable spellchecking of mypy rule names in ignore directives.
Closes [#5929](https://togithub.com/PyCQA/pylint/issues/5929)
- `implicit-str-concat` will now be raised on calls like `open("myfile.txt" "a+b")` too.
Closes [#6441](https://togithub.com/PyCQA/pylint/issues/6441)
- Fix a failure to respect inline disables for `fixme` occurring on the last line
of a module when pylint is launched with `--enable=fixme`.
- Removed the broken `generate-man` option.
Closes [#5283](https://togithub.com/PyCQA/pylint/issues/5283)
Closes [#1887](https://togithub.com/PyCQA/pylint/issues/1887)
- Fixed failure to enable `deprecated-module` after a `disable=all`
by making `ImportsChecker` solely responsible for emitting `deprecated-module` instead
of sharing responsibility with `StdlibChecker`. (This could have led to double messages.)
- Added the `generate-toml-config` option.
Refs [#5462](https://togithub.com/PyCQA/pylint/issues/5462)
- `bad-option-value` will be emitted whenever a configuration value or command line invocation
includes an unknown message.
Closes [#4324](https://togithub.com/PyCQA/pylint/issues/4324)
- Added the `unrecognized-option` message. Raised if we encounter any unrecognized options.
Closes [#5259](https://togithub.com/PyCQA/pylint/issues/5259)
- Fix false negative for `bad-string-format-type` if 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-none` checker has been renamed to `method-cache-max-size-none`.
Closes [#5670](https://togithub.com/PyCQA/pylint/issues/5670)
- The `method-cache-max-size-none` checker will now also check `functools.cache`.
Closes [#5670](https://togithub.com/PyCQA/pylint/issues/5670)
- `BaseChecker` classes now require the `linter` argument to be passed.
- The `set_config_directly` decorator has been removed.
- Don't report `useless-super-delegation` for the `__hash__` method in classes that also override the `__eq__` method.
Closes [#3934](https://togithub.com/PyCQA/pylint/issues/3934)
- Fix falsely issuing `useless-suppression` on the `wrong-import-position` checker.
Closes [#5219](https://togithub.com/PyCQA/pylint/issues/5219)
- Fixed false positive `no-member` for Enums with self-defined members.
Closes [#5138](https://togithub.com/PyCQA/pylint/issues/5138)
- Fix false negative for `no-member` when attempting to assign an instance
attribute to itself without any prior assignment.
Closes [#1555](https://togithub.com/PyCQA/pylint/issues/1555)
- Changed message type from `redefined-outer-name` to `redefined-loop-name`
(optional extension) for redefinitions of outer loop variables by inner loops.
Closes [#5608](https://togithub.com/PyCQA/pylint/issues/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-imports` and `ignore-signatures` to `False`.
- Pylint now expands the user path (i.e. `~` to `home/yusef/`) and expands environment variables (i.e. `home/$USER/$project`
to `home/yusef/pylint` for `USER=yusef` and `project=pylint`) for pyreverse's `output-directory`,
`import-graph`, `ext-import-graph`, `int-import-graph` options, and the spell checker's `spelling-private-dict-file`
option.
Refs [#6493](https://togithub.com/PyCQA/pylint/issues/6493)
- Don't emit `unsubscriptable-object` for string annotations.
Pylint doesn't check if class is only generic in type stubs only.
Closes [#4369](https://togithub.com/PyCQA/pylint/issues/4369) and [#6523](https://togithub.com/PyCQA/pylint/issues/6523)
- Fix pyreverse crash `RuntimeError: dictionary changed size during iteration`
Refs [#6612](https://togithub.com/PyCQA/pylint/issues/6612)
- Fix syntax for return type annotations in MermaidJS diagrams produced with `pyreverse`.
Closes [#6467](https://togithub.com/PyCQA/pylint/issues/6467)
- Fix type annotations of class and instance attributes using the alternative union syntax in `pyreverse` diagrams.
- Fix bug where it writes a plain text error message to stdout, invalidating output formats.
Closes [#6597](https://togithub.com/PyCQA/pylint/issues/6597)
- The refactoring checker now also raises 'consider-using-a-generator' messages for
`max()`, `min()` and `sum()`.
Refs [#6595](https://togithub.com/PyCQA/pylint/issues/6595)
- Update ranges for `using-constant-test` and `missing-parentheses-for-call-in-test`
error messages.
- Don't emit `no-member` inside type annotations with
`from __future__ import annotations`.
Closes [#6594](https://togithub.com/PyCQA/pylint/issues/6594)
- Fix `unexpected-special-method-signature` false positive for `__init_subclass__` methods with one or more arguments.
Closes [#6644](https://togithub.com/PyCQA/pylint/issues/6644)
# Deprecations
- The `ignore-mixin-members` option has been deprecated. You should now use the new
`ignored-checks-for-mixins` option.
Closes [#5205](https://togithub.com/PyCQA/pylint/issues/5205)
- `interfaces.implements` has been deprecated and will be removed in 3.0. Please use standard inheritance
patterns instead of `__implements__`.
Refs [#2287](https://togithub.com/PyCQA/pylint/issues/2287)
- All `Interface` classes in `pylint.interfaces` have 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](https://togithub.com/PyCQA/pylint/issues/2287)
- `MapReduceMixin` has been deprecated. `BaseChecker` now implements `get_map_data` and
`reduce_map_data`. If a checker actually needs to reduce data it should define `get_map_data`
as returning something different than `None` and let its `reduce_map_data` handle a list
of the types returned by `get_map_data`.
An example can be seen by looking at `pylint/checkers/similar.py`.
- The `config` attribute of `BaseChecker` has been deprecated. You can use `checker.linter.config`
to access the global configuration object instead of a checker-specific object.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- The `level` attribute of `BaseChecker` has been deprecated: everything is now
displayed in `--help`, all the time.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- The `set_option` method of `BaseChecker` has been deprecated. You can use `checker.linter.set_option`
to set an option on the global configuration object instead of a checker-specific object.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- The `options_providers` attribute of `ArgumentsManager` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/6394)
- The `method-cache-max-size-none` checker will now also check `functools.cache`.
- The `config` attribute of `PyLinter` is now of the `argparse.Namespace` type instead of
`optparse.Values`.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `UnsupportedAction` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `OptionsManagerMixIn` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `OptionParser` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `Option` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `OptionsProviderMixIn` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `ConfigurationMixIn` has been deprecated.
- The `option_groups` attribute of `PyLinter` has been deprecated.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `get_global_config` has been deprecated. You can now access all global options from
`checker.linter.config`.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `OptionsManagerMixIn` has been replaced with `ArgumentsManager`. `ArgumentsManager` is considered
private API and most methods that were public on `OptionsManagerMixIn` have now been deprecated and will
be removed in a future release.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `OptionsProviderMixIn` has been replaced with `ArgumentsProvider`. `ArgumentsProvider` is considered
private API and most methods that were public on `OptionsProviderMixIn` have now been deprecated and will
be removed in a future release.
Refs [#5392](https://togithub.com/PyCQA/pylint/issues/5392)
- `pylint.pyreverse.ASTWalker` has been removed, as it was only used internally by a single child class.
Refs [#6712](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/6713)
- `is_class_subscriptable_pep585_with_postponed_evaluation_enabled` has been deprecated.
Use `is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node)`
instead.
Refs [#6536](https://togithub.com/PyCQA/pylint/issues/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.
This PR contains the following updates:
==2.13.9
->==2.15.4
Release Notes
PyCQA/pylint
### [`v2.15.4`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.4) [Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.15.3...v2.15.4) ## False Positives Fixed - Fix the message for `unnecessary-dunder-call` for `__aiter__` and `__aneext__`. Also only emit the warning when `py-version` >= 3.10. Closes [#7529](https://togithub.com/PyCQA/pylint/issues/7529) ## Other Bug Fixes - Fix bug in detecting `unused-variable` when iterating on variable. Closes [#3044](https://togithub.com/PyCQA/pylint/issues/3044) - Fixed handling of `--` as separator between positional arguments and flags. This was not actually fixed in 2.14.5. Closes [#7003](https://togithub.com/PyCQA/pylint/issues/7003), Refs [#7096](https://togithub.com/PyCQA/pylint/issues/7096) - Report `no-self-argument` rather than `no-method-argument` for methods with variadic arguments. Closes [#7507](https://togithub.com/PyCQA/pylint/issues/7507) - Fixed an issue where `syntax-error` couldn't be raised on files with invalid encodings. Closes [#7522](https://togithub.com/PyCQA/pylint/issues/7522) - Fix false positive for `redefined-outer-name` when aliasing `typing` e.g. as `t` and guarding imports under `t.TYPE_CHECKING`. Closes [#7524](https://togithub.com/PyCQA/pylint/issues/7524) - Fixed a crash of the `modified_iterating` checker when iterating on a set defined as a class attribute. Closes [#7528](https://togithub.com/PyCQA/pylint/issues/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](https://togithub.com/PyCQA/pylint/issues/3299) ## Other Changes - Add method name to the error messages of `no-method-argument` and `no-self-argument`. Closes [#7507](https://togithub.com/PyCQA/pylint/issues/7507) ### [`v2.15.3`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.3) [Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.15.2...v2.15.3) - Fixed a crash in the `unhashable-member` checker when using a `lambda` as a dict key. Closes [#7453](https://togithub.com/PyCQA/pylint/issues/7453) - Fix a crash in the `modified-iterating-dict` checker involving instance attributes. Closes [#7461](https://togithub.com/PyCQA/pylint/issues/7461) - `invalid-class-object` does not crash anymore when `__class__` is assigned alongside another variable. Closes [#7467](https://togithub.com/PyCQA/pylint/issues/7467) - Fix false positive for `global-variable-not-assigned` when a global variable is re-assigned via an `ImportFrom` node. Closes [#4809](https://togithub.com/PyCQA/pylint/issues/4809) - Fix false positive for `undefined-loop-variable` in `for-else` loops that use a function having a return type annotation of `NoReturn` or `Never`. Closes [#7311](https://togithub.com/PyCQA/pylint/issues/7311) - `--help-msg` now accepts a comma-separated list of message IDs again. Closes [#7471](https://togithub.com/PyCQA/pylint/issues/7471) ### [`v2.15.2`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.2) [Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.15.0...v2.15.2) - Fixed a case where custom plugins specified by command line could silently fail. Specifically, if a plugin relies on the `init-hook` option changing `sys.path` before it can be imported, this will now emit a `bad-plugin-value` message. 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](https://togithub.com/PyCQA/pylint/issues/7264). - Fix `used-before-assignment` for functions/classes defined in type checking guard. Closes [#7368](https://togithub.com/PyCQA/pylint/issues/7368) - Update `modified_iterating` checker to fix a crash with `for` loops on empty list. Closes [#7380](https://togithub.com/PyCQA/pylint/issues/7380) - The `docparams` extension now considers typing in Numpy style docstrings as "documentation" for the `missing-param-doc` message. Refs [#7398](https://togithub.com/PyCQA/pylint/issues/7398) - Fix false positive for `unused-variable` and `unused-import` when a name is only used in a string literal type annotation. Closes [#3299](https://togithub.com/PyCQA/pylint/issues/3299) - Fix false positive for `too-many-function-args` when a function call is assigned to a class attribute inside the class where the function is defined. Closes [#6592](https://togithub.com/PyCQA/pylint/issues/6592) - Fix `used-before-assignment` for functions/classes defined in type checking guard. Closes [#7368](https://togithub.com/PyCQA/pylint/issues/7368) - Fix ignored files being linted when passed on stdin. Closes [#4354](https://togithub.com/PyCQA/pylint/issues/4354) - `missing-return-doc`, `missing-raises-doc` and `missing-yields-doc` now respect the `no-docstring-rgx` option. Closes [#4743](https://togithub.com/PyCQA/pylint/issues/4743) - Don't crash on `OSError` in config file discovery. Closes [#7169](https://togithub.com/PyCQA/pylint/issues/7169) - `disable-next` is now correctly scoped to only the succeeding line. Closes [#7401](https://togithub.com/PyCQA/pylint/issues/7401) - Update `modified_iterating` checker to fix a crash with `for` loops on empty list. Closes [#7380](https://togithub.com/PyCQA/pylint/issues/7380) ### [`v2.15.0`](https://togithub.com/PyCQA/pylint/releases/tag/v2.15.0) [Compare Source](https://togithub.com/PyCQA/pylint/compare/v2.14.5...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](https://togithub.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-timeout` to warn of default timeout values that could cause a program to be hanging indefinitely. Refs [#6780](https://togithub.com/PyCQA/pylint/issues/6780) ## False Positives Fixed - Don't report `super-init-not-called` for abstract `__init__` methods. Closes [#3975](https://togithub.com/PyCQA/pylint/issues/3975) - Don't report `unsupported-binary-operation` on Python <= 3.9 when using the `|` operator with types, if one has a metaclass that overloads `__or__` or `__ror__` as appropriate. Closes [#4951](https://togithub.com/PyCQA/pylint/issues/4951) - Don't report `no-value-for-parameter` for dataclasses fields annotated with `KW_ONLY`. Closes [#5767](https://togithub.com/PyCQA/pylint/issues/5767) - Fixed inference of `Enums` when they are imported under an alias. Closes [#5776](https://togithub.com/PyCQA/pylint/issues/5776) - Prevent false positives when accessing `PurePath.parents` by index (not slice) on Python 3.10+. Closes [#5832](https://togithub.com/PyCQA/pylint/issues/5832) - `unnecessary-list-index-lookup` is now more conservative to avoid potential false positives. Closes [#6896](https://togithub.com/PyCQA/pylint/issues/6896) - Fix double emitting `trailing-whitespace` for multi-line docstrings. Closes [#6936](https://togithub.com/PyCQA/pylint/issues/6936) - `import-error` now correctly checks for `contextlib.suppress` guards on import statements. Closes [#7270](https://togithub.com/PyCQA/pylint/issues/7270) - Fix false positive for `no-self-argument`/`no-method-argument` when a staticmethod is applied to a function but uses a different name. Closes [#7300](https://togithub.com/PyCQA/pylint/issues/7300) - Fix `undefined-loop-variable` with `break` and `continue` statements in `else` blocks. Refs [#7311](https://togithub.com/PyCQA/pylint/issues/7311) ## False Negatives Fixed - Emit `used-before-assignment` when relying on a name that is reimported later in a function. Closes [#4624](https://togithub.com/PyCQA/pylint/issues/4624) - Emit `used-before-assignment` for self-referencing named expressions (`:=`) lacking prior assignments. Closes [#5653](https://togithub.com/PyCQA/pylint/issues/5653) - Emit `used-before-assignment` for self-referencing assignments under if conditions. Closes [#6643](https://togithub.com/PyCQA/pylint/issues/6643) - Emit `modified-iterating-list` and analogous messages for dicts and sets when iterating literals, or when using the `del` keyword. Closes [#6648](https://togithub.com/PyCQA/pylint/issues/6648) - Emit `used-before-assignment` when calling nested functions before assignment. Closes [#6812](https://togithub.com/PyCQA/pylint/issues/6812) - Emit `nonlocal-without-binding` when a nonlocal name has been assigned at a later point in the same scope. Closes [#6883](https://togithub.com/PyCQA/pylint/issues/6883) - Emit `using-constant-test` when testing the truth value of a variable or call result holding a generator. Closes [#6909](https://togithub.com/PyCQA/pylint/issues/6909) - Rename `unhashable-dict-key` to `unhashable-member` and emit when creating sets and dicts, not just when accessing dicts. Closes [#7034](https://togithub.com/PyCQA/pylint/issues/7034), Closes [#7055](https://togithub.com/PyCQA/pylint/issues/7055) ## Other Bug Fixes - Fix a failure to lint packages with `__init__.py` contained in directories lacking `__init__.py`. Closes [#1667](https://togithub.com/PyCQA/pylint/issues/1667) - Fixed a syntax-error crash that was not handled properly when the declared encoding of a file was `utf-9`. Closes [#3860](https://togithub.com/PyCQA/pylint/issues/3860) - Fix a crash in the `not-callable` check when there is ambiguity whether an instance is being incorrectly provided to `__new__()`. Closes [#7109](https://togithub.com/PyCQA/pylint/issues/7109) - Fix crash when regex option raises a `re.error` exception. Closes [#7202](https://togithub.com/PyCQA/pylint/issues/7202) - Fix `undefined-loop-variable` from walrus in comprehension test. Closes [#7222](https://togithub.com/PyCQA/pylint/issues/7222) - Check for `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.
This PR has been generated by Mend Renovate. View repository job log here.