It's not just a linter that annoys you!

Overview

README for Pylint - https://pylint.pycqa.org/

https://travis-ci.org/PyCQA/pylint.svg?branch=master AppVeyor Build Status https://coveralls.io/repos/github/PyCQA/pylint/badge.svg?branch=master Pypi Package version Documentation Status
Tidelift Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.

Pylint

It's not just a linter that annoys you!

Pylint is a Python static code analysis tool which looks for programming errors, helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.

It's highly configurable, having special pragmas to control its errors and warnings from within your code, as well as from an extensive configuration file. It is also possible to write your own plugins for adding your own checks or for extending pylint in one way or another.

It's a free software distributed under the GNU General Public Licence unless otherwise specified.

Development is hosted on GitHub: https://github.com/PyCQA/pylint/

You can use the [email protected] mailing list to discuss about Pylint. Subscribe at https://mail.python.org/mailman/listinfo/code-quality/ or read the archives at https://mail.python.org/pipermail/code-quality/

Pull requests are amazing and most welcome.

Install

Pylint can be simply installed by running:

pip install pylint

If you are using Python 3.6+, upgrade to get full support for your version:

pip install pylint --upgrade

If you want to install from a source distribution, extract the tarball and run the following command

python setup.py install

Do make sure to do the same for astroid, which is used internally by pylint.

For debian and rpm packages, use your usual tools according to your Linux distribution.

More information about installation and available distribution format can be found here.

Documentation

The documentation lives at https://pylint.pycqa.org/.

Pylint is shipped with following additional commands:

  • pyreverse: an UML diagram generator
  • symilar: an independent similarities checker
  • epylint: Emacs and Flymake compatible Pylint

Testing

We use tox and pytest-benchmark for running the test suite. You should be able to install it with:

pip install tox pytest pytest-benchmark

To run the test suite for a particular Python version, you can do:

tox -e py37

To run individual tests with tox, you can do:

tox -e py37 -- -k name_of_the_test

We use pytest for testing pylint, which you can use without using tox for a faster development cycle.

If you want to run tests on a specific portion of the code with pytest, (pytest-cov) and your local python version:

# ( pip install pytest-cov )
# Everything:
python3 -m pytest tests/
# Everything in tests/message with coverage for the relevant code:
python3 -m pytest tests/message/ --cov=pylint.message
coverage html
# Only the functional test "missing_kwoa_py3":
python3 -m pytest "tests/test_functional.py::test_functional[missing_kwoa_py3]"

Do not forget to clone astroid and install the last version:

git clone https://github.com/PyCQA/astroid.git

# From source
python3 astroid/setup.py build sdist
pip3 install astroid/dist/astroid*.tar.gz

# Using an editable installation
cd astroid
python3 -m pip install -e .

For more detailed information, check the documentation.

License

pylint is, with a few exceptions listed below, GPLv2.

The icon files are licensed under the CC BY-SA 4.0 license:

Comments
  • Pylint slow when run on script with pandas

    Pylint slow when run on script with pandas

    Sample script

    > cat hello.py                                                                                                                                               (hodgepodge) 
    """
    Hello.
    """
    
    import pandas as pd
    
    def hello():
        """
        Hello.
        """
    
        test_pdf = pd.DataFrame([[1, 2, 3]])
    

    Running pylint

    > /usr/bin/time pylint hello.py                                                                                                                              
    No config file found, using default configuration
    ************* Module hello
    W: 12, 4: Unused variable 'test_pdf' (unused-variable)
    
    ------------------------------------------------------------------
    Your code has been rated at 6.67/10 (previous run: 6.67/10, +0.00)
    
    Command exited with non-zero status 4
    48.05user 0.15system 0:44.80elapsed 107%CPU (0avgtext+0avgdata 193132maxresident)k
    0inputs+8outputs (0major+72586minor)pagefaults 0swaps
    

    pylint --version output

    pylint --version No config file found, using default configuration pylint 1.9.1, astroid 1.6.4 Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0]

    Q1. Is this expected behaviour? Q1a. If so is there a way to make pylint ignore pandas?

    topic-performance Maintenance 
    opened by parantapa 97
  • Primer tests

    Primer tests "à la mypy"

    Type of Changes

    | | Type | | --- | ---------------------- | | ✓ | :sparkles: New feature |

    Description

    This is a draft for adding primer tests, and discuss about it.

    • [x] Stop github actions at the first job not passing (Already the case see : https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f)
    • [x] Upgrade the release doc as we're now running acceptance in github actions
    • [x] Choose 2/3 good repositories to add
    • [x] Improve the message when primer tests fails (This can still be made better but is enough for now)
    • [ ] ~~Add more repositories ?~~ #5359
    • [ ] ~~Reduce total pipeline time (possibly by adding more jobs one for each part of the primer)~~ #5359

    Closes #4413

    Maintenance primer 
    opened by Pierre-Sassoulas 68
  • "Module 'numpy' has no ... member" error even with extension-pkg-whitelist=numpy set in pylint.rc

    I'm always receiving "Module 'numpy' has no member" error when I run pylint on my code, even though I have set

    extension-pkg-whitelist=numpy in my pylint.rc file

    Numpy version = 1.5.2 Astroid version = 1.4.3

    Bug :beetle: 
    opened by mpconte 60
  • RuntimeError: Inconsistent hierarchy

    RuntimeError: Inconsistent hierarchy

    Steps to reproduce

    1. clone pylint & clone asteroid
    2. build both from source using setup.py install
    3. run pylint

    Current behavior

    throws error

    ubuntu@ip-0000:~/scripts/pooja/ext-code/pylint$ pip list | grep astroid
    DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
    astroid (1.5.0)
    ubuntu@ip-0000:~/scripts/pooja/ext-code/pylint$ pip list | grep pylint 
    DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
    pylint (1.7.0, /usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg)
    ubuntu@ip-00000:~/scripts/pooja/ext-code/pylint$ cd /var/lib/jenkins/jobs/CI_SyntaxValidator_commons/workspace
    (reverse-i-search)`inst': sudo python setup.py ^Cstall
    ubuntu@ip-00000:/var/lib/jenkins/jobs/CI_SyntaxValidator_commons/workspace$ ^C
    ubuntu@ip-0000:/var/lib/jenkins/jobs/CI_SyntaxValidator_commons/workspace$ pylint commons/
    Traceback (most recent call last):
      File "/usr/local/bin/pylint", line 11, in <module>
        load_entry_point('pylint==1.7.0', 'console_scripts', 'pylint')()
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/__init__.py", line 13, in run_pylint
        Run(sys.argv[1:])
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/lint.py", line 1220, in __init__
        linter.load_default_plugins()
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/lint.py", line 453, in load_default_plugins
        checkers.initialize(self)
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/checkers/__init__.py", line 114, in initialize
        register_plugins(linter, __path__[0])
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/utils.py", line 992, in register_plugins
        module = modutils.load_module_from_file(join(directory, filename))
      File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/modutils.py", line 272, in load_module_from_file
        return load_module_from_modpath(modpath, path, use_sys)
      File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/modutils.py", line 233, in load_module_from_modpath
        module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/checkers/python3.py", line 100, in <module>
        class Python3Checker(checkers.BaseChecker):
      File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/checkers/python3.py", line 501, in Python3Checker
        'sys.version_info < (3, 0)',
      File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/node_classes.py", line 624, in repr_tree
        _repr_tree(self, result, set())
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
      File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/node_classes.py", line 613, in _repr_node
        depth)
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
      File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/node_classes.py", line 613, in _repr_node
        depth)
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 191, in dispatch
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 142, in _find_impl
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 130, in _compose_mro
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 84, in _c3_mro
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 88, in _c3_mro
      File "build/bdist.linux-x86_64/egg/singledispatch.py", line 39, in _c3_merge
    RuntimeError: Inconsistent hierarchy
    

    Expected behavior

    pylint --version output

    ubuntu@ip-0000:/var/lib/workspace$ pip list | grep pylint
    DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
    pylint (1.7.0, /usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg)
    ubuntu@ip-0000:/var/lib/workspace$ pip list | grep astroid
    DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
    astroid (1.5.0)
    
    Bug :beetle: 
    opened by p00j4 58
  • cv2 module members are not recognized

    cv2 module members are not recognized

    When importing cv2 I get errors such as:

    [pylint] E1101:Module 'cv2' has no 'imread' member [pylint] E1101:Module 'cv2' has no 'resize' member [pylint] E1101:Module 'cv2' has no 'imshow' member [pylint] E1101:Module 'cv2' has no 'waitKey' member [pylint] E1101:Module 'cv2' has no 'destroyAllWindows' member

    etc'

    (the code itself runs fine)

    I'm using VSCode 1.26.1 and Python 3.6.5.

    See this issue for more complaints: https://github.com/DonJayamanne/pythonVSCode/issues/623

    opened by uriva 53
  • The duplicate-code (R0801) can't be disabled

    The duplicate-code (R0801) can't be disabled

    Originally reported by: Anonymous


    It's seems like it's not possible to disable the duplicate code check on portions of a file. Looking at the source, I can see why as it's not a trivial thing to do (if you want to maintain the same scope semantics as other #pylint:enable/disable comments. This would be nice to have though (or I guess I could just cleanup my duplicate code).


    • Bitbucket: https://bitbucket.org/logilab/pylint/issue/214
    Enhancement ✨ Help wanted 🙏 High priority Hacktoberfest 
    opened by pylint-bot 51
  • lint all files in a directory

    lint all files in a directory

    Originally reported by: Buck Evan (BitBucket: bukzor, GitHub: @bukzor?)


    It would make things easier for me to use pylint in CI if I could simply say pylint . in order to tell pylint to look at all my files.

    flake8/pep8 already have this behavior. They make it configurable via a filepatterns config (default *.py) and an exclude config (default .svn,CVS,.bzr,.hg,.git,__pycache__).

    Discussion from #pylint:

    buck1: jcristau: in flake8, I can run `flake8 .` and it has a set of configured match/exclude patterns to check everything in the directory
    buck1: currently pylint assumes that any directory is a package, and fails if not
    buck1: how would you feel about including the flake8 behavior
    buck1: would make my life 100% easier when trying to run pylint against everything during CI
    jcristau: doesn't sound crazy, though there might be backwards compat concerns...  please float the idea in a ticket or on the list, i'm not the maintainer :)
    buck1: jcristau: i'll make a feature-request ticket. Sounds like something I might be able to implement. Just wanted to see your thoughts first.
    

    • Bitbucket: https://bitbucket.org/logilab/pylint/issue/352
    Enhancement ✨ Help wanted 🙏 topic-command-line High priority Hacktoberfest 
    opened by pylint-bot 50
  • Use `towncrier` for changelog generation

    Use `towncrier` for changelog generation

    • [x] Write a good description on what the PR does.
    • [x] Add an entry to the change log describing the change in doc/whatsnew/2/2.15/index.rst (or doc/whatsnew/2/2.14/full.rst if the change needs backporting in 2.14). If necessary you can write details or offer examples on how the new change is supposed to work.
    • [x] If you used multiple emails or multiple names when contributing, add your mails and preferred name in script/.contributors_aliases.json

    Type of Changes

    | | Type | | --- | ---------------------- | | ✓ | :scroll: Docs |

    Description

    Draft for using towncrier to generate the release notes. Feedback is welcome.

    Things that need to be discussed:

    • ~In this comment @Pierre-Sassoulas had the idea to reference the PR number rather than the issue number. Is this still the way we want to go? As it is not possible to know the PR number before creating the PR itself, this would mean one needs to always create and push the news fragment after drafting the PR. I find that inconvenient. https://github.com/PyCQA/pylint/pull/6688#discussion_r887582505~

    Things I still need to implement:

    • [x] Automatically update towncrier.toml with a tbump script - I would like to wait for feedback first before doing that.

    Things that have to be done before merging:

    • [x] extract all current changelog entries into news fragments
    Blocker 🙅 Skip news :mute: 
    opened by DudeNr33 48
  • Use 3.11 for Github actions

    Use 3.11 for Github actions

    Type of Changes

    | | Type | | --- | ---------------------- | | ✓ | :sparkles: New feature | | ✓ | :scroll: Docs |

    Description

    Closes #5920

    Maintenance Needs astroid update python 3.11 
    opened by Pierre-Sassoulas 48
  • Add `comparison-of-constants` checker

    Add `comparison-of-constants` checker

    Type of Changes

    | | Type | | --- | ---------------------- | | ✓ | :bug: Bug fix |

    Description

    checker for catching pointless comparisons between two literals

    Closes #6076

    The Issue mentions tautological and logical errors. But this check is about comparisons between literals, which is a subset of all possible logical errors.

    Enhancement ✨ Checkers 
    opened by omarandlorraine 44
  • Introduce new 'import-private-name' checker

    Introduce new 'import-private-name' checker

    Type of Changes

    | | Type | | --- | ---------------------- | | ✓ | :sparkles: New feature |

    Description

    Hi folks,

    I used one convention message for modules and objects, customizing the message to help identify the type of the private name being imported, i.e.

    import-private-name:4:0:4:25::Imported private package (_world):UNDEFINED
    import-private-name:5:0:5:23::Imported private object (_house):UNDEFINED
    import-private-name:6:0:6:29::Imported private objects (_b, _d):UNDEFINED
    

    Right now it's just a simple check for the name leading with a single underscore _.

    The results of running this check on Pylint itself are below with single and double underscore cases.

    ************* Module checkers.unittest_misc
    tests/checkers/unittest_misc.py:22:0: C0416: Imported private object (_tokenize_str) (import-private-name)
    ************* Module pylint.testutils.functional.lint_module_output_update
    pylint/testutils/functional/lint_module_output_update.py:8:0: C0416: Imported private package (_pytest.config) (import-private-name)
    ************* Module pylint.config.option_manager_mixin
    pylint/config/option_manager_mixin.py:20:0: C0416: Imported private object (_ManHelpFormatter) (import-private-name)
    ************* Module checkers.unittest_format
    tests/checkers/unittest_format.py:39:0: C0416: Imported private object (_tokenize_str) (import-private-name)
    ************* Module checkers.unittest_spelling
    tests/checkers/unittest_spelling.py:27:0: C0416: Imported private object (_tokenize_str) (import-private-name)
    ************* Module pylint.lint.run
    pylint/lint/run.py:8:0: C0416: Imported private object (__pkginfo__) (import-private-name)
    pylint/lint/run.py:9:0: C0416: Imported private object (_config_initialization) (import-private-name)
    ************* Module test_check_parallel
    tests/test_check_parallel.py:25:0: C0416: Imported private object (_worker_check_single_file) (import-private-name)
    tests/test_check_parallel.py:26:0: C0416: Imported private object (_worker_initialize) (import-private-name)
    ************* Module pylint.config
    pylint/config/__init__.py:48:0: C0416: Imported private object (_ManHelpFormatter) (import-private-name)
    ************* Module pylint
    pylint/__init__.py:15:0: C0416: Imported private object (__version__) (import-private-name)
    ************* Module test_functional
    tests/test_functional.py:30:0: C0416: Imported private package (_pytest.config) (import-private-name)
    tests/test_functional.py:31:0: C0416: Imported private package (_pytest.recwarn) (import-private-name)
    ************* Module pylint.checkers.utils
    pylint/checkers/utils.py:83:0: C0416: Imported private module (_string) (import-private-name)
    ************* Module test_import_graph
    tests/test_import_graph.py:27:0: C0416: Imported private package (_pytest.fixtures) (import-private-name)
    ************* Module pylint.extensions.docparams
    pylint/extensions/docparams.py:37:0: C0416: Imported private object (_check_docs_utils) (import-private-name)
    ************* Module lint.unittest_expand_modules
    tests/lint/unittest_expand_modules.py:12:0: C0416: Imported private object (_is_in_ignore_list_re) (import-private-name)
    ************* Module pylint.lint.parallel
    pylint/lint/parallel.py:9:0: C0416: Imported private object (_patch_sys_path) (import-private-name)
    ************* Module pylint.testutils
    pylint/testutils/__init__.py:53:0: C0416: Imported private object (_get_tests_info) (import-private-name)
    pylint/testutils/__init__.py:58:0: C0416: Imported private object (_tokenize_str) (import-private-name)
    ************* Module pylint.config.options_provider_mixin
    pylint/config/options_provider_mixin.py:8:0: C0416: Imported private object (_validate) (import-private-name)
    ************* Module pylint.constants
    pylint/constants.py:9:0: C0416: Imported private object (__version__) (import-private-name)
    ************* Module pylint.checkers.base_checker
    pylint/checkers/base_checker.py:27:0: C0416: Imported private object (_MSG_ORDER) (import-private-name)
    ************* Module pylint.lint
    pylint/lint/__init__.py:84:0: C0416: Imported private object (_patch_sys_path) (import-private-name)
    ************* Module test_func
    tests/test_func.py:30:0: C0416: Imported private object (_get_tests_info) (import-private-name)
    ************* Module pylint.reporters.text
    pylint/reporters/text.py:48:0: C0416: Imported private object (_splitstrip) (import-private-name)
    ************* Module pylint.extensions.overlapping_exceptions
    pylint/extensions/overlapping_exceptions.py:13:0: C0416: Imported private object (_annotated_unpack_infer) (import-private-name)
    ************* Module pylint.utils
    pylint/utils/__init__.py:51:0: C0416: Imported private objects (_check_csv, _format_option_value, _splitstrip, _unquote) (import-private-name)
    ************* Module pylint.message.message_definition
    pylint/message/message_definition.py:9:0: C0416: Imported private object (_SCOPE_EXEMPT) (import-private-name)
    ************* Module extensions.test_check_docs_utils
    tests/extensions/test_check_docs_utils.py:21:0: C0416: Imported private object (_check_docs_utils) (import-private-name)
    ************* Module pylint.testutils.lint_module_test
    pylint/testutils/lint_module_test.py:15:0: C0416: Imported private package (_pytest.config) (import-private-name)
    pylint/testutils/lint_module_test.py:18:0: C0416: Imported private object (_config_initialization) (import-private-name)
    pylint/testutils/lint_module_test.py:21:0: C0416: Imported private objects (_EXPECTED_RE, _OPERATORS) (import-private-name)
    

    Closes #5463

    Enhancement ✨ High effort 🏋 
    opened by areveny 43
  • Can I turn on missing-docstring for

    Can I turn on missing-docstring for "private" functions?

    Question

    missing-docstring is not being applied to my functions staring with "_".

    Related to this closed issue: https://github.com/PyCQA/pylint/issues/3177

    I'm really confused about this behavior. I want docstrings for all my functions including my functions starting with "_". Why wouldn't I want that? Is there a way to turn this on?

    Documentation for future user

    Setting to apply missing-docstring on functions starting with "_".

    Additional context

    No response

    Question Documentation :green_book: Needs triage :inbox_tray: 
    opened by red8888 0
  • False positive `invalid-sequence-index` with `scipy.fft.rfft`

    False positive `invalid-sequence-index` with `scipy.fft.rfft`

    Bug description

    # pylint: disable=missing-module-docstring, missing-function-docstring
    # Using scipy.fft.rfft causes the error, removing this line also removes the error
    # Seems related to issue #7702
    
    import numpy as np
    from scipy.fft import rfft
    
    
    def some_func():
        arr = np.array([[1, 2, 3], [4, 5, 6]])
        arr_fft = rfft(arr)
    
        print(arr_fft[:, 0:2])
    

    Command used

    pylint false_positive_pylint.py
    

    Pylint output

    ************* Module false_positive_pylint
    false_positive_pylint.py:11:10: E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)
    
    ------------------------------------------------------------------
    Your code has been rated at 3.75/10 (previous run: 3.75/10, +0.00)
    

    Expected behavior

    No error reported

    Pylint version

    pylint 2.15.9
    astroid 2.12.13
    Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
    

    OS / Environment

    Windows 10 using Powershell

    Needs triage :inbox_tray: Lib specific 💅 
    opened by Albits 0
  • New check: `break` at the top of `while True` loop

    New check: `break` at the top of `while True` loop

    Current problem

    A not-uncommon pattern is to check some condition at the top of a while True loop and break if the condition is met:

    while True:
        if condition:
            break
    
        do_stuff()
    

    There is an instance of this in the Pylint codebase.

    Desired solution

    It would be more straightforward and less verbose to negate the condition and move it into the while expression:

    while not condition:
        do_stuff()
    

    Add a new check for the following circumstance:

    1. There is a while loop with True condition (or more generally, constant condition);
    2. the first statement of the loop body is an if statement; and
    3. the first statement of the if body is a break statement.

    In this case, emit a suggestion to negate the condition and move it to the while.

    I don't know what the name of the warning should be. Suggestions welcome!

    Additional context

    No response

    Enhancement ✨ Good first issue Needs PR 
    opened by nickdrozd 0
  • Improve `--dummy-variables-rgx` and `--ignored-argument-names` documentation

    Improve `--dummy-variables-rgx` and `--ignored-argument-names` documentation

    Question

    Could the documentation be made more helpful for people trying to ignore dummy arguments?

    Documentation for future user

    Suppose that I'm looking to suppress unused-argument for all function arguments starting with "mock_".

    I might find the option --dummy-variables-rgx:

    A regular expression matching the name of dummy variables (i.e. expected to not be used). (default: _+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_)
    

    But wait, it doesn't work. Even though arguments are variables.

    I might then find the option --ignored-argument-names:

    Argument names that match this expression will be ignored. (default: re.compile('_.*|^ignored_|^unused_'))
    

    The default value looks promising. But wait, why isn't it named --dummy-arguments-rgx? And why is the documentation so different? Is it because this is actually going to suppress a bunch of messages other than unused-variable, such as invalid_name? What does it actually do? Even regular maintainers are confused.

    Eventually I learn that it will (at least) suppress unused-variable, too-many-args, and some docstring message(s).

    My suggestion is to

    • clarify that --dummy-variables-rgx will not work for dummy arguments and point the user towards --ignored-argument-names, and
    • make the documentation of --ignored-argument-names clear about what it actually does (what messages it might suppress).

    Additional context

    No response

    Enhancement ✨ Documentation :green_book: Needs specification :closed_lock_with_key: 
    opened by nortti 1
  • False negative `too-few-format-args`

    False negative `too-few-format-args`

    Bug description

    "{1}".format(20)
    "{2}".format(20)
    

    both should emit too-few-format-args because the interpreter will complain with `IndexError: Replacement index N out of range for positional args tuple"

    Configuration

    No response

    Command used

    pylint test.py
    

    Pylint output

    Formatting a regular string which could be a f-string (consider-using-f-string)
    

    Expected behavior

    Too few arguments for format string (too-few-format-args)

    Pylint version

    pylint 2.16.0-dev
    astroid 2.13.0-dev0
    Python 3.8.9 (default, Apr 13 2022, 08:48:07)
    

    OS / Environment

    No response

    Additional dependencies

    No response

    False Negative 🦋 Needs specification :closed_lock_with_key: 
    opened by clavedeluna 1
  • Bump sphinx from 5.3.0 to 6.0.0

    Bump sphinx from 5.3.0 to 6.0.0

    Bumps sphinx from 5.3.0 to 6.0.0.

    Release notes

    Sourced from sphinx's releases.

    v6.0.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b2

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    Changelog

    Sourced from sphinx's changelog.

    Release 6.0.0 (released Dec 29, 2022)

    Dependencies

    • #10468: Drop Python 3.6 support
    • #10470: Drop Python 3.7, Docutils 0.14, Docutils 0.15, Docutils 0.16, and Docutils 0.17 support. Patch by Adam Turner

    Incompatible changes

    • #7405: Removed the jQuery and underscore.js JavaScript frameworks.

      These frameworks are no longer be automatically injected into themes from Sphinx 6.0. If you develop a theme or extension that uses the jQuery, $, or $u global objects, you need to update your JavaScript to modern standards, or use the mitigation below.

      The first option is to use the sphinxcontrib.jquery_ extension, which has been developed by the Sphinx team and contributors. To use this, add sphinxcontrib.jquery to the extensions list in conf.py, or call app.setup_extension("sphinxcontrib.jquery") if you develop a Sphinx theme or extension.

      The second option is to manually ensure that the frameworks are present. To re-add jQuery and underscore.js, you will need to copy jquery.js and underscore.js from the Sphinx repository_ to your static directory, and add the following to your layout.html:

      .. code-block:: html+jinja

      {%- block scripts %} {{ super() }} {%- endblock %}

      .. _sphinxcontrib.jquery: https://github.com/sphinx-contrib/jquery/

      Patch by Adam Turner.

    • #10471, #10565: Removed deprecated APIs scheduled for removal in Sphinx 6.0. See :ref:dev-deprecated-apis for details. Patch by Adam Turner.

    • #10901: C Domain: Remove support for parsing pre-v3 style type directives and roles. Also remove associated configuration variables c_allow_pre_v3 and c_warn_on_allowed_pre_v3. Patch by Adam Turner.

    Features added

    ... (truncated)

    Commits

    Dependabot compatibility score

    You can trigger a rebase of this PR by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Blocked 🚧 dependency Skip news :mute: 
    opened by dependabot[bot] 1
Releases(v2.15.9)
  • v2.15.9(Dec 17, 2022)

    False Positives Fixed

    • Fix false-positive for used-before-assignment in pattern matching with a guard.

      Closes #5327

    Other Bug Fixes

    • Pylint will no longer deadlock if a parallel job is killed but fail immediately instead.

      Closes #3899

    • When pylint exit due to bad arguments being provided the exit code will now be the expected 32.

      Refs #7931

    • Fixes a ModuleNotFound exception when running pylint on a Django project with the pylint_django plugin enabled.

      Closes #7938

    Source code(tar.gz)
    Source code(zip)
  • v2.15.8(Dec 5, 2022)

    False Positives Fixed

    • Document a known false positive for useless-suppression when disabling line-too-long in a module with only comments and no code.

      Closes #3368

    • Fix logging-fstring-interpolation false positive raised when logging and f-string with %s formatting.

      Closes #4984

    • Fixes false positive abstract-method on Protocol classes.

      Closes #7209

    • Fix missing-param-doc false positive when function parameter has an escaped underscore.

      Closes #7827

    • multiple-statements no longer triggers for function stubs using inlined ....

      Closes #7860

    Source code(tar.gz)
    Source code(zip)
  • v2.15.7(Nov 29, 2022)

    False Positives Fixed

    • Fix deprecated-method false positive when alias for method is similar to name of deprecated method.

      Closes #5886

    • Fix a false positive for used-before-assignment for imports guarded by typing.TYPE_CHECKING later used in variable annotations.

      Closes #7609

    Other Bug Fixes

    • Pylint will now filter duplicates given to it before linting. The output should be the same whether a file is given/discovered multiple times or not.

      Closes #6242, #4053

    • Fixes a crash in stop-iteration-return when the next builtin is called without arguments.

      Closes #7828

    Source code(tar.gz)
    Source code(zip)
  • v2.15.6(Nov 19, 2022)

    False Positives Fixed

    • Fix false positive for unhashable-member when subclassing dict and using the subclass as a dictionary key.

      Closes #7501

    • unnecessary-list-index-lookup will not be wrongly emitted if enumerate is called with start.

      Closes #7682

    • Don't warn about stop-iteration-return when using next() over itertools.cycle.

      Closes #7765

    Other Bug Fixes

    • Messages sent to reporter are now copied so a reporter cannot modify the message sent to other reporters.

      Closes #7214

    • Fixes edge case of custom method named next raised an astroid error.

      Closes #7610

    • Fix crash that happened when parsing files with unexpected encoding starting with 'utf' like utf13.

      Closes #7661

    • Fix a crash when a child class with an __init__ method inherits from a parent class with an __init__ class attribute.

      Closes #7742

    Source code(tar.gz)
    Source code(zip)
  • v2.15.5(Oct 21, 2022)

    What's new in Pylint 2.15.5?

    Release date: 2022-10-21

    False Positives Fixed

    • Fix a false positive for simplify-boolean-expression when multiple values are inferred for a constant.

      Closes #7626

    Other Bug Fixes

    • Remove __index__ dunder method call from unnecessary-dunder-call check.

      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 dill would throw an error when attempting to serialise the linter object for multi-processing use.

      Closes #7635.

    Other Changes

    • Add a keyword-only compare_constants argument to safe_infer.

      Refs #7626

    • Sort --generated-rcfile output.

      Refs #7655

    Source code(tar.gz)
    Source code(zip)
  • v2.15.4(Oct 10, 2022)

    False Positives Fixed

    • Fix the message for unnecessary-dunder-call for __aiter__ and __anext__. Also only emit the warning when py-version >= 3.10.

      Closes #7529

    Other Bug Fixes

    • Fix bug in detecting unused-variable when iterating on variable.

      Closes #3044

    • Fixed handling of -- as separator between positional arguments and flags. This was not actually fixed in 2.14.5.

      Closes #7003, Refs #7096

    • Report no-self-argument rather than no-method-argument for methods with variadic arguments.

      Closes #7507

    • Fixed an issue where syntax-error couldn't be raised on files with invalid encodings.

      Closes #7522

    • Fix false positive for redefined-outer-name when aliasing typing e.g. as t and guarding imports under t.TYPE_CHECKING.

      Closes #7524

    • Fixed a crash of the modified_iterating checker 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-argument and no-self-argument.

      Closes #7507

    Source code(tar.gz)
    Source code(zip)
  • v2.15.3(Sep 19, 2022)

    • Fixed a crash in the unhashable-member checker when using a lambda as a dict key.

      Closes #7453

    • Fix a crash in the modified-iterating-dict checker involving instance attributes.

      Closes #7461

    • invalid-class-object does not crash anymore when __class__ is assigned alongside another variable.

      Closes #7467

    • Fix false positive for global-variable-not-assigned when a global variable is re-assigned via an ImportFrom node.

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

    • --help-msg now accepts a comma-separated list of message IDs again.

      Closes #7471

    Source code(tar.gz)
    Source code(zip)
  • v2.15.2(Sep 7, 2022)

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

    • Fix used-before-assignment for functions/classes defined in type checking guard.

      Closes #7368

    • Update modified_iterating checker to fix a crash with for loops on empty list.

      Closes #7380

    • The docparams extension now considers typing in Numpy style docstrings as "documentation" for the missing-param-doc message.

      Refs #7398

    • Fix false positive for unused-variable and unused-import when a name is only used in a string literal type annotation.

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

    • Fix used-before-assignment for 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-doc and missing-yields-doc now respect the no-docstring-rgx option.

      Closes #4743

    • Don't crash on OSError in config file discovery.

      Closes #7169

    • disable-next is now correctly scoped to only the succeeding line.

      Closes #7401

    • Update modified_iterating checker to fix a crash with for loops on empty list.

      Closes #7380

    Source code(tar.gz)
    Source code(zip)
  • v2.15.1(Sep 6, 2022)

    • Fix used-before-assignment for functions/classes defined in type checking guard.

      Closes #7368

    • Update modified_iterating checker to fix a crash with for loops on empty list.

      Closes #7380

    • The docparams extension now considers typing in Numpy style docstrings as "documentation" for the missing-param-doc message.

      Refs #7398

    • Fix false positive for unused-variable and unused-import when a name is only used in a string literal type annotation.

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

    • Fix used-before-assignment for 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-doc and missing-yields-doc now respect the no-docstring-rgx option.

      Closes #4743

    • Don't crash on OSError in config file discovery.

      Closes #7169

    • disable-next is now correctly scoped to only the succeeding line.

      Closes #7401

    • Update modified_iterating checker to fix a crash with for loops on empty list.

      Closes #7380

    Source code(tar.gz)
    Source code(zip)
  • v2.15.0(Aug 26, 2022)

    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-timeout to 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-called for abstract __init__ methods.

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

    • Don't report no-value-for-parameter for dataclasses fields annotated with KW_ONLY.

      Closes #5767

    • Fixed inference of Enums when they are imported under an alias.

      Closes #5776

    • Prevent false positives when accessing PurePath.parents by index (not slice) on Python 3.10+.

      Closes #5832

    • unnecessary-list-index-lookup is now more conservative to avoid potential false positives.

      Closes #6896

    • Fix double emitting trailing-whitespace for multi-line docstrings.

      Closes #6936

    • import-error now correctly checks for contextlib.suppress guards on import statements.

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

    • Fix undefined-loop-variable with break and continue statements in else blocks.

      Refs #7311

    False Negatives Fixed

    • Emit used-before-assignment when relying on a name that is reimported later in a function.

      Closes #4624

    • Emit used-before-assignment for self-referencing named expressions (:=) lacking prior assignments.

      Closes #5653

    • Emit used-before-assignment for self-referencing assignments under if conditions.

      Closes #6643

    • Emit modified-iterating-list and analogous messages for dicts and sets when iterating literals, or when using the del keyword.

      Closes #6648

    • Emit used-before-assignment when calling nested functions before assignment.

      Closes #6812

    • Emit nonlocal-without-binding when a nonlocal name has been assigned at a later point in the same scope.

      Closes #6883

    • Emit using-constant-test when testing the truth value of a variable or call result holding a generator.

      Closes #6909

    • Rename unhashable-dict-key to unhashable-member and emit when creating sets and dicts, not just when accessing dicts.

      Closes #7034, Closes #7055

    Other Bug Fixes

    • Fix a failure to lint packages with __init__.py contained 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-callable check when there is ambiguity whether an instance is being incorrectly provided to __new__().

      Closes #7109

    • Fix crash when regex option raises a re.error exception.

      Closes #7202

    • Fix undefined-loop-variable from walrus in comprehension test.

      Closes #7222

    • Check for <cwd> before removing first item from sys.path in modify_sys_path.

      Closes #7231

    • Fix sys.path pollution in parallel mode.

      Closes #7246

    • Prevent useless-parent-delegation for delegating to a builtin written in C (e.g. Exception.__init__) with non-self arguments.

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

    • The message for literal-comparison is now more explicit about the problem and the solution.

      Closes #5237

    • useless-super-delegation has been renamed to useless-parent-delegation in order to be more generic.

      Closes #6953

    • Pylint now uses towncrier for changelog generation.

      Refs #6974

    • Update astroid to 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.primer is 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

    Source code(tar.gz)
    Source code(zip)
  • v2.14.5(Jul 17, 2022)

    • Fixed a crash in the undefined-loop-variable check when enumerate() is used in a ternary expression.

      Closes #7131

    • Fixed handling of -- as separator between positional arguments and flags.

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

    Source code(tar.gz)
    Source code(zip)
  • v2.14.4(Jun 29, 2022)

    • The differing-param-doc check was triggered by positional only arguments.

      Closes #6950

    • Fixed an issue where scanning . directory recursively with --ignore-path=^path/to/dir is not ignoring the path/to/dir directory.

      Closes #6964

    • Fixed regression that didn't allow quoted init-hooks in option files.

      Closes #7006

    • Fixed a false positive for modified-iterating-dict when 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.cfg files. Only .cfg files that are exactly named setup.cfg require section names that start with pylint..

      Closes #3630

    • Don't report import-private-name for relative imports.

      Closes #7078

    Source code(tar.gz)
    Source code(zip)
  • v2.14.3(Jun 18, 2022)

    • Fixed two false positives for bad-super-call for calls that refer to a non-direct parent.

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

    • 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

    Source code(tar.gz)
    Source code(zip)
  • v2.14.2(Jun 15, 2022)

    • Fixed a false positive for unused-variable when a function returns an argparse.Namespace object.

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

    • Fixed a false positive in consider-using-f-string if the left side of a % is not a string.

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

    • Fixed an issue with multi-line init-hook options which did not record the line endings.

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

    Source code(tar.gz)
    Source code(zip)
  • v2.14.1(Jun 6, 2022)

    • Avoid reporting unnecessary-dict-index-lookup or unnecessary-list-index-lookup when 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-import when aliasing typing e.g. as t and guarding imports under t.TYPE_CHECKING.

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

    • Fixed the use of abbreviations for some special options on the command line.

      Closes #6810

    • Fix a crash in the optional pylint.extensions.private_import extension.

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

    Source code(tar.gz)
    Source code(zip)
  • v3.0.0-a5(Jun 2, 2022)

    This is 2.14.0 with breaking changes for 3.0 included. Released only so that the old alpha 4 release based on pylint 2.9.0 is not proposed by tools instead of 2.14.0. 2.14.0 is the stable version you should use that.

    Source code(tar.gz)
    Source code(zip)
  • v2.14.0(Jun 1, 2022)

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

    • 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

    • 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

    • 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

    • Fixed a crash in the unused-private-member checker involving chained private attributes.

      Closes #6709

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

    • Added the generate-toml-config option.

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

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

    • Don't report useless-super-delegation for the __hash__ method in classes that also override the __eq__ method.

      Closes #3934

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

    • 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

    • Don't emit unsubscriptable-object for string annotations. Pylint doesn't check if class is only generic in type stubs only.

      Closes #4369 and #6523

    • Fix pyreverse crash RuntimeError: dictionary changed size during iteration

      Refs #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 pyreverse diagrams.

    • 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() and sum().

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

    • Fix unexpected-special-method-signature false positive for __init_subclass__ methods with one or more arguments.

      Closes #6644

    Deprecations

    • The ignore-mixin-members option has been deprecated. You should now use the new ignored-checks-for-mixins option.

      Closes #5205

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

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

    • 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

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

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

    • The options_providers attribute of ArgumentsManager has 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-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

    • UnsupportedAction has been deprecated.

      Refs #5392

    • OptionsManagerMixIn has been deprecated.

      Refs #5392

    • OptionParser has been deprecated.

      Refs #5392

    • Option has been deprecated.

      Refs #5392

    • OptionsProviderMixIn has been deprecated.

      Refs #5392

    • ConfigurationMixIn has been deprecated.

    • The option_groups attribute of PyLinter has been deprecated.

      Refs #5392

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

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

    • 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

    • pylint.pyreverse.ASTWalker has 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_enabled has been deprecated. Use is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node) instead.

      Refs #6536

    Source code(tar.gz)
    Source code(zip)
  • v2.13.9(May 13, 2022)

    2.13.9 is the last release supporting python interpreter between 3.6.2 and 3.7.2.

    • Respect ignore configuration options with --recursive=y.

      Closes #6471

    • Fix false positives for no-name-in-module and import-error for numpy.distutils and pydantic.

      Closes #6497

    • Fix IndexError crash in uninferable_final_decorators method.

      Relates to #6531

    • Fix a crash in unnecessary-dict-index-lookup when subscripting an attribute.

      Closes #6557

    • Fix a crash when accessing __code__ and assigning it to a variable.

      Closes #6539

    • Fix a false positive for undefined-loop-variable when using enumerate().

      Closes #6593

    Source code(tar.gz)
    Source code(zip)
  • v2.14.0-b1(May 10, 2022)

    Provisional changelog for 2.14.0:

    • 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

    • Added new checker comparison-of-constants.

      Closes #6076

    • Started ignoring underscore as a local variable for too-many-locals.

      Closes #6488

    • Improved wording of the message of deprecated-module

      Closes #6169

    • Pylint now requires Python 3.7.2 or newer to run.

      Closes #4301

    • BaseChecker classes now require the linter argument to be passed.

    • Fix a failure to respect inline disables for fixme occurring on the last line of a module when pylint is launched with --enable=fixme.

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

      Closes #6101

    • 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

    • Added new checker typevar-name-mismatch: TypeVar must be assigned to a variable with the same name as its name argument.

      Closes #5224

    • 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

    • Removed the assign-to-new-keyword message as there are no new keywords in the supported Python versions any longer.

      Closes #4683

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

      Closes #6372

    • 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 no-init (W0232) warning has been removed. It's ok to not have an __init__ in a class.

      Closes #2409

    • 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 options_providers attribute of ArgumentsManager has been deprecated.

      Ref #5392

    • The option_groups attribute of PyLinter has been deprecated.

      Ref #5392

    • 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

    • 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

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

      Closes #6441

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

      Ref #5392

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

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

      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

    • invalid-enum-extension: Used when a class tries to extend an inherited Enum class.

      Closes #5501

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

      Closes #5259

    • Added new checker typevar-double-variance: The "covariant" and "contravariant" keyword arguments cannot both be set to "True" in a TypeVar.

      Closes #5895

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

      Closes #6087

    • Removed the broken generate-man option.

      Closes #5283 Closes #1887

    • Fix false negative for bad-string-format-type if the value to be formatted is passed in as a variable holding a constant.

    • Add new check unnecessary-dunder-call for unnecessary dunder method calls.

      Closes #5936 Closes #6074

    • The cache-max-size-none checker has been renamed to method-cache-max-size-none.

      Closes #5670

    • The method-cache-max-size-none checker will now also check functools.cache.

      Closes #5670

    • 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 optional extension redefined-loop-name to emit messages when a loop variable is redefined in the loop body.

      Closes #5072

    • Changed message type from redefined-outer-name to redefined-loop-name (optional extension) for redefinitions of outer loop variables by inner loops.

      Closes #5608

    • The ignore-mixin-members option has been deprecated. You should now use the new ignored-checks-for-mixins option.

      Closes #5205

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

      Closes #4324

    • Avoid reporting superfluous-parens on expressions using the is not operator.

      Closes #5930

    • Added the super-without-brackets checker, raised when a super call is missing its brackets.

      Closes #4008

    • Added the generate-toml-config option.

      Ref #5462

    • Added new checker unnecessary-list-index-lookup for indexing into a list while iterating over enumerate().

      Closes #4525

    • 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

    • The concept of checker priority has been removed.

    • Add a new command line option --minimal-messages-config for pytest, which disables all irrelevant messages when running the functional tests.

    • duplicate-argument-name now only raises once for each set of duplicated arguments.

    • Fix bug where specifically enabling just await-outside-async was not possible.

    • The set_config_directly decorator has been removed.

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

      Closes #5880

    • 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

    • Created NoSelfUseChecker extension and moved the no-self-use check. You now need to explicitly enable this check using load-plugins=pylint.extensions.no_self_use.

      Closes #5502

    • 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

    • Don't emit unsubscriptable-object for string annotations. Pylint doesn't check if class is only generic in type stubs only.

      Closes #4369 and #6523

    • is_class_subscriptable_pep585_with_postponed_evaluation_enabled has been deprecated. Use subscriptable_with_postponed_evaluation_enabled instead.

      Ref #6536

    Source code(tar.gz)
    Source code(zip)
  • v2.13.8(May 2, 2022)

    • Fix a false positive for undefined-loop-variable for a variable used in a lambda inside the first of multiple loops.

      Closes #6419

    • Fix a crash when linting a file that passes an integer mode= to open

      Closes #6414

    • Avoid reporting superfluous-parens on expressions using the is not operator.

      Closes #5930

    • Fix a false positive for undefined-loop-variable when the else of a for loop raises or returns.

      Closes #5971

    • Fix false positive for unused-variable for classes inside functions and where a metaclass is provided via a call.

      Closes #4020

    • Fix false positive for unsubscriptable-object in Python 3.8 and below for statements guarded by if TYPE_CHECKING.

      Closes #3979

    Source code(tar.gz)
    Source code(zip)
  • v2.13.7(Apr 20, 2022)

  • v2.13.6(Apr 20, 2022)

    • Fix a crash in the unsupported-membership-test checker when assigning multiple constants to class attributes including __iter__ via unpacking.

      Closes #6366

    • Asterisks are no longer required in Sphinx and Google style parameter documentation for missing-param-doc and are parsed correctly.

      Closes #5815 Closes #5406

    • Fixed a false positive for unused-variable when a builtin specified in --additional-builtins is given a type annotation.

      Closes #6388

    • Fixed an AstroidError in 2.13.0 raised by the duplicate-code checker with ignore-imports or ignore-signatures enabled.

      Closes #6301

    Source code(tar.gz)
    Source code(zip)
  • v2.13.5(Apr 6, 2022)

    • Fix false positive regression in 2.13.0 for used-before-assignment for homonyms between variable assignments in try/except blocks and variables in subscripts in comprehensions.

      Closes #6069 Closes #6136

    • lru-cache-decorating-method has been renamed to cache-max-size-none and will only be emitted when maxsize is None.

      Closes #6180

    • Fix false positive for unused-import when disabling both used-before-assignment and undefined-variable.

      Closes #6089

    • Narrow the scope of the unnecessary-ellipsis checker to:

      • functions & classes which contain both a docstring and an ellipsis.
      • A body which contains an ellipsis nodes.Expr node & at least one other statement.
    • Fix false positive for used-before-assignment for assignments taking place via nonlocal declarations after an earlier type annotation.

      Closes #5394

    • Fix crash for redefined-slots-in-subclass when the type of the slot is not a const or a string.

      Closes #6100

    • Only raise not-callable when all the inferred values of a property are not callable.

      Closes #5931

    • Fix a false negative for subclassed-final-class when a set of other messages were disabled.

    Source code(tar.gz)
    Source code(zip)
  • v2.13.4(Mar 31, 2022)

    • Fix false positive regression in 2.13.0 for used-before-assignment for homonyms between variable assignments in try/except blocks and variables in a comprehension's filter.

      Closes #6035

    • Include testing_pylintrc in source and wheel distributions.

      Closes #6028

    • Fix crash in super-init-not-called checker when using ctypes.Union.

      Closes #6027

    • Fix crash for unneccessary-ellipsis checker when an ellipsis is used inside of a container or a lambda expression.

      Closes #6036 Closes #6037 Closes #6048

    Source code(tar.gz)
    Source code(zip)
  • v2.13.3(Mar 29, 2022)

    • Fix false positive for unnecessary-ellipsis when using an ellipsis as a default argument.

      Closes #5973

    • Fix crash involving unbalanced tuple unpacking.

      Closes #5998

    • Fix false positive for 'nonexistent-operator' when repeated '-' are separated (e.g. by parens).

      Closes #5769

    Source code(tar.gz)
    Source code(zip)
  • v2.13.2(Mar 27, 2022)

    • Fix crash when subclassing a namedtuple.

      Closes #5982

    • Fix false positive for superfluous-parens for patterns like "return (a or b) in iterable".

      Closes #5803

    • Fix a false negative regression in 2.13.0 where protected-access was not raised on functions.

      Fixes #5989

    • Better error messages in case of crash if pylint can't write the issue template.

      Refer to #5987

    Source code(tar.gz)
    Source code(zip)
  • v2.13.1(Mar 26, 2022)

    • Fix a regression in 2.13.0 where used-before-assignment was emitted for the usage of a nonlocal in a try block.

      Fixes #5965

    • Avoid emitting raising-bad-type when there is inference ambiguity on the variable being raised.

      Closes #2793

    • Loosen TypeVar default name pattern a bit to allow names with multiple uppercase characters. E.g. HVACModeT or IPAddressT.

      Closes #5981

    • Fixed false positive for unused-argument when a nonlocal name is used in a nested function that is returned without being called by its parent.

      Closes #5187

    • Fix program crash for modified_iterating-list/set/dict when the list/dict/set being iterated through is a function call.

      Closes #5969

    • Don't emit broken-noreturn and broken-collections-callable errors inside if TYPE_CHECKING blocks.

    Source code(tar.gz)
    Source code(zip)
  • v2.13.0(Mar 24, 2022)

    • Add missing dunder methods to unexpected-special-method-signature check.

    • No longer emit no-member in for loops that reference self if the binary operation that started the for loop uses a self that is encapsulated in tuples or lists.

      Ref PyCQA/astroid#1360 Closes #4826

    • Output better error message if unsupported file formats are used with pyreverse.

      Closes #5950

    • Fix pyreverse diagrams type hinting for classmethods and staticmethods.

    • Fix pyreverse diagrams type hinting for methods returning None.

    • Fix matching --notes options that end in a non-word character.

      Closes #5840

    • Updated the position of messages for class and function defintions to no longer cover the complete definition. Only the def or class + the name of the class/function are covered.

      Closes #5466

    • using-f-string-in-unsupported-version and using-final-decorator-in-unsupported-version msgids were renamed from W1601 and W1602 to W2601 and W2602. Disabling using these msgids will break. This is done in order to restore consistency with the already existing msgids for apply-builtin and basestring-builtin from the now deleted python 3K+ checker. There is now a check that we're not using existing msgids or symbols from deleted checkers.

      Closes #5729

    • The line numbering for messages related to function arguments is now more accurate. This can require some message disables to be relocated to updated positions.

    • Add --recursive option to allow recursive discovery of all modules and packages in subtree. Running pylint with --recursive=y option will check all discovered .py files and packages found inside subtree of directory provided as parameter to pylint.

      Closes #352

    • Add modified-iterating-list, modified-iterating-dict and modified-iterating-set, emitted when items are added to or removed from respectively a list, dictionary or set being iterated through.

      Closes #5348

    • Fix false-negative for assignment-from-none checker using list.sort() method.

      closes #5722

    • New extension import-private-name: indicate imports of external private packages and objects (prefixed with _). It can be loaded using load-plugins=pylint.extensions.private_import.

      Closes #5463

    • Fixed crash from arguments-differ and arguments-renamed when methods were defined outside the top level of a class.

      Closes #5648

    • Removed the deprecated check_docs extension. You can use the docparams checker to get the checks previously included in check_docs.

      Closes #5322

    • Added a testutil extra require to the packaging, as gitpython should not be a dependency all the time but is still required to use the primer helper code in pylint.testutil. You can install it with pip install pylint[testutil].

      Closes #5486

    • Reinstated checks from the python3 checker that are still useful for python 3 (eq-without-hash). This is now in the pylint.extensions.eq_without_hash optional extension.

      Closes #5025

    • Fixed an issue where ungrouped-imports could not be disabled without raising useless-suppression.

      Ref #2366

    • Added several checkers to deal with unicode security issues (see Trojan Sources <https://trojansource.codes/>_ and PEP 672 <https://www.python.org/dev/peps/pep-0672/>_ for details) that also concern the readability of the code. In detail the following checks were added:

      • bad-file-encoding checks that the file is encoded in UTF-8 as suggested by PEP8 <https://www.python.org/dev/peps/pep-0008/#id20>. UTF-16 and UTF-32 are not supported by Python <https://bugs.python.org/issue1503789> at the moment. If this ever changes invalid-unicode-codec checks that they aren't used, to allow for backwards compatibility.

      • bidirectional-unicode checks for bidirectional unicode characters that could make code execution different than what the user expects.

      • invalid-character-backspace, invalid-character-carriage-return, invalid-character-sub, invalid-character-esc, invalid-character-zero-width-space and invalid-character-nul to check for possibly harmful unescaped characters.

      Closes #5281

    • Use the tomli package instead of toml to parse .toml files.

    Closes #5885

    • Fix false positive - Allow unpacking of self in a subclass of typing.NamedTuple.

    Closes #5312

    • Fixed false negative unpacking-non-sequence when value is an empty list.

    Closes #5707

    • Better warning messages for useless else or elif when a function returns early.

      Closes #5614

    • Fixed false positive consider-using-dict-comprehension when creating a dict using a list of tuples where key AND value vary depending on the same condition.

      Closes #5588

    • Fixed false positive for global-variable-undefined when global is used with a class name

      Closes #3088

    • Fixed false positive for unused-variable when a nonlocal name is assigned as part of a multi-name assignment.

      Closes #3781

    • Fixed a crash in unspecified-encoding checker when providing None to the mode argument of an open() call.

      Closes #5731

    • Fixed a crash involving a NewType named with an f-string.

      Closes #5770 Ref PyCQA/astroid#1400

    • Improved bad-open-mode message when providing None to the mode argument of an open() call.

      Closes #5733

    • Added lru-cache-decorating-method checker with checks for the use of functools.lru_cache on class methods. This is unrecommended as it creates memory leaks by never letting the instance getting garbage collected.

      Closes #5670

    • Fixed crash with recursion error for inference of class attributes that referenced the class itself.

      Closes #5408 Ref PyCQA/astroid#1392

    • Fixed false positive for unused-argument when a method overridden in a subclass does nothing with the value of a keyword-only argument.

      Closes #5771 Ref PyCQA/astroid#1382

    • The issue template for crashes is now created for crashes which were previously not covered by this mechanism.

      Closes #5668

    • Rewrote checker for non-ascii-name. It now ensures all Python names are ASCII and also properly checks the names of imports (non-ascii-module-import) as well as file names (non-ascii-file-name) and emits their respective new warnings.

      Non ASCII characters could be homoglyphs (look alike characters) and hard to enter on a non specialized keyboard. See Confusable Characters in PEP 672 <https://www.python.org/dev/peps/pep-0672/#confusable-characters-in-identifiers>_

    • When run in parallel mode pylint now pickles the data passed to subprocesses with the dill package. The dill package has therefore been added as a dependency.

    • An astroid issue where symlinks were not being taken into account was fixed

      Closes #1470 Closes #3499 Closes #4302 Closes #4798 Closes #5081

    • Fix a crash in unused-private-member checker when analyzing code using type(self) in bound methods.

      Closes #5569

    • Optimize parsing of long lines when missing-final-newline is enabled.

      Closes #5724

    • Fix false positives for used-before-assignment from using named expressions in a ternary operator test and using that expression as a call argument.

      Closes #5177, #5212

    • Fix false positive for undefined-variable when namedtuple class attributes are used as return annotations.

      Closes #5568

    • Fix false negative for undefined-variable and related variable messages when the same undefined variable is used as a type annotation and is accessed multiple times, or is used as a default argument to a function.

      Closes #5399

    • Pyreverse - add output in mermaidjs format

    • Emit used-before-assignment instead of undefined-variable when attempting to access unused type annotations.

      Closes #5713

    • Added confidence level CONTROL_FLOW for warnings relying on assumptions about control flow.

    • used-before-assignment now considers that assignments in a try block may not have occurred when the except or finally blocks are executed.

      Closes #85, #2615

    • Fixed false negative for used-before-assignment when a conditional or context manager intervened before the try statement that suggested it might fail.

      Closes #4045

    • Fixed false negative for used-before-assignment in finally blocks if an except handler did not define the assignment that might have failed in the try block.

    • Fixed extremely long processing of long lines with comma's.

      Closes #5483

    • Fixed crash on properties and inherited class methods when comparing them for equality against an empty dict.

      Closes #5646

    • Fixed a false positive for assigning-non-slot when the slotted class defined __setattr__.

      Closes #3793

    • Fixed a false positive for invalid-class-object when the object being assigned to the __class__ attribute is uninferable.

    • Fixed false positive for used-before-assignment with self-referential type annotation in conditional statements within class methods.

      Closes #5499

    • Add checker redefined-slots-in-subclass: Emitted when a slot is redefined in a subclass.

      Closes #5617

    • Fixed false positive for global-variable-not-assigned when the del statement is used

      Closes #5333

    • By default, pylint does no longer take files starting with .# into account. Those are considered emacs file locks. See https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html. This behavior can be reverted by redefining the ignore-patterns option.

      Closes #367

    • Fixed a false positive for used-before-assignment when a named expression appears as the first value in a container.

      Closes #5112

    • used-before-assignment now assumes that assignments in except blocks may not have occurred and warns accordingly.

      Closes #4761

    • When evaluating statements after an except block, used-before-assignment assumes that assignments in the except blocks took place if the corresponding try block contained a return statement.

      Closes #5500

    • Fixed a false negative for used-before-assignment when some but not all except handlers defined a name relied upon after an except block when the corresponding try block contained a return statement.

      Closes #5524

    • When evaluating statements in the else clause of a loop, used-before-assignment assumes that assignments in the except blocks took place if the except handlers constituted the only ways for the loop to finish without breaking early.

      Closes #5683

    • used-before-assignment now checks names in try blocks.

    • Fixed false positive with used-before-assignment for assignment expressions in lambda statements.

      Closes #5360, #3877

    • Fixed a false positive (affecting unreleased development) for used-before-assignment involving homonyms between filtered comprehensions and assignments in except blocks.

      Closes #5586

    • Fixed crash with slots assignments and annotated assignments.

      Closes #5479

    • Fixed crash on list comprehensions that used type as inner variable name.

      Closes #5461

    • Fixed crash in use-maxsplit-arg checker when providing the sep argument to str.split() by keyword.

      Closes #5737

    • Fix false positive for unused-variable for a comprehension variable matching an outer scope type annotation.

      Closes #5326

    • Fix false negative for undefined-variable for a variable used multiple times in a comprehension matching an unused outer scope type annotation.

      Closes #5654

    • Some files in pylint.testutils were deprecated. In the future imports should be done from the pylint.testutils.functional namespace directly.

    • Fixed false positives for no-value-for-parameter with variadic positional arguments.

      Closes #5416

    • safe_infer no longer makes an inference when given two function definitions with differing numbers of arguments.

      Closes #3675

    • Fix comparison-with-callable false positive for callables that raise, such as typing constants.

      Closes #5557

    • Fixed a crash on __init__ nodes when the attribute was previously uninferable due to a cache limit size. This limit can be hit when the inheritance pattern of a class (and therefore of the __init__ attribute) is very large.

      Closes #5679

    • Fix false positive for used-before-assignment from a class definition nested under a function subclassing a class defined outside the function.

      Closes #4590

    • Fix unnecessary_dict_index_lookup false positive when deleting a dictionary's entry.

      Closes #4716

    • Fix false positive for used-before-assignment when an except handler shares a name with a test in a filtered comprehension.

      Closes #5817

    • Fix crash in unnecessary-dict-index-lookup checker if the output of items() is assigned to a 1-tuple.

      Closes #5504

    • When invoking pylint, epylint, symilar or pyreverse by importing them in a python file you can now pass an argv keyword besides patching sys.argv.

      Closes #5320

    • The PyLinter class will now be initialized with a TextReporter as its reporter if none is provided.

    • Fix super-init-not-called when parent or self is a Protocol

      Closes #4790

    • Fix false positive not-callable with attributes that alias NamedTuple

      Partially closes #1730

    • Emit redefined-outer-name when a nested except handler shadows an outer one.

      Closes #4434 Closes #5370

    • Fix false positive super-init-not-called for classes that inherit their init from a parent.

      Closes #4941

    • encoding can now be supplied as a positional argument to calls that open files without triggering unspecified-encoding.

      Closes #5638

    • Fatal errors now emit a score of 0.0 regardless of whether the linted module contained any statements

      Closes #5451

    • fatal was added to the variables permitted in score evaluation expressions.

    • The default score evaluation now uses a floor of 0.

      Closes #2399

    • Fix false negative for consider-iterating-dictionary during membership checks encapsulated in iterables or not in checks

      Closes #5323

    • Fixed crash on uninferable decorators on Python 3.6 and 3.7

    • Add checker unnecessary-ellipsis: Emitted when the ellipsis constant is used unnecessarily.

      Closes #5460

    • Disable checker bad-docstring-quotes for Python <= 3.7, because in these versions the line numbers for decorated functions and classes are not reliable which interferes with the checker.

      Closes #3077

    • Fixed incorrect classification of Numpy-style docstring as Google-style docstring for docstrings with property setter documentation. Docstring classification is now based on the highest amount of matched sections instead of the order in which the docstring styles were tried.

    • Fixed detection of arguments-differ when superclass static methods lacked a @staticmethod decorator.

      Closes #5371

    • TypingChecker

      • Added new check broken-noreturn to detect broken uses of typing.NoReturn if py-version is set to Python 3.7.1 or below. https://bugs.python.org/issue34921

      • Added new check broken-collections-callable to detect broken uses of collections.abc.Callable if py-version is set to Python 3.9.1 or below. https://bugs.python.org/issue42965

    • The testutils for unittests now accept end_lineno and end_column. Tests without these will trigger a DeprecationWarning.

    • arguments-differ will no longer complain about method redefinitions with extra parameters that have default values.

      Closes #1556, #5338

    • Fixed false positive unexpected-keyword-arg for decorators.

      Closes #258

    • Importing the deprecated stdlib module xml.etree.cElementTree now emits deprecated_module.

      Closes #5862

    • Disables for deprecated-module and similar warnings for stdlib features deprecated in newer versions of Python no longer raise useless-suppression when linting with older Python interpreters where those features are not yet deprecated.

    • Importing the deprecated stdlib module distutils now emits deprecated_module on Python 3.10+.

    • missing-raises-doc will now check the class hierarchy of the raised exceptions

      .. code-block:: python

      def my_function() """My function.

      Raises:
        Exception: if something fails
      """
      raise ValueError
      

      Closes #4955

    • Allow disabling duplicate-code with a disable comment when running through pylint.

      Closes #214

    • Improve invalid-name check for TypeVar names. The accepted pattern can be customized with --typevar-rgx.

      Closes #3401

    • Added new checker typevar-name-missing-variance. Emitted when a covariant or contravariant TypeVar does not end with _co or _contra respectively or when a TypeVar is not either but has a suffix.

    • Allow usage of mccabe 0.7.x release

      Closes #5878

    • Fix unused-private-member false positive when accessing private methods through property.

      Closes #4756

    Source code(tar.gz)
    Source code(zip)
  • v2.12.2(Dec 3, 2021)

    • Fixed a false positive for unused-import where everything was not analyzed properly inside typing guards.

    • Fixed a false-positive regression for used-before-assignment for typed variables in the body of class methods that reference the same class

      Closes #5342

    • Specified that the ignore-paths option considers "" to represent a windows directory delimiter instead of a regular expression escape character.

    • Fixed a crash with the ignore-paths option when invoking the option via the command line.

      Closes #5437

    • Fixed handling of Sphinx-style parameter docstrings with asterisks. These should be escaped with by prepending a "".

      Closes #5406

    • Add endLine and endColumn keys to output of JSONReporter.

      Closes #5380

    • Fixed handling of Google-style parameter specifications where descriptions are on the line following the parameter name. These were generating false positives for missing-param-doc.

      Closes #5452

    • Fix false negative for consider-iterating-dictionary during membership checks encapsulated in iterables or not in checks

      Closes #5323

    • unused-import now check all ancestors for typing guards

      Closes #5316

    Source code(tar.gz)
    Source code(zip)
  • v2.12.1(Nov 25, 2021)

Owner
Python Code Quality Authority
Organization for code quality tools (and plugins) for the Python programming language
Python Code Quality Authority
A python documentation linter which checks that the docstring description matches the definition.

Darglint A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expe

Terrence Reilly 463 Dec 31, 2022
Mylint - My really simple rendition of how a linter works.

mylint My really simple rendition of how a linter works. This original version was written for my AST article. Since then I've added tests and turned

Tushar Sadhwani 2 Dec 29, 2021
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." ― John F. Woods coala provides a

coala development group 3.4k Dec 29, 2022
❄️ A flake8 plugin to help you write better list/set/dict comprehensions.

flake8-comprehensions A flake8 plugin that helps you write better list/set/dict comprehensions. Requirements Python 3.6 to 3.9 supported. Installation

Adam Johnson 398 Dec 23, 2022
This Project is based on NLTK It generates a RANDOM WORD from a predefined list of words, From that random word it read out the word, its meaning with parts of speech , its antonyms, its synonyms

This Project is based on NLTK(Natural Language Toolkit) It generates a RANDOM WORD from a predefined list of words, From that random word it read out the word, its meaning with parts of speech , its antonyms, its synonyms

SaiVenkatDhulipudi 2 Nov 17, 2021
Just a script for detecting the lanes in any car game (not just gta 5) with specific resolution and road design ( very basic and limited )

GTA-5-Lane-detection Just a script for detecting the lanes in any car game (not just gta 5) with specific resolution and road design ( very basic and

Danciu Georgian 4 Aug 1, 2021
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 5, 2023
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 1, 2023
A python documentation linter which checks that the docstring description matches the definition.

Darglint A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expe

Terrence Reilly 463 Dec 31, 2022
A Regex based linter tool that works for any language and works exclusively with custom linting rules.

renag Documentation Available Here Short for Regex (re) Nag (like "one who complains"). Now also PEGs (Parsing Expression Grammars) compatible with py

Ryan Peach 12 Oct 20, 2022
Your missing PO formatter and linter

pofmt Your missing PO formatter and linter Features Wrap msgid and msgstr with a constant max width. Can act as a pre-commit hook. Display lint errors

Frost Ming 5 Mar 22, 2022
A linter to manage all your python exceptions and try/except blocks (limited only for those who like dinosaurs).

Manage your exceptions in Python like a PRO Currently in BETA. Inspired by this blog post. I shared the building process of this tool here. “For those

Guilherme Latrova 353 Dec 31, 2022
HTML Template Linter and Formatter. Use with Django, Jinja, Nunjucks and Handlebars templates.

Find common formatting issues and reformat HTML templates. Django · Jinja · Nunjucks · Handlebars · Mustache · GoLang Ps, --check it out on other temp

Riverside Healthcare Analytics 263 Jan 1, 2023
Mylint - My really simple rendition of how a linter works.

mylint My really simple rendition of how a linter works. This original version was written for my AST article. Since then I've added tests and turned

Tushar Sadhwani 2 Dec 29, 2021
I got bored and wrote a wordle solver... Its pretty good though, just saying

Wordle Solver I got bored and wrote a wordle solver... Its pretty good though, just saying. Please go support Josh and have fun with Wordle on the off

Darrell Best 2 Jan 25, 2022
Generate custom detailed survey paper with topic clustered sections and proper citations, from just a single query in just under 30 mins !!

Auto-Research A no-code utility to generate a detailed well-cited survey with topic clustered sections (draft paper format) and other interesting arti

Sidharth Pal 20 Dec 14, 2022
Just-Now - This Is Just Now Login Friendlist Cloner Tools

JUST NOW LOGIN FRIENDLIST CLONER TOOLS Install $ apt update $ apt upgrade $ apt

MAHADI HASAN AFRIDI 21 Mar 9, 2022
{Ninja-IDE Is Not Just Another IDE}

Ninja-IDE Is Not Just Another IDE Ninja-IDE is a cross-platform integrated development environment (IDE) that allows developers to create applications

ninja-ide 919 Dec 14, 2022
Index different CKAN entities in Solr, not just datasets

ckanext-sitesearch Index different CKAN entities in Solr, not just datasets Requirements This extension requires CKAN 2.9 or higher and Python 3 Featu

Open Knowledge Foundation 3 Dec 2, 2022