Skip to content

Latest commit

 

History

History
315 lines (185 loc) · 9.23 KB

2.14.rst

File metadata and controls

315 lines (185 loc) · 9.23 KB

What's New in Pylint 2.14

Release

2.14

Date

TBA

Summary -- Release highlights

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

  • 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.
  • Add new check unnecessary-dunder-call for 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-lookup for indexing into a list while iterating over enumerate().

    Closes #4525

  • Added new message called duplicate-value which identifies duplicate values inside sets.

    Closes #5880

  • Added the super-without-brackets checker, 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-keyword message as there are no new keywords in the supported Python versions any longer.

    Closes #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

Extensions

  • RedefinedLoopNameChecker

    • Added optional extension redefined-loop-name to emit messages when a loop variable is redefined in the loop body.

      Closes #5072

  • DocStringStyleChecker

    • Re-enable checker bad-docstring-quotes for Python <= 3.7.

      Closes #6087

  • NoSelfUseChecker

    • Added no-self-use check, previously enabled by default.

      Closes #5502

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 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

  • Improved wording of the message of deprecated-module

    Closes #6169

  • Pylint now requires Python 3.7.2 or newer to run.

    Closes #4301

  • Improved recognition of namespace packages. They should no longer be added to sys.path which should prevent various issues with false positives. Because of the difficulties with mirroring the python import mechanics we would gladly hear feedback on this change.

    Closes #5226, Closes #2648

  • Update invalid-slots-object message to show bad object rather than its inferred value.

    Closes #6101

  • Fixed a crash in the not-an-iterable checker involving multiple starred expressions inside a call.

    Closes #6372

  • Disable spellchecking of mypy rule names in ignore directives.

    Closes #5929

  • implicit-str-concat will now be raised on calls like open("myfile.txt" "a+b") too.

    Closes #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 Closes #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.)
  • 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.

    Ref #5392

  • The level attribute of BaseChecker has been deprecated: everything is now displayed in --help, all the time.

    Ref #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.

    Ref #5392

  • The options_providers attribute of ArgumentsManager has been deprecated.

    Ref #5392

  • The config attribute of PyLinter is now of the argparse.Namespace type instead of optparse.Values.

    Ref #5392

  • UnsupportedAction has been deprecated.

    Ref #5392

  • OptionsManagerMixIn has been deprecated.

    Ref #5392

  • OptionParser has been deprecated.

    Ref #5392

  • Option has been deprecated.

    Ref #5392

  • OptionsProviderMixIn has been deprecated.

    Ref #5392

  • ConfigurationMixIn has been deprecated.
  • The option_groups attribute of PyLinter has been deprecated.

    Ref #5392

  • get_global_config has been deprecated. You can now access all global options from checker.linter.config.

    Ref #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.

    Ref #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.

    Ref #5392

  • interfaces.implements has been deprecated and will be removed in 3.0. Please use standard inheritance patterns instead of __implements__.

    Ref #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

  • Added the generate-toml-config option.

    Ref #5462

  • bad-option-value will be emitted whenever a configuration value or command line invocation includes an unknown message.

    Closes #4324

  • Added the unrecognized-option message. Raised if we encounter any unrecognized options.

    Closes #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

  • 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-none checker will now also check functools.cache.

    Closes #5670

  • BaseChecker classes now require the linter argument to be passed.
  • The set_config_directly decorator has been removed.
  • The ignore-mixin-members option has been deprecated. You should now use the new ignored-checks-for-mixins option.

    Closes #5205

  • Fix falsely issuing useless-suppression on the wrong-import-position checker.

    Closes #5219

  • Fixed false positive no-member for Enums with self-defined members.

    Closes #5138

  • Fix false negative for no-member when attempting to assign an instance attribute to itself without any prior assignment.

    Closes #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

  • 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.
  • Fix IndexError crash in uninferable_final_decorators method.
  • 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.

    Relates to #6493