summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.coveragerc6
-rw-r--r--.github/ISSUE_TEMPLATE/BUG-REPORT.yml2
-rw-r--r--.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml2
-rw-r--r--.github/ISSUE_TEMPLATE/QUESTION.yml3
-rw-r--r--.github/dependabot.yml2
-rw-r--r--.github/workflows/changelog.yml6
-rw-r--r--.github/workflows/checks.yaml28
-rw-r--r--.github/workflows/codeql-analysis.yml2
-rw-r--r--.github/workflows/primer-test.yaml46
-rw-r--r--.github/workflows/primer_comment.yaml12
-rw-r--r--.github/workflows/primer_run_main.yaml14
-rw-r--r--.github/workflows/primer_run_pr.yaml14
-rw-r--r--.github/workflows/release.yml4
-rw-r--r--.github/workflows/tests.yaml46
-rw-r--r--.pre-commit-config.yaml49
-rw-r--r--.pyenchant_pylint_custom_dict.txt4
-rw-r--r--CONTRIBUTORS.txt19
-rw-r--r--README.rst45
-rw-r--r--doc/conf.py19
-rw-r--r--doc/contact.rst4
-rw-r--r--doc/data/messages/a/arguments-renamed/bad.py3
-rw-r--r--doc/data/messages/a/arguments-renamed/good.py3
-rw-r--r--doc/data/messages/a/assigning-non-slot/bad.py2
-rw-r--r--doc/data/messages/a/assigning-non-slot/good.py2
-rw-r--r--doc/data/messages/b/bad-chained-comparison/bad.py4
-rw-r--r--doc/data/messages/b/bad-chained-comparison/good.py4
-rw-r--r--doc/data/messages/b/bad-classmethod-argument/bad.py1
-rw-r--r--doc/data/messages/b/bad-classmethod-argument/good.py1
-rw-r--r--doc/data/messages/b/bad-docstring-quotes/bad.py2
-rw-r--r--doc/data/messages/b/bad-file-encoding/bad.py1
-rw-r--r--doc/data/messages/b/bad-file-encoding/details.rst1
-rw-r--r--doc/data/messages/b/bad-file-encoding/good.py1
-rw-r--r--doc/data/messages/b/bad-format-character/details.rst2
-rw-r--r--doc/data/messages/b/bad-format-string/bad.py2
-rw-r--r--doc/data/messages/b/bad-format-string/good.py2
-rw-r--r--doc/data/messages/b/bad-indentation/good.py2
-rw-r--r--doc/data/messages/b/bad-plugin-value/details.rst2
-rw-r--r--doc/data/messages/b/bad-string-format-type/details.rst2
-rw-r--r--doc/data/messages/b/bad-thread-instantiation/bad.py2
-rw-r--r--doc/data/messages/b/bad-thread-instantiation/good.py2
-rw-r--r--doc/data/messages/c/c-extension-no-member/details.rst2
-rw-r--r--doc/data/messages/c/cell-var-from-loop/bad.py2
-rw-r--r--doc/data/messages/c/class-variable-slots-conflict/good.py2
-rw-r--r--doc/data/messages/c/compare-to-empty-string/bad.py8
-rw-r--r--doc/data/messages/c/compare-to-empty-string/good.py8
-rw-r--r--doc/data/messages/c/compare-to-empty-string/pylintrc2
-rw-r--r--doc/data/messages/c/compare-to-zero/bad.py8
-rw-r--r--doc/data/messages/c/compare-to-zero/good.py8
-rw-r--r--doc/data/messages/c/compare-to-zero/pylintrc2
-rw-r--r--doc/data/messages/c/comparison-with-callable/bad.py1
-rw-r--r--doc/data/messages/c/comparison-with-callable/good.py1
-rw-r--r--doc/data/messages/c/confusing-with-statement/bad.py2
-rw-r--r--doc/data/messages/c/confusing-with-statement/good.py4
-rw-r--r--doc/data/messages/c/consider-merging-isinstance/bad.py3
-rw-r--r--doc/data/messages/c/consider-using-any-or-all/good.py2
-rw-r--r--doc/data/messages/c/consider-using-enumerate/bad.py2
-rw-r--r--doc/data/messages/c/consider-using-enumerate/good.py2
-rw-r--r--doc/data/messages/c/consider-using-f-string/good.py2
-rw-r--r--doc/data/messages/c/consider-using-generator/related.rst4
-rw-r--r--doc/data/messages/c/consider-using-in/bad.py3
-rw-r--r--doc/data/messages/c/consider-using-join/bad.py1
-rw-r--r--doc/data/messages/c/cyclic-import/details.rst2
-rw-r--r--doc/data/messages/d/deprecated-method/bad.py2
-rw-r--r--doc/data/messages/d/dict-init-mutate/bad.py4
-rw-r--r--doc/data/messages/d/dict-iter-missing-items/bad.py2
-rw-r--r--doc/data/messages/d/dict-iter-missing-items/good.py2
-rw-r--r--doc/data/messages/d/duplicate-code/bad/orange.py2
-rw-r--r--doc/data/messages/d/duplicate-value/bad.py2
-rw-r--r--doc/data/messages/d/duplicate-value/good.py2
-rw-r--r--doc/data/messages/e/exec-used/good.py9
-rw-r--r--doc/data/messages/f/fixme/details.rst2
-rw-r--r--doc/data/messages/f/forgotten-debug-statement/bad.py9
-rw-r--r--doc/data/messages/f/forgotten-debug-statement/good.py7
-rw-r--r--doc/data/messages/f/format-combined-specification/bad.py2
-rw-r--r--doc/data/messages/f/format-combined-specification/good.py4
-rw-r--r--doc/data/messages/i/implicit-str-concat/details.rst26
-rw-r--r--doc/data/messages/i/implicit-str-concat/related.rst1
-rw-r--r--doc/data/messages/i/import-outside-toplevel/bad.py1
-rw-r--r--doc/data/messages/i/import-private-name/bad.py3
-rw-r--r--doc/data/messages/i/import-private-name/good.py2
-rw-r--r--doc/data/messages/i/init-is-generator/bad.py1
-rw-r--r--doc/data/messages/i/init-is-generator/good.py1
-rw-r--r--doc/data/messages/i/invalid-all-format/bad.py2
-rw-r--r--doc/data/messages/i/invalid-all-object/bad.py2
-rw-r--r--doc/data/messages/i/invalid-all-object/good.py4
-rw-r--r--doc/data/messages/i/invalid-character-backspace/bad.py2
-rw-r--r--doc/data/messages/i/invalid-character-carriage-return/details.rst2
-rw-r--r--doc/data/messages/i/invalid-character-esc/bad.py2
-rw-r--r--doc/data/messages/i/invalid-character-nul/details.rst2
-rw-r--r--doc/data/messages/i/invalid-character-sub/bad.py2
-rw-r--r--doc/data/messages/i/invalid-character-zero-width-space/bad.py2
-rw-r--r--doc/data/messages/i/invalid-envvar-default/bad.py2
-rw-r--r--doc/data/messages/i/invalid-envvar-default/good.py2
-rw-r--r--doc/data/messages/i/invalid-envvar-value/good.py2
-rw-r--r--doc/data/messages/i/invalid-format-index/good.py2
-rw-r--r--doc/data/messages/i/invalid-length-returned/bad.py2
-rw-r--r--doc/data/messages/i/invalid-metaclass/good.py1
-rw-r--r--doc/data/messages/i/invalid-name/bad.py1
-rw-r--r--doc/data/messages/i/invalid-name/good.py1
-rw-r--r--doc/data/messages/i/invalid-overridden-method/bad.py1
-rw-r--r--doc/data/messages/i/invalid-overridden-method/good.py1
-rw-r--r--doc/data/messages/i/invalid-sequence-index/bad.py4
-rw-r--r--doc/data/messages/i/invalid-sequence-index/good.py2
-rw-r--r--doc/data/messages/i/invalid-slots-object/bad.py2
-rw-r--r--doc/data/messages/i/invalid-slots-object/good.py2
-rw-r--r--doc/data/messages/i/invalid-slots/good.py2
-rw-r--r--doc/data/messages/i/invalid-star-assignment-target/bad.py2
-rw-r--r--doc/data/messages/i/invalid-star-assignment-target/good.py2
-rw-r--r--doc/data/messages/i/invalid-unary-operand-type/bad.py2
-rw-r--r--doc/data/messages/i/invalid-unicode-codec/details.rst2
-rw-r--r--doc/data/messages/i/invalid-unicode-codec/good.py1
-rw-r--r--doc/data/messages/l/line-too-long/details.rst2
-rw-r--r--doc/data/messages/l/locally-disabled/bad.py1
-rw-r--r--doc/data/messages/l/locally-disabled/good.py1
-rw-r--r--doc/data/messages/l/logging-format-interpolation/bad.py3
-rw-r--r--doc/data/messages/l/logging-format-interpolation/good.py2
-rw-r--r--doc/data/messages/l/logging-fstring-interpolation/bad.py2
-rw-r--r--doc/data/messages/l/logging-fstring-interpolation/good.py2
-rw-r--r--doc/data/messages/l/logging-not-lazy/bad.py2
-rw-r--r--doc/data/messages/l/logging-not-lazy/good.py2
-rw-r--r--doc/data/messages/l/logging-too-few-args/bad.py2
-rw-r--r--doc/data/messages/l/logging-too-few-args/good.py2
-rw-r--r--doc/data/messages/l/logging-too-many-args/bad.py2
-rw-r--r--doc/data/messages/l/logging-too-many-args/good.py2
-rw-r--r--doc/data/messages/l/logging-unsupported-format/bad.py2
-rw-r--r--doc/data/messages/m/magic-value-comparison/bad.py4
-rw-r--r--doc/data/messages/m/misplaced-format-function/bad.py2
-rw-r--r--doc/data/messages/m/misplaced-format-function/good.py2
-rw-r--r--doc/data/messages/m/missing-any-param-doc/bad.py2
-rw-r--r--doc/data/messages/m/missing-any-param-doc/good.py4
-rw-r--r--doc/data/messages/m/missing-class-docstring/bad.py1
-rw-r--r--doc/data/messages/m/missing-final-newline/good.py2
-rw-r--r--doc/data/messages/m/missing-kwoa/bad.py3
-rw-r--r--doc/data/messages/m/missing-kwoa/good.py1
-rw-r--r--doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py1
-rw-r--r--doc/data/messages/m/missing-parentheses-for-call-in-test/good.py1
-rw-r--r--doc/data/messages/m/missing-raises-doc/bad.py2
-rw-r--r--doc/data/messages/m/missing-raises-doc/good.py2
-rw-r--r--doc/data/messages/m/mixed-line-endings/details.rst2
-rw-r--r--doc/data/messages/n/named-expr-without-context/good.py4
-rw-r--r--doc/data/messages/n/no-else-continue/bad.py2
-rw-r--r--doc/data/messages/n/no-else-continue/good.py2
-rw-r--r--doc/data/messages/n/no-else-raise/bad.py4
-rw-r--r--doc/data/messages/n/no-else-raise/good.py2
-rw-r--r--doc/data/messages/n/no-self-use/bad.py1
-rw-r--r--doc/data/messages/n/no-value-for-parameter/bad.py1
-rw-r--r--doc/data/messages/n/no-value-for-parameter/good.py1
-rw-r--r--doc/data/messages/o/overlapping-except/good.py6
-rw-r--r--doc/data/messages/p/positional-only-arguments-expected/bad.py3
-rw-r--r--doc/data/messages/p/positional-only-arguments-expected/good.py1
-rw-r--r--doc/data/messages/r/raw-checker-failed/details.rst2
-rw-r--r--doc/data/messages/r/redefined-argument-from-local/bad.py3
-rw-r--r--doc/data/messages/r/redefined-argument-from-local/good.py2
-rw-r--r--doc/data/messages/r/relative-beyond-top-level/details.rst2
-rw-r--r--doc/data/messages/r/return-arg-in-generator/details.rst1
-rw-r--r--doc/data/messages/r/return-arg-in-generator/good.py5
-rw-r--r--doc/data/messages/r/return-in-init/bad.py1
-rw-r--r--doc/data/messages/r/return-in-init/good.py1
-rw-r--r--doc/data/messages/s/self-cls-assignment/bad.py2
-rw-r--r--doc/data/messages/s/self-cls-assignment/good.py2
-rw-r--r--doc/data/messages/s/simplifiable-if-statement/bad.py3
-rw-r--r--doc/data/messages/s/subprocess-popen-preexec-fn/bad.py2
-rw-r--r--doc/data/messages/s/syntax-error/good.py6
-rw-r--r--doc/data/messages/t/too-few-public-methods/good.py7
-rw-r--r--doc/data/messages/t/too-many-boolean-expressions/good.py2
-rw-r--r--doc/data/messages/t/too-many-locals/bad.py4
-rw-r--r--doc/data/messages/t/too-many-return-statements/bad.py14
-rw-r--r--doc/data/messages/t/too-many-return-statements/good.py16
-rw-r--r--doc/data/messages/t/truncated-format-string/bad.py2
-rw-r--r--doc/data/messages/u/undefined-all-variable/bad.py1
-rw-r--r--doc/data/messages/u/undefined-all-variable/good.py1
-rw-r--r--doc/data/messages/u/unnecessary-direct-lambda-call/bad.py2
-rw-r--r--doc/data/messages/u/unnecessary-direct-lambda-call/good.py2
-rw-r--r--doc/data/messages/u/unnecessary-dunder-call/bad.py2
-rw-r--r--doc/data/messages/u/unnecessary-lambda-assignment/bad.py2
-rw-r--r--doc/data/messages/u/unnecessary-lambda-assignment/good.py2
-rw-r--r--doc/data/messages/u/unnecessary-list-index-lookup/bad.py2
-rw-r--r--doc/data/messages/u/unnecessary-list-index-lookup/good.py2
-rw-r--r--doc/data/messages/u/unnecessary-pass/bad.py1
-rw-r--r--doc/data/messages/u/unrecognized-option/details.rst2
-rw-r--r--doc/data/messages/u/unsupported-binary-operation/good.py2
-rw-r--r--doc/data/messages/u/unsupported-membership-test/good.py1
-rw-r--r--doc/data/messages/u/unused-format-string-key/bad.py7
-rw-r--r--doc/data/messages/u/unused-format-string-key/good.py5
-rw-r--r--doc/data/messages/u/unused-wildcard-import/bad.py3
-rw-r--r--doc/data/messages/u/unused-wildcard-import/good.py3
-rw-r--r--doc/data/messages/u/use-a-generator/related.rst2
-rw-r--r--doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py6
-rw-r--r--doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py6
-rw-r--r--doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc2
-rw-r--r--doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py6
-rw-r--r--doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py6
-rw-r--r--doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc2
-rw-r--r--doc/data/messages/u/useless-option-value/bad.py2
-rw-r--r--doc/data/messages/u/useless-option-value/good.py2
-rw-r--r--doc/data/messages/u/useless-parent-delegation/bad.py2
-rw-r--r--doc/data/messages/u/useless-parent-delegation/good.py1
-rw-r--r--doc/data/messages/u/using-constant-test/bad.py4
-rw-r--r--doc/data/messages/u/using-constant-test/good.py2
-rw-r--r--doc/data/messages/w/while-used/bad.py4
-rw-r--r--doc/data/messages/w/while-used/good.py4
-rw-r--r--doc/data/messages/w/wrong-exception-operation/bad.py4
-rw-r--r--doc/data/messages/w/wrong-exception-operation/good.py2
-rw-r--r--doc/data/messages/w/wrong-import-position/bad.py4
-rw-r--r--doc/data/messages/w/wrong-import-position/good.py4
-rw-r--r--doc/data/ruff.toml10
-rw-r--r--doc/development_guide/api/epylint.rst22
-rw-r--r--doc/development_guide/api/index.rst3
-rw-r--r--doc/development_guide/contributor_guide/contribute.rst34
-rw-r--r--doc/development_guide/contributor_guide/release.md10
-rw-r--r--doc/development_guide/contributor_guide/tests/install.rst6
-rw-r--r--doc/development_guide/contributor_guide/tests/launching_test.rst4
-rw-r--r--doc/development_guide/contributor_guide/tests/writing_test.rst2
-rw-r--r--doc/development_guide/how_tos/custom_checkers.rst6
-rw-r--r--doc/development_guide/how_tos/transform_plugins.rst2
-rwxr-xr-xdoc/exts/pylint_extensions.py34
-rwxr-xr-xdoc/exts/pylint_features.py4
-rw-r--r--doc/exts/pylint_messages.py6
-rw-r--r--doc/exts/pylint_options.py4
-rw-r--r--doc/pyreverse.rst2
-rw-r--r--doc/requirements.txt6
-rw-r--r--doc/symilar.rst1
-rw-r--r--doc/test_messages_documentation.py4
-rw-r--r--doc/user_guide/checkers/extensions.rst30
-rw-r--r--doc/user_guide/checkers/features.rst32
-rw-r--r--doc/user_guide/configuration/all-options.rst2
-rw-r--r--doc/user_guide/installation/badge.rst6
-rw-r--r--doc/user_guide/installation/ide_integration/flymake-emacs.rst75
-rw-r--r--doc/user_guide/messages/messages_overview.rst6
-rw-r--r--doc/user_guide/usage/run.rst3
-rw-r--r--doc/whatsnew/2/2.1/full.rst2
-rw-r--r--doc/whatsnew/2/2.10/summary.rst2
-rw-r--r--doc/whatsnew/2/2.11/summary.rst2
-rw-r--r--doc/whatsnew/2/2.12/full.rst2
-rw-r--r--doc/whatsnew/2/2.13/full.rst8
-rw-r--r--doc/whatsnew/2/2.13/summary.rst10
-rw-r--r--doc/whatsnew/2/2.14/summary.rst2
-rw-r--r--doc/whatsnew/2/2.15/index.rst192
-rw-r--r--doc/whatsnew/2/2.16/index.rst274
-rw-r--r--doc/whatsnew/2/2.17/index.rst62
-rw-r--r--doc/whatsnew/2/2.3/full.rst2
-rw-r--r--doc/whatsnew/2/2.9/full.rst4
-rw-r--r--doc/whatsnew/3/3.0/index.rst23
-rw-r--r--doc/whatsnew/3/index.rst9
-rw-r--r--doc/whatsnew/fragments/1144.false_negative3
-rw-r--r--doc/whatsnew/fragments/1954.performance4
-rw-r--r--doc/whatsnew/fragments/3670.false_positive3
-rw-r--r--doc/whatsnew/fragments/5488.other3
-rw-r--r--doc/whatsnew/fragments/6306.breaking3
-rw-r--r--doc/whatsnew/fragments/6871.user_action17
-rw-r--r--doc/whatsnew/fragments/7163.other3
-rw-r--r--doc/whatsnew/fragments/7506.false_positive3
-rw-r--r--doc/whatsnew/fragments/7578.bugfix3
-rw-r--r--doc/whatsnew/fragments/7737.user_action3
-rw-r--r--doc/whatsnew/fragments/8167.false_positive4
-rw-r--r--doc/whatsnew/fragments/8181.feature5
-rw-r--r--doc/whatsnew/fragments/8198.bugfix4
-rw-r--r--doc/whatsnew/fragments/8251.breaking5
-rw-r--r--doc/whatsnew/fragments/8361.bugfix4
-rw-r--r--doc/whatsnew/fragments/8401.internal4
-rw-r--r--doc/whatsnew/fragments/8403.false_positive5
-rw-r--r--doc/whatsnew/fragments/8404.breaking7
-rw-r--r--doc/whatsnew/fragments/8404.internal8
-rw-r--r--doc/whatsnew/fragments/8405.other3
-rw-r--r--doc/whatsnew/fragments/8407.internal5
-rw-r--r--doc/whatsnew/fragments/8408.internal3
-rw-r--r--doc/whatsnew/fragments/8409.internal24
-rw-r--r--doc/whatsnew/fragments/8410.false_positive3
-rw-r--r--doc/whatsnew/fragments/8411.user_action7
-rw-r--r--doc/whatsnew/fragments/8412.internal3
-rw-r--r--doc/whatsnew/fragments/8416.breaking3
-rw-r--r--doc/whatsnew/fragments/8424.false_positive3
-rw-r--r--doc/whatsnew/fragments/8433.internal10
-rw-r--r--doc/whatsnew/fragments/8434.bugfix3
-rw-r--r--doc/whatsnew/fragments/8437.bugfix4
-rw-r--r--doc/whatsnew/fragments/8453.bugfix3
-rw-r--r--doc/whatsnew/fragments/8462.breaking5
-rw-r--r--doc/whatsnew/fragments/8463.internal3
-rw-r--r--doc/whatsnew/fragments/8464.internal3
-rw-r--r--doc/whatsnew/fragments/8465.user_action5
-rw-r--r--doc/whatsnew/fragments/8466.internal5
-rw-r--r--doc/whatsnew/fragments/8472.internal4
-rw-r--r--doc/whatsnew/fragments/8473.internal6
-rw-r--r--doc/whatsnew/fragments/8474.internal5
-rw-r--r--doc/whatsnew/fragments/8475.internal5
-rw-r--r--doc/whatsnew/fragments/8476.feature3
-rw-r--r--doc/whatsnew/fragments/8477.internal4
-rw-r--r--doc/whatsnew/fragments/8478.internal4
-rw-r--r--doc/whatsnew/fragments/8485.false_positive5
-rw-r--r--doc/whatsnew/fragments/8487.false_positive3
-rw-r--r--doc/whatsnew/fragments/8496.false_positive5
-rw-r--r--doc/whatsnew/fragments/8500.false_positive3
-rw-r--r--doc/whatsnew/fragments/8504.bugfix3
-rw-r--r--doc/whatsnew/fragments/8536.false_negative3
-rw-r--r--doc/whatsnew/fragments/8540.false_positive4
-rw-r--r--doc/whatsnew/fragments/8555.false_positive3
-rw-r--r--doc/whatsnew/fragments/8559.false_negative3
-rw-r--r--doc/whatsnew/fragments/8563.bugfix3
-rw-r--r--doc/whatsnew/fragments/8570.false_positive3
-rw-r--r--doc/whatsnew/fragments/8603.bugfix3
-rw-r--r--doc/whatsnew/fragments/8613.false_positive3
-rw-r--r--doc/whatsnew/fragments/8632.bugfix4
-rw-r--r--doc/whatsnew/index.rst1
-rw-r--r--examples/Dockerfile (renamed from Dockerfile)2
-rw-r--r--examples/pylintrc4
-rw-r--r--examples/pyproject.toml4
-rw-r--r--pylint/__init__.py26
-rw-r--r--pylint/__main__.py4
-rw-r--r--pylint/__pkginfo__.py10
-rw-r--r--pylint/checkers/__init__.py14
-rw-r--r--pylint/checkers/async.py4
-rw-r--r--pylint/checkers/bad_chained_comparison.py4
-rw-r--r--pylint/checkers/base/__init__.py4
-rw-r--r--pylint/checkers/base/basic_checker.py20
-rw-r--r--pylint/checkers/base/basic_error_checker.py4
-rw-r--r--pylint/checkers/base/comparison_checker.py4
-rw-r--r--pylint/checkers/base/docstring_checker.py11
-rw-r--r--pylint/checkers/base/name_checker/__init__.py4
-rw-r--r--pylint/checkers/base/name_checker/checker.py11
-rw-r--r--pylint/checkers/base/name_checker/naming_style.py4
-rw-r--r--pylint/checkers/base/pass_checker.py4
-rw-r--r--pylint/checkers/base_checker.py57
-rw-r--r--pylint/checkers/classes/__init__.py4
-rw-r--r--pylint/checkers/classes/class_checker.py11
-rw-r--r--pylint/checkers/classes/special_methods_checker.py4
-rw-r--r--pylint/checkers/deprecated.py4
-rw-r--r--pylint/checkers/design_analysis.py4
-rw-r--r--pylint/checkers/dunder_methods.py6
-rw-r--r--pylint/checkers/ellipsis_checker.py4
-rw-r--r--pylint/checkers/exceptions.py33
-rw-r--r--pylint/checkers/format.py17
-rw-r--r--pylint/checkers/imports.py32
-rw-r--r--pylint/checkers/lambda_expressions.py4
-rw-r--r--pylint/checkers/logging.py12
-rw-r--r--pylint/checkers/mapreduce_checker.py32
-rw-r--r--pylint/checkers/method_args.py4
-rw-r--r--pylint/checkers/misc.py5
-rw-r--r--pylint/checkers/modified_iterating_checker.py4
-rw-r--r--pylint/checkers/nested_min_max.py20
-rw-r--r--pylint/checkers/newstyle.py4
-rw-r--r--pylint/checkers/non_ascii_names.py4
-rw-r--r--pylint/checkers/raw_metrics.py12
-rw-r--r--pylint/checkers/refactoring/__init__.py4
-rw-r--r--pylint/checkers/refactoring/implicit_booleaness_checker.py134
-rw-r--r--pylint/checkers/refactoring/not_checker.py4
-rw-r--r--pylint/checkers/refactoring/recommendation_checker.py8
-rw-r--r--pylint/checkers/refactoring/refactoring_checker.py26
-rw-r--r--pylint/checkers/similar.py8
-rw-r--r--pylint/checkers/spelling.py12
-rw-r--r--pylint/checkers/stdlib.py6
-rw-r--r--pylint/checkers/strings.py14
-rw-r--r--pylint/checkers/threading_checker.py4
-rw-r--r--pylint/checkers/typecheck.py44
-rw-r--r--pylint/checkers/unicode.py4
-rw-r--r--pylint/checkers/unsupported_version.py6
-rw-r--r--pylint/checkers/utils.py223
-rw-r--r--pylint/checkers/variables.py380
-rw-r--r--pylint/config/__init__.py66
-rw-r--r--pylint/config/_pylint_config/__init__.py4
-rw-r--r--pylint/config/_pylint_config/generate_command.py11
-rw-r--r--pylint/config/_pylint_config/help_message.py4
-rw-r--r--pylint/config/_pylint_config/main.py4
-rw-r--r--pylint/config/_pylint_config/setup.py4
-rw-r--r--pylint/config/_pylint_config/utils.py11
-rw-r--r--pylint/config/argument.py13
-rw-r--r--pylint/config/arguments_manager.py439
-rw-r--r--pylint/config/arguments_provider.py177
-rw-r--r--pylint/config/callback_actions.py11
-rw-r--r--pylint/config/config_file_parser.py27
-rw-r--r--pylint/config/config_initialization.py4
-rw-r--r--pylint/config/configuration_mixin.py41
-rw-r--r--pylint/config/deprecation_actions.py5
-rw-r--r--pylint/config/environment_variable.py11
-rw-r--r--pylint/config/exceptions.py4
-rw-r--r--pylint/config/find_default_config_files.py53
-rw-r--r--pylint/config/help_formatter.py9
-rw-r--r--pylint/config/option.py239
-rw-r--r--pylint/config/option_manager_mixin.py372
-rw-r--r--pylint/config/option_parser.py56
-rw-r--r--pylint/config/options_provider_mixin.py123
-rw-r--r--pylint/config/utils.py27
-rw-r--r--pylint/constants.py54
-rwxr-xr-xpylint/epylint.py224
-rw-r--r--pylint/exceptions.py4
-rw-r--r--pylint/extensions/__init__.py4
-rw-r--r--pylint/extensions/_check_docs_utils.py4
-rw-r--r--pylint/extensions/bad_builtin.py4
-rw-r--r--pylint/extensions/broad_try_clause.py4
-rw-r--r--pylint/extensions/check_elif.py4
-rw-r--r--pylint/extensions/code_style.py4
-rw-r--r--pylint/extensions/comparetozero.py95
-rw-r--r--pylint/extensions/comparison_placement.py4
-rw-r--r--pylint/extensions/confusing_elif.py4
-rw-r--r--pylint/extensions/consider_refactoring_into_while_condition.py4
-rw-r--r--pylint/extensions/consider_ternary_expression.py4
-rw-r--r--pylint/extensions/dict_init_mutate.py4
-rw-r--r--pylint/extensions/docparams.py4
-rw-r--r--pylint/extensions/docstyle.py4
-rw-r--r--pylint/extensions/dunder.py4
-rw-r--r--pylint/extensions/empty_comment.py4
-rw-r--r--pylint/extensions/emptystring.py78
-rw-r--r--pylint/extensions/eq_without_hash.py6
-rw-r--r--pylint/extensions/for_any_all.py4
-rw-r--r--pylint/extensions/magic_value.py4
-rw-r--r--pylint/extensions/mccabe.py4
-rw-r--r--pylint/extensions/no_self_use.py4
-rw-r--r--pylint/extensions/overlapping_exceptions.py4
-rw-r--r--pylint/extensions/private_import.py4
-rw-r--r--pylint/extensions/redefined_loop_name.py4
-rw-r--r--pylint/extensions/redefined_variable_type.py4
-rw-r--r--pylint/extensions/set_membership.py4
-rw-r--r--pylint/extensions/typing.py4
-rw-r--r--pylint/extensions/while_used.py4
-rw-r--r--pylint/graph.py4
-rw-r--r--pylint/interfaces.py106
-rw-r--r--pylint/lint/__init__.py13
-rw-r--r--pylint/lint/base_options.py4
-rw-r--r--pylint/lint/caching.py5
-rw-r--r--pylint/lint/expand_modules.py19
-rw-r--r--pylint/lint/message_state_handler.py16
-rw-r--r--pylint/lint/parallel.py22
-rw-r--r--pylint/lint/pylinter.py167
-rw-r--r--pylint/lint/report_functions.py4
-rw-r--r--pylint/lint/run.py22
-rw-r--r--pylint/lint/utils.py102
-rw-r--r--pylint/message/__init__.py4
-rw-r--r--pylint/message/_deleted_message_ids.py16
-rw-r--r--pylint/message/message.py24
-rw-r--r--pylint/message/message_definition.py22
-rw-r--r--pylint/message/message_definition_store.py6
-rw-r--r--pylint/message/message_id_store.py4
-rw-r--r--pylint/py.typed0
-rw-r--r--pylint/pyreverse/__init__.py4
-rw-r--r--pylint/pyreverse/diadefslib.py17
-rw-r--r--pylint/pyreverse/diagrams.py27
-rw-r--r--pylint/pyreverse/dot_printer.py6
-rw-r--r--pylint/pyreverse/inspector.py53
-rw-r--r--pylint/pyreverse/main.py49
-rw-r--r--pylint/pyreverse/mermaidjs_printer.py9
-rw-r--r--pylint/pyreverse/plantuml_printer.py11
-rw-r--r--pylint/pyreverse/printer.py6
-rw-r--r--pylint/pyreverse/printer_factory.py6
-rw-r--r--pylint/pyreverse/utils.py9
-rw-r--r--pylint/pyreverse/vcg_printer.py303
-rw-r--r--pylint/pyreverse/writer.py31
-rw-r--r--pylint/reporters/__init__.py4
-rw-r--r--pylint/reporters/base_reporter.py23
-rw-r--r--pylint/reporters/collecting_reporter.py4
-rw-r--r--pylint/reporters/json_reporter.py14
-rw-r--r--pylint/reporters/multi_reporter.py4
-rw-r--r--pylint/reporters/reports_handler_mix_in.py4
-rw-r--r--pylint/reporters/text.py143
-rw-r--r--pylint/reporters/ureports/__init__.py4
-rw-r--r--pylint/reporters/ureports/base_writer.py4
-rw-r--r--pylint/reporters/ureports/nodes.py6
-rw-r--r--pylint/reporters/ureports/text_writer.py4
-rw-r--r--pylint/testutils/__init__.py4
-rw-r--r--pylint/testutils/_primer/__init__.py4
-rw-r--r--pylint/testutils/_primer/package_to_lint.py11
-rw-r--r--pylint/testutils/_primer/primer.py4
-rw-r--r--pylint/testutils/_primer/primer_command.py12
-rw-r--r--pylint/testutils/_primer/primer_compare_command.py4
-rw-r--r--pylint/testutils/_primer/primer_prepare_command.py11
-rw-r--r--pylint/testutils/_primer/primer_run_command.py10
-rw-r--r--pylint/testutils/_run.py9
-rw-r--r--pylint/testutils/checker_test_case.py24
-rw-r--r--pylint/testutils/configuration_test.py4
-rw-r--r--pylint/testutils/constants.py4
-rw-r--r--pylint/testutils/decorator.py4
-rw-r--r--pylint/testutils/functional/__init__.py4
-rw-r--r--pylint/testutils/functional/find_functional_tests.py104
-rw-r--r--pylint/testutils/functional/lint_module_output_update.py4
-rw-r--r--pylint/testutils/functional/test_file.py14
-rw-r--r--pylint/testutils/functional_test_file.py24
-rw-r--r--pylint/testutils/get_test_info.py4
-rw-r--r--pylint/testutils/global_test_linter.py4
-rw-r--r--pylint/testutils/lint_module_test.py8
-rw-r--r--pylint/testutils/output_line.py70
-rw-r--r--pylint/testutils/pyreverse.py16
-rw-r--r--pylint/testutils/reporter_for_tests.py6
-rw-r--r--pylint/testutils/testing_pylintrc4
-rw-r--r--pylint/testutils/tokenize_str.py4
-rw-r--r--pylint/testutils/unittest_linter.py12
-rw-r--r--pylint/testutils/utils.py4
-rw-r--r--pylint/typing.py13
-rw-r--r--pylint/utils/__init__.py8
-rw-r--r--pylint/utils/ast_walker.py4
-rw-r--r--pylint/utils/docs.py41
-rw-r--r--pylint/utils/file_state.py54
-rw-r--r--pylint/utils/linterstats.py12
-rw-r--r--pylint/utils/pragma_parser.py4
-rw-r--r--pylint/utils/utils.py85
-rw-r--r--pylintrc3
-rw-r--r--pyproject.toml44
-rw-r--r--requirements_test_min.txt4
-rw-r--r--requirements_test_pre_commit.txt18
-rw-r--r--script/.contributors_aliases.json4
-rw-r--r--script/__init__.py4
-rw-r--r--script/bump_changelog.py4
-rw-r--r--script/check_newsfragments.py7
-rw-r--r--script/copyright.txt4
-rw-r--r--script/create_contributor_list.py4
-rw-r--r--script/fix_documentation.py103
-rw-r--r--script/get_unused_message_id_category.py5
-rw-r--r--tbump.toml4
-rw-r--r--tests/benchmark/test_baseline_benchmarks.py4
-rw-r--r--tests/checkers/base/unittest_base.py4
-rw-r--r--tests/checkers/base/unittest_multi_naming_style.py4
-rw-r--r--tests/checkers/base/unittest_name_preset.py4
-rw-r--r--tests/checkers/conftest.py4
-rw-r--r--tests/checkers/unittest_base_checker.py15
-rw-r--r--tests/checkers/unittest_deprecated.py4
-rw-r--r--tests/checkers/unittest_design.py4
-rw-r--r--tests/checkers/unittest_format.py11
-rw-r--r--tests/checkers/unittest_imports.py4
-rw-r--r--tests/checkers/unittest_misc.py4
-rw-r--r--tests/checkers/unittest_non_ascii_name.py4
-rw-r--r--tests/checkers/unittest_refactoring.py4
-rw-r--r--tests/checkers/unittest_similar.py4
-rw-r--r--tests/checkers/unittest_spelling.py4
-rw-r--r--tests/checkers/unittest_stdlib.py13
-rw-r--r--tests/checkers/unittest_strings.py4
-rw-r--r--tests/checkers/unittest_typecheck.py4
-rw-r--r--tests/checkers/unittest_unicode/__init__.py4
-rw-r--r--tests/checkers/unittest_unicode/unittest_bad_chars.py4
-rw-r--r--tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py4
-rw-r--r--tests/checkers/unittest_unicode/unittest_functions.py4
-rw-r--r--tests/checkers/unittest_unicode/unittest_invalid_encoding.py4
-rw-r--r--tests/checkers/unittest_utils.py62
-rw-r--r--tests/checkers/unittest_variables.py8
-rw-r--r--tests/config/conftest.py4
-rw-r--r--tests/config/file_to_lint.py4
-rw-r--r--tests/config/functional/ini/pylintrc_with_deleted_message.8.out4
-rw-r--r--tests/config/functional/ini/pylintrc_with_deleted_message.ini2
-rw-r--r--tests/config/functional/ini/pylintrc_with_missing_comma.ini2
-rw-r--r--tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini2
-rw-r--r--tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini2
-rw-r--r--tests/config/functional/setup_cfg/deprecate_master/setup.cfg3
-rw-r--r--tests/config/functional/setup_cfg/deprecate_master/setup.result.json3
-rw-r--r--tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg2
-rw-r--r--tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg2
-rw-r--r--tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml2
-rw-r--r--tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml2
-rw-r--r--tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml2
-rw-r--r--tests/config/functional/tox/unrecognized_options/tox.ini2
-rw-r--r--tests/config/pylint_config/test_pylint_config_generate.py4
-rw-r--r--tests/config/pylint_config/test_pylint_config_help.py4
-rw-r--r--tests/config/pylint_config/test_pylint_config_utils.py4
-rw-r--r--tests/config/pylint_config/test_run_pylint_config.py4
-rw-r--r--tests/config/test_argparse_config.py4
-rw-r--r--tests/config/test_config.py6
-rw-r--r--tests/config/test_deprecations.py121
-rw-r--r--tests/config/test_find_default_config_files.py51
-rw-r--r--tests/config/test_functional_config_loading.py4
-rw-r--r--tests/config/test_per_directory_config.py4
-rw-r--r--tests/config/unittest_config.py88
-rw-r--r--tests/conftest.py19
-rw-r--r--tests/data/clientmodule_test.py1
-rw-r--r--tests/extensions/__init__.py4
-rw-r--r--tests/extensions/test_check_docs_utils.py4
-rw-r--r--tests/extensions/test_private_import.py4
-rw-r--r--tests/functional/a/access/access_to_protected_members.py2
-rw-r--r--tests/functional/a/alternative/alternative_union_syntax_error.py2
-rw-r--r--tests/functional/a/alternative/alternative_union_syntax_py37.py2
-rw-r--r--tests/functional/a/alternative/alternative_union_syntax_regession_8119.py2
-rw-r--r--tests/functional/a/arguments.py2
-rw-r--r--tests/functional/a/arguments_differ.py6
-rw-r--r--tests/functional/a/arguments_differ_issue5371.py2
-rw-r--r--tests/functional/a/arguments_positional_only.py15
-rw-r--r--tests/functional/a/arguments_positional_only.rc (renamed from tests/functional/s/singledispatch_method_py38.rc)0
-rw-r--r--tests/functional/a/arguments_positional_only.txt1
-rw-r--r--tests/functional/a/arguments_renamed.py2
-rw-r--r--tests/functional/a/assigning/assigning_non_slot.py2
-rw-r--r--tests/functional/a/assigning/assigning_non_slot_4509.py4
-rw-r--r--tests/functional/a/assignment/assignment_expression.py18
-rw-r--r--tests/functional/a/assignment/assignment_from_no_return.py2
-rw-r--r--tests/functional/b/bad_option_value.txt16
-rw-r--r--tests/functional/b/bad_reversed_sequence_py37.py4
-rw-r--r--tests/functional/b/bad_reversed_sequence_py37.rc4
-rw-r--r--tests/functional/b/bad_reversed_sequence_py37.txt1
-rw-r--r--tests/functional/c/cached_property.py2
-rw-r--r--tests/functional/c/cellvar_escaping_loop.py2
-rw-r--r--tests/functional/c/class_protocol_ellipsis.py2
-rw-r--r--tests/functional/c/comparison_with_callable_typing_constants.py2
-rw-r--r--tests/functional/c/consider/consider_iterating_dictionary.py2
-rw-r--r--tests/functional/c/consider/consider_using_dict_items.py2
-rw-r--r--tests/functional/c/consider/consider_using_enumerate.py2
-rw-r--r--tests/functional/c/consider/consider_using_f_string.py2
-rw-r--r--tests/functional/c/consider/consider_using_f_string.txt60
-rw-r--r--tests/functional/c/consider/consider_using_generator.py2
-rw-r--r--tests/functional/c/consider/consider_using_min_max_builtin.py2
-rw-r--r--tests/functional/c/consider/consider_using_with.py2
-rw-r--r--tests/functional/d/dataclass/dataclass_typecheck.py4
-rw-r--r--tests/functional/d/dataclass/dataclass_with_default_factory.py4
-rw-r--r--tests/functional/d/dataclass/dataclass_with_field.py2
-rw-r--r--tests/functional/d/disabled_msgid_in_pylintrc.py2
-rw-r--r--tests/functional/e/.#emacs_file_lock.py2
-rw-r--r--tests/functional/e/.#emacs_file_lock_by_conf.py2
-rw-r--r--tests/functional/e/enum_self_defined_member_5138.py2
-rw-r--r--tests/functional/e/enum_self_defined_member_6805.py2
-rw-r--r--tests/functional/e/enum_subclasses.py6
-rw-r--r--tests/functional/ext/code_style/cs_consider_using_augmented_assign.py2
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.py46
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.rc2
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.txt6
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py2
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py4
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py4
-rw-r--r--tests/functional/ext/docparams/raise/missing_raises_doc_options.py2
-rw-r--r--tests/functional/ext/emptystring/empty_string_comparison.py22
-rw-r--r--tests/functional/ext/emptystring/empty_string_comparison.rc2
-rw-r--r--tests/functional/ext/emptystring/empty_string_comparison.txt6
-rw-r--r--tests/functional/ext/for_any_all/for_any_all.py2
-rw-r--r--tests/functional/ext/redefined_loop_name/redefined_loop_name.py2
-rw-r--r--tests/functional/ext/redefined_variable_type/redefined_variable_type.py2
-rw-r--r--tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py2
-rw-r--r--tests/functional/ext/typing/typing_consider_using_alias.py2
-rw-r--r--tests/functional/ext/typing/typing_consider_using_alias_without_future.py2
-rw-r--r--tests/functional/ext/typing/typing_consider_using_union.py2
-rw-r--r--tests/functional/ext/typing/typing_consider_using_union_without_future.py2
-rw-r--r--tests/functional/g/generated_members.py2
-rw-r--r--tests/functional/g/globals.py2
-rw-r--r--tests/functional/i/import_error.py8
-rw-r--r--tests/functional/i/import_error.rc2
-rw-r--r--tests/functional/i/import_error.txt2
-rw-r--r--tests/functional/i/inconsistent/inconsistent_returns.py4
-rw-r--r--tests/functional/i/inference_crash_4692.py2
-rw-r--r--tests/functional/i/init_not_called.py2
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format.py (renamed from tests/functional/i/invalid/invalid_all_format.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format.txt (renamed from tests/functional/i/invalid/invalid_all_format.txt)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format_valid_1.py (renamed from tests/functional/i/invalid/invalid_all_format_valid_1.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format_valid_2.py (renamed from tests/functional/i/invalid/invalid_all_format_valid_2.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format_valid_3.py (renamed from tests/functional/i/invalid/invalid_all_format_valid_3.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format_valid_4.py (renamed from tests/functional/i/invalid/invalid_all_format_valid_4.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format_valid_5.py (renamed from tests/functional/i/invalid/invalid_all_format_valid_5.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_format_valid_6.py (renamed from tests/functional/i/invalid/invalid_all_format_valid_6.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_object.py (renamed from tests/functional/i/invalid/invalid_all_object.py)0
-rw-r--r--tests/functional/i/invalid/invalid_all/invalid_all_object.txt (renamed from tests/functional/i/invalid/invalid_all_object.txt)0
-rw-r--r--tests/functional/i/invalid/invalid_class_object.py2
-rw-r--r--tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py2
-rw-r--r--tests/functional/i/invalid/invalid_metaclass.py2
-rw-r--r--tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py2
-rw-r--r--tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py2
-rw-r--r--tests/functional/i/invalid/invalid_overridden_method.py2
-rw-r--r--tests/functional/i/invalid/invalid_sequence_index.py2
-rw-r--r--tests/functional/i/iterable_context.py2
-rw-r--r--tests/functional/m/member/member_checks_inference_improvements.py2
-rw-r--r--tests/functional/m/modified_iterating.py4
-rw-r--r--tests/functional/n/no/no_member.py8
-rw-r--r--tests/functional/n/no/no_member_assign_same_line.py2
-rw-r--r--tests/functional/n/no/no_member_augassign.py2
-rw-r--r--tests/functional/n/no/no_member_binary_operations.py2
-rw-r--r--tests/functional/n/no/no_member_dataclasses.py6
-rw-r--r--tests/functional/n/no/no_member_if_statements.py6
-rw-r--r--tests/functional/n/no/no_member_subclassed_dataclasses.py2
-rw-r--r--tests/functional/n/no/no_name_in_module.py2
-rw-r--r--tests/functional/n/none_dunder_protocols.py2
-rw-r--r--tests/functional/n/nonlocal_without_binding.py2
-rw-r--r--tests/functional/n/not_callable.py14
-rw-r--r--tests/functional/o/overridden_final_method_py38.py2
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_activated.py (renamed from tests/functional/p/postponed_evaluation_activated.py)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_activated.rc (renamed from tests/functional/p/postponed_evaluation_activated.rc)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_activated_with_alias.py (renamed from tests/functional/p/postponed_evaluation_activated_with_alias.py)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_activated_with_alias.rc (renamed from tests/functional/p/postponed_evaluation_activated_with_alias.rc)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_not_activated.py (renamed from tests/functional/p/postponed_evaluation_not_activated.py)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_not_activated.rc (renamed from tests/functional/p/postponed_evaluation_not_activated.rc)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_not_activated.txt (renamed from tests/functional/p/postponed_evaluation_not_activated.txt)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585.py (renamed from tests/functional/p/postponed_evaluation_pep585.py)2
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585.rc (renamed from tests/functional/p/postponed_evaluation_pep585.rc)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585.txt (renamed from tests/functional/p/postponed_evaluation_pep585.txt)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585_error.py (renamed from tests/functional/p/postponed_evaluation_pep585_error.py)2
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585_error.rc (renamed from tests/functional/p/postponed_evaluation_pep585_error.rc)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585_error.txt (renamed from tests/functional/p/postponed_evaluation_pep585_error.txt)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585_py39.py (renamed from tests/functional/p/postponed_evaluation_pep585_py39.py)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585_py39.rc (renamed from tests/functional/p/postponed_evaluation_pep585_py39.rc)0
-rw-r--r--tests/functional/p/postponed/postponed_evaluation_pep585_py39.txt (renamed from tests/functional/p/postponed_evaluation_pep585_py39.txt)0
-rw-r--r--tests/functional/r/recursion/recursion_error_2667.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_2906.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_3159.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_crash.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_crash_2683.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_crash_astroid_623.py2
-rw-r--r--tests/functional/r/redefined/redefined_except_handler.py4
-rw-r--r--tests/functional/r/redefined/redefined_slots.py2
-rw-r--r--tests/functional/r/redundant_unittest_assert.py2
-rw-r--r--tests/functional/r/regression/regression_3416_unused_argument_raise.py2
-rw-r--r--tests/functional/r/regression/regression_3507_typing_alias_isinstance.py2
-rw-r--r--tests/functional/r/regression/regression_3535_double_enum_inherit.py2
-rw-r--r--tests/functional/r/regression/regression_3595_notcallable_collections.py2
-rw-r--r--tests/functional/r/regression/regression_4221_object_instanceattr.py2
-rw-r--r--tests/functional/r/regression/regression_4358_unsubscriptable_enum.py2
-rw-r--r--tests/functional/r/regression/regression_4439.py2
-rw-r--r--tests/functional/r/regression/regression_6531_crash_index_error.py2
-rw-r--r--tests/functional/r/regression/regression_issue_4633.py2
-rw-r--r--tests/functional/r/regression/regression_no_member_1078.py2
-rw-r--r--tests/functional/r/regression/regression_property_no_member_2641.py2
-rw-r--r--tests/functional/r/regression/regression_property_no_member_844.py2
-rw-r--r--tests/functional/r/regression/regression_property_no_member_870.py2
-rw-r--r--tests/functional/r/regression_02/regression_2567.py2
-rw-r--r--tests/functional/r/regression_02/regression_2964.py2
-rw-r--r--tests/functional/r/regression_02/regression_3976.py2
-rw-r--r--tests/functional/r/regression_02/regression_3979.py2
-rw-r--r--tests/functional/r/regression_02/regression_4660.py2
-rw-r--r--tests/functional/r/regression_02/regression_4982.py2
-rw-r--r--tests/functional/r/regression_02/regression_5030.py6
-rw-r--r--tests/functional/r/regression_02/regression_5048.py4
-rw-r--r--tests/functional/r/regression_02/regression_5244.py2
-rw-r--r--tests/functional/r/regression_02/regression_5408.py2
-rw-r--r--tests/functional/r/regression_02/regression_5461.py2
-rw-r--r--tests/functional/r/regression_02/regression_5479.py2
-rw-r--r--tests/functional/r/regression_02/regression_5776.py2
-rw-r--r--tests/functional/r/regression_02/regression_5801.py2
-rw-r--r--tests/functional/r/regression_02/regression_8109.py2
-rw-r--r--tests/functional/r/regression_02/regression_8109.txt2
-rw-r--r--tests/functional/r/regression_02/regression_distutil_import_error_73.py6
-rw-r--r--tests/functional/r/regression_02/regression_enum_1734.py4
-rw-r--r--tests/functional/r/regression_02/regression_no_member_7631.py2
-rw-r--r--tests/functional/r/regression_02/regression_node_statement_two.py2
-rw-r--r--tests/functional/r/regression_02/regression_property_slots_2439.py (renamed from tests/functional/r/regression/regression_property_slots_2439.py)2
-rw-r--r--tests/functional/r/regression_02/regression_too_many_arguments_2335.py2
-rw-r--r--tests/functional/s/singledispatch/singledispatch_functions.py (renamed from tests/functional/s/singledispatch_functions.py)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_functions.txt (renamed from tests/functional/s/singledispatch_functions.txt)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method.txt (renamed from tests/functional/s/singledispatch_method.txt)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method_py37.py (renamed from tests/functional/s/singledispatch_method_py37.py)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method_py37.rc2
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method_py37.txt (renamed from tests/functional/s/singledispatch_method_py37.txt)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method_py38.py (renamed from tests/functional/s/singledispatch_method_py38.py)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method_py38.rc (renamed from tests/functional/s/singledispatchmethod_function_py38.rc)0
-rw-r--r--tests/functional/s/singledispatch/singledispatch_method_py38.txt (renamed from tests/functional/s/singledispatch_method_py38.txt)0
-rw-r--r--tests/functional/s/singledispatch/singledispatchmethod_function_py38.py (renamed from tests/functional/s/singledispatchmethod_function_py38.py)0
-rw-r--r--tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc2
-rw-r--r--tests/functional/s/singledispatch/singledispatchmethod_function_py38.txt (renamed from tests/functional/s/singledispatchmethod_function_py38.txt)0
-rw-r--r--tests/functional/s/singledispatch_method_py37.rc2
-rw-r--r--tests/functional/s/star/star_needs_assignment_target_py37.rc2
-rw-r--r--tests/functional/s/star/star_needs_assignment_target_py38.py (renamed from tests/functional/s/star/star_needs_assignment_target_py37.py)0
-rw-r--r--tests/functional/s/star/star_needs_assignment_target_py38.rc2
-rw-r--r--tests/functional/s/star/star_needs_assignment_target_py38.txt (renamed from tests/functional/s/star/star_needs_assignment_target_py37.txt)0
-rw-r--r--tests/functional/s/stop_iteration_inside_generator.py10
-rw-r--r--tests/functional/s/subclassed_final_class_py38.py2
-rw-r--r--tests/functional/s/super/super_checks.py6
-rw-r--r--tests/functional/s/super/super_init_not_called.py4
-rw-r--r--tests/functional/s/sys_stream_regression_1004.py2
-rw-r--r--tests/functional/t/too/too_few_public_methods_37.py2
-rw-r--r--tests/functional/t/too/too_many_ancestors.py4
-rw-r--r--tests/functional/t/too/too_many_arguments.py2
-rw-r--r--tests/functional/t/too/too_many_function_args.py2
-rw-r--r--tests/functional/t/too/too_many_instance_attributes.py2
-rw-r--r--tests/functional/t/too/too_many_instance_attributes_py37.py2
-rw-r--r--tests/functional/t/trailing_whitespaces.py4
-rw-r--r--tests/functional/t/typealias_naming_style_default.py11
-rw-r--r--tests/functional/t/typealias_naming_style_default.txt1
-rw-r--r--tests/functional/t/typedDict.py2
-rw-r--r--tests/functional/t/typing_generic.py4
-rw-r--r--tests/functional/u/unbalanced/unbalanced_dict_unpacking.py (renamed from tests/functional/u/unbalanced_dict_unpacking.py)0
-rw-r--r--tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt (renamed from tests/functional/u/unbalanced_dict_unpacking.txt)0
-rw-r--r--tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py (renamed from tests/functional/u/unbalanced_tuple_unpacking.py)2
-rw-r--r--tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt (renamed from tests/functional/u/unbalanced_tuple_unpacking.txt)0
-rw-r--r--tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py (renamed from tests/functional/u/unbalanced_tuple_unpacking_py30.py)0
-rw-r--r--tests/functional/u/undefined/undefined_loop_variable.py17
-rw-r--r--tests/functional/u/undefined/undefined_loop_variable.txt8
-rw-r--r--tests/functional/u/undefined/undefined_loop_variable_py38.py2
-rw-r--r--tests/functional/u/undefined/undefined_variable.py4
-rw-r--r--tests/functional/u/undefined/undefined_variable.txt2
-rw-r--r--tests/functional/u/undefined/undefined_variable_classes.py4
-rw-r--r--tests/functional/u/undefined/undefined_variable_decorators.py2
-rw-r--r--tests/functional/u/undefined/undefined_variable_py30.py4
-rw-r--r--tests/functional/u/undefined/undefined_variable_py38.py6
-rw-r--r--tests/functional/u/undefined/undefined_variable_typing.py6
-rw-r--r--tests/functional/u/unexpected_special_method_signature.py2
-rw-r--r--tests/functional/u/ungrouped_imports.py2
-rw-r--r--tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py12
-rw-r--r--tests/functional/u/unnecessary/unnecessary_ellipsis.py2
-rw-r--r--tests/functional/u/unnecessary/unnecessary_list_index_lookup.py12
-rw-r--r--tests/functional/u/unpacking/unpacking_non_sequence_py37.py4
-rw-r--r--tests/functional/u/unreachable.py2
-rw-r--r--tests/functional/u/unspecified_encoding_py38.py10
-rw-r--r--tests/functional/u/unsubscriptable_object.py2
-rw-r--r--tests/functional/u/unused/unused_argument.py2
-rw-r--r--tests/functional/u/unused/unused_import.py2
-rw-r--r--tests/functional/u/unused/unused_import_class_def_keyword.py2
-rw-r--r--tests/functional/u/unused/unused_import_everything_disabled.py4
-rw-r--r--tests/functional/u/unused/unused_import_positional_only_py38.py2
-rw-r--r--tests/functional/u/unused/unused_private_member.py20
-rw-r--r--tests/functional/u/unused/unused_typing_imports.py2
-rw-r--r--tests/functional/u/unused/unused_variable.py2
-rw-r--r--tests/functional/u/unused/unused_variable_after_inference.py2
-rw-r--r--tests/functional/u/use/use_a_generator.py2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison.py6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison.txt64
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py22
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py46
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_len.py24
-rw-r--r--tests/functional/u/use/use_maxsplit_arg.py4
-rw-r--r--tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py2
-rw-r--r--tests/functional/u/used/used_before_assignment.py62
-rw-r--r--tests/functional/u/used/used_before_assignment.txt14
-rw-r--r--tests/functional/u/used/used_before_assignment_class_nested_under_function.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_comprehension_homonyms.py6
-rw-r--r--tests/functional/u/used/used_before_assignment_else_return.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_issue2615.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_issue4761.py4
-rw-r--r--tests/functional/u/used/used_before_assignment_issue85.py4
-rw-r--r--tests/functional/u/used/used_before_assignment_nonlocal.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_postponed_evaluation.py13
-rw-r--r--tests/functional/u/used/used_before_assignment_postponed_evaluation.txt1
-rw-r--r--tests/functional/u/used/used_before_assignment_py37.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_scoping.py18
-rw-r--r--tests/functional/u/used/used_before_assignment_scoping.txt2
-rw-r--r--tests/functional/u/used/used_before_assignment_ternary.txt6
-rw-r--r--tests/functional/u/used/used_before_assignment_type_annotations.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_typing.py13
-rw-r--r--tests/functional/u/used/used_before_assignment_typing.txt10
-rw-r--r--tests/functional/u/useless/useless_parent_delegation.py2
-rw-r--r--tests/functional/u/useless/useless_suppression.py6
-rw-r--r--tests/input/func_noerror_cycle/__init__.py2
-rw-r--r--tests/lint/__init__.py4
-rw-r--r--tests/lint/test_caching.py4
-rw-r--r--tests/lint/test_pylinter.py16
-rw-r--r--tests/lint/test_run_pylint.py4
-rw-r--r--tests/lint/test_utils.py16
-rw-r--r--tests/lint/unittest_expand_modules.py4
-rw-r--r--tests/lint/unittest_lint.py149
-rw-r--r--tests/message/__init__.py4
-rw-r--r--tests/message/conftest.py4
-rw-r--r--tests/message/test_no_removed_msgid_or_symbol_used.py6
-rw-r--r--tests/message/unittest_message.py4
-rw-r--r--tests/message/unittest_message_definition.py4
-rw-r--r--tests/message/unittest_message_definition_store.py4
-rw-r--r--tests/message/unittest_message_id_store.py4
-rw-r--r--tests/primer/__main__.py4
-rw-r--r--tests/primer/packages_to_lint_batch_one.json7
-rw-r--r--tests/primer/packages_to_prime.json7
-rw-r--r--tests/primer/test_primer_external.py73
-rw-r--r--tests/primer/test_primer_stdlib.py6
-rw-r--r--tests/profile/test_profile_against_externals.py4
-rw-r--r--tests/pyreverse/conftest.py9
-rw-r--r--tests/pyreverse/data/classes_No_Name.dot1
-rw-r--r--tests/pyreverse/data/classes_No_Name.html1
-rw-r--r--tests/pyreverse/data/classes_No_Name.mmd1
-rw-r--r--tests/pyreverse/data/classes_No_Name.puml1
-rw-r--r--tests/pyreverse/data/classes_colorized.dot19
-rw-r--r--tests/pyreverse/data/classes_colorized.puml19
-rw-r--r--tests/pyreverse/data/classes_no_standalone.dot12
-rw-r--r--tests/pyreverse/data/packages_colorized.dot10
-rw-r--r--tests/pyreverse/data/packages_colorized.puml15
-rw-r--r--tests/pyreverse/data/packages_no_standalone.dot7
-rw-r--r--tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml8
-rw-r--r--tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot11
-rw-r--r--tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml2
-rw-r--r--tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc4
-rw-r--r--tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd6
-rw-r--r--tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py5
-rw-r--r--tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc2
-rw-r--r--tests/pyreverse/test_diadefs.py54
-rw-r--r--tests/pyreverse/test_diagrams.py4
-rw-r--r--tests/pyreverse/test_inspector.py82
-rw-r--r--tests/pyreverse/test_main.py5
-rw-r--r--tests/pyreverse/test_printer.py20
-rw-r--r--tests/pyreverse/test_printer_factory.py6
-rw-r--r--tests/pyreverse/test_pyreverse_functional.py4
-rw-r--r--tests/pyreverse/test_utils.py4
-rw-r--r--tests/pyreverse/test_writer.py46
-rw-r--r--tests/regrtest_data/line_too_long_no_code.py2
-rw-r--r--tests/regrtest_data/max_inferable_limit_for_classes/main.py2
-rw-r--r--tests/reporters/unittest_json_reporter.py4
-rw-r--r--tests/reporters/unittest_reporting.py16
-rw-r--r--tests/test_check_parallel.py8
-rw-r--r--tests/test_deprecation.py122
-rw-r--r--tests/test_epylint.py68
-rw-r--r--tests/test_func.py8
-rw-r--r--tests/test_functional.py4
-rw-r--r--tests/test_functional_directories.py4
-rw-r--r--tests/test_import_graph.py4
-rw-r--r--tests/test_numversion.py4
-rw-r--r--tests/test_pragma_parser.py4
-rw-r--r--tests/test_pylint_runners.py39
-rw-r--r--tests/test_regr.py27
-rw-r--r--tests/test_self.py56
-rw-r--r--tests/test_similar.py4
-rw-r--r--tests/testutils/_primer/fixtures/message_changed/expected.txt6
-rw-r--r--tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt6
-rw-r--r--tests/testutils/_primer/fixtures/message_changed/main.json4
-rw-r--r--tests/testutils/_primer/fixtures/message_changed/pr.json4
-rw-r--r--tests/testutils/_primer/fixtures/no_change/main.json4
-rw-r--r--tests/testutils/_primer/fixtures/no_change/pr.json4
-rw-r--r--tests/testutils/_primer/test_package_to_lint.py7
-rw-r--r--tests/testutils/_primer/test_primer.py8
-rw-r--r--tests/testutils/data/functional/broken_output_ok_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/broken_output_ok_test/exec_used.txt1
-rw-r--r--tests/testutils/data/functional/broken_output_wrong_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt1
-rw-r--r--tests/testutils/data/functional/no_output_ok_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/no_output_wrong_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/ok_output_ok_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/ok_output_ok_test/exec_used.txt1
-rw-r--r--tests/testutils/data/functional/ok_output_wrong_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt1
-rw-r--r--tests/testutils/data/functional/wrong_output_ok_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt1
-rw-r--r--tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py7
-rw-r--r--tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt1
-rw-r--r--tests/testutils/data/m/max_overflow/max_overflow_1.py0
-rw-r--r--tests/testutils/data/m/max_overflow/max_overflow_2.py0
-rw-r--r--tests/testutils/data/m/max_overflow/max_overflow_3.py0
-rw-r--r--tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py0
-rw-r--r--tests/testutils/dummy_checker.py4
-rw-r--r--tests/testutils/test_configuration_test.py4
-rw-r--r--tests/testutils/test_functional_testutils.py32
-rw-r--r--tests/testutils/test_lint_module_output_update.py88
-rw-r--r--tests/testutils/test_output_line.py84
-rw-r--r--tests/testutils/test_pyreverse_testutils.py4
-rw-r--r--tests/testutils/test_testutils_utils.py4
-rw-r--r--tests/utils/unittest_ast_walker.py4
-rw-r--r--tests/utils/unittest_utils.py4
-rw-r--r--towncrier.toml11
-rw-r--r--tox.ini9
921 files changed, 3761 insertions, 7005 deletions
diff --git a/.coveragerc b/.coveragerc
index ddfcbd334..22bacd09f 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -7,12 +7,6 @@ include =
pylint/*
omit =
*/test/*
-# TODO: 3.0: Remove these after these files have been removed
- pylint/config/configuration_mixin.py
- pylint/config/option.py
- pylint/config/option_manager_mixin.py
- pylint/config/option_parser.py
- pylint/config/options_provider_mixin.py
exclude_lines =
# Re-enable default pragma
pragma: no cover
diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml
index e7a9f168c..811ed6360 100644
--- a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml
+++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml
@@ -10,7 +10,7 @@ body:
⚠ Please make sure that this [issue wasn't already requested][issue search], or already implemented in the main branch.
- [issue search]: https://github.com/PyCQA/pylint/issues?q=is%3Aissue+is%3Aopen+
+ [issue search]: https://github.com/pylint-dev/pylint/issues?q=is%3Aissue+is%3Aopen+
- type: textarea
id: what-happened
diff --git a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml
index a2b9b52e0..b537e69f0 100644
--- a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml
+++ b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml
@@ -10,7 +10,7 @@ body:
⚠ Please make sure that [this feature wasn't already requested][issue search] or already implemented in the main branch.
- [issue search]: https://github.com/PyCQA/pylint/issues?q=is%3Aissue+is%3Aopen+
+ [issue search]: https://github.com/pylint-dev/pylint/issues?q=is%3Aissue+is%3Aopen+
- type: textarea
id: current-problem
diff --git a/.github/ISSUE_TEMPLATE/QUESTION.yml b/.github/ISSUE_TEMPLATE/QUESTION.yml
index 4af829fa3..ed26c9ffb 100644
--- a/.github/ISSUE_TEMPLATE/QUESTION.yml
+++ b/.github/ISSUE_TEMPLATE/QUESTION.yml
@@ -19,7 +19,8 @@ body:
on Discord][Discussions].
- [issue search]: https://github.com/PyCQA/pylint/issues?q=is%3Aissue+is%3Aopen+
+ [issue search]:
+ https://github.com/pylint-dev/pylint/issues?q=is%3Aissue+is%3Aopen+
[Discussions]: https://discord.com/invite/Egy6P8AMB5
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 877047a07..98e0f3f7a 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -6,6 +6,7 @@ updates:
interval: "weekly"
labels:
- "dependency"
+ - "Skip news :mute:"
open-pull-requests-limit: 10
rebase-strategy: "disabled"
@@ -15,5 +16,6 @@ updates:
interval: "weekly"
labels:
- "dependency"
+ - "Skip news :mute:"
open-pull-requests-limit: 10
rebase-strategy: "disabled"
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml
index 59ab74811..c6a1a3711 100644
--- a/.github/workflows/changelog.yml
+++ b/.github/workflows/changelog.yml
@@ -21,14 +21,14 @@ jobs:
timeout-minutes: 10
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
fetch-depth: 0
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
@@ -41,7 +41,7 @@ jobs:
$GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml
index 8d0fdc438..21a6511eb 100644
--- a/.github/workflows/checks.yaml
+++ b/.github/workflows/checks.yaml
@@ -33,10 +33,10 @@ jobs:
pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }}
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
@@ -49,7 +49,7 @@ jobs:
$GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
@@ -70,7 +70,7 @@ jobs:
hashFiles('.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
- name: Restore pre-commit environment
id: cache-precommit
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >-
@@ -88,16 +88,16 @@ jobs:
needs: prepare-base
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
@@ -106,7 +106,7 @@ jobs:
needs.prepare-base.outputs.python-key }}
- name: Restore pre-commit environment
id: cache-precommit
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: ${{ env.PRE_COMMIT_CACHE }}
fail-on-cache-miss: true
@@ -129,16 +129,16 @@ jobs:
needs: prepare-base
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
@@ -157,16 +157,16 @@ jobs:
needs: prepare-base
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 51c566566..7ba6e8dca 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -46,7 +46,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
diff --git a/.github/workflows/primer-test.yaml b/.github/workflows/primer-test.yaml
index e04bea94b..e357fe747 100644
--- a/.github/workflows/primer-test.yaml
+++ b/.github/workflows/primer-test.yaml
@@ -13,7 +13,7 @@ on:
branches:
- main
env:
- CACHE_VERSION: 2
+ CACHE_VERSION: 3
KEY_PREFIX: venv
concurrency:
@@ -35,10 +35,10 @@ jobs:
python-key: ${{ steps.generate-python-key.outputs.key }}
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -51,7 +51,7 @@ jobs:
$GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
@@ -75,16 +75,16 @@ jobs:
python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
@@ -96,35 +96,3 @@ jobs:
. venv/bin/activate
pip install -e .
pytest -m primer_stdlib --primer-stdlib -n auto -vv
-
- pytest-primer-external-batch-one:
- name: run on batch one / ${{ matrix.python-version }} / Linux
- runs-on: ubuntu-latest
- timeout-minutes: 60
- needs: prepare-tests-linux
- strategy:
- matrix:
- python-version: [3.8, 3.9, "3.10", "3.11"]
- steps:
- - name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
- - name: Set up Python ${{ matrix.python-version }}
- id: python
- uses: actions/setup-python@v4.5.0
- with:
- python-version: ${{ matrix.python-version }}
- check-latest: true
- - name: Restore Python virtual environment
- id: cache-venv
- uses: actions/cache@v3.2.5
- with:
- path: venv
- fail-on-cache-miss: true
- key:
- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
- needs.prepare-tests-linux.outputs.python-key }}
- - name: Run pytest
- run: |
- . venv/bin/activate
- pip install -e .
- pytest -m primer_external_batch_one --primer-external -n auto -vv
diff --git a/.github/workflows/primer_comment.yaml b/.github/workflows/primer_comment.yaml
index 52374a680..7a79c03c5 100644
--- a/.github/workflows/primer_comment.yaml
+++ b/.github/workflows/primer_comment.yaml
@@ -14,7 +14,7 @@ on:
env:
# This needs to be the SAME as in the Main and PR job
- CACHE_VERSION: 2
+ CACHE_VERSION: 3
KEY_PREFIX: venv-primer
DEFAULT_PYTHON: "3.11"
@@ -30,10 +30,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
@@ -41,7 +41,7 @@ jobs:
# Restore cached Python environment
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
@@ -52,7 +52,7 @@ jobs:
'requirements_test_pre_commit.txt') }}
- name: Download outputs
- uses: actions/github-script@v6.4.0
+ uses: actions/github-script@v6.4.1
with:
script: |
// Download workflow pylint output
@@ -107,7 +107,7 @@ jobs:
--new-file=output_${{ steps.python.outputs.python-version }}_pr.txt
- name: Post comment
id: post-comment
- uses: actions/github-script@v6.4.0
+ uses: actions/github-script@v6.4.1
with:
script: |
const fs = require('fs')
diff --git a/.github/workflows/primer_run_main.yaml b/.github/workflows/primer_run_main.yaml
index ce386c38e..dfb857424 100644
--- a/.github/workflows/primer_run_main.yaml
+++ b/.github/workflows/primer_run_main.yaml
@@ -16,7 +16,7 @@ concurrency:
env:
# This needs to be the SAME as in the PR and comment job
- CACHE_VERSION: 2
+ CACHE_VERSION: 3
KEY_PREFIX: venv-primer
permissions:
@@ -26,16 +26,16 @@ jobs:
run-primer:
name: Run / ${{ matrix.python-version }}
runs-on: ubuntu-latest
- timeout-minutes: 60
+ timeout-minutes: 120
strategy:
matrix:
- python-version: ["3.7", "3.11"]
+ python-version: ["3.8", "3.11"]
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -43,7 +43,7 @@ jobs:
# Create a re-usable virtual environment
- name: Create Python virtual environment cache
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key:
@@ -69,7 +69,7 @@ jobs:
echo "commitstring=$output" >> $GITHUB_OUTPUT
- name: Restore projects cache
id: cache-projects
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: tests/.pylint_primer_tests/
key: >-
diff --git a/.github/workflows/primer_run_pr.yaml b/.github/workflows/primer_run_pr.yaml
index 909d4c901..d9583579e 100644
--- a/.github/workflows/primer_run_pr.yaml
+++ b/.github/workflows/primer_run_pr.yaml
@@ -25,7 +25,7 @@ concurrency:
env:
# This needs to be the SAME as in the Main and comment job
- CACHE_VERSION: 2
+ CACHE_VERSION: 3
KEY_PREFIX: venv-primer
permissions:
@@ -38,15 +38,15 @@ jobs:
timeout-minutes: 120
strategy:
matrix:
- python-version: ["3.7", "3.11"]
+ python-version: ["3.8", "3.11"]
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -54,7 +54,7 @@ jobs:
# Restore cached Python environment
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key:
@@ -74,7 +74,7 @@ jobs:
# Cache primer packages
- name: Download last 'main' run info
id: download-main-run
- uses: actions/github-script@v6.4.0
+ uses: actions/github-script@v6.4.1
with:
script: |
// Download 'main' pylint output
@@ -132,7 +132,7 @@ jobs:
echo "commitstring=$output" >> $GITHUB_OUTPUT
- name: Restore projects cache
id: cache-projects
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: tests/.pylint_primer_tests/
key: >-
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ec8ebde83..3828d4715 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -20,10 +20,10 @@ jobs:
url: https://pypi.org/project/pylint/
steps:
- name: Check out code from Github
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 3cfca316e..09beec919 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -13,7 +13,7 @@ on:
- "maintenance/**"
env:
- CACHE_VERSION: 2
+ CACHE_VERSION: 3
KEY_PREFIX: venv
permissions:
@@ -31,15 +31,15 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
+ python-version: [3.8, 3.9, "3.10", "3.11"]
outputs:
python-key: ${{ steps.generate-python-key.outputs.key }}
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -52,7 +52,7 @@ jobs:
$GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
@@ -88,16 +88,16 @@ jobs:
needs: tests-linux
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python 3.11
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: "3.11"
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
@@ -128,16 +128,16 @@ jobs:
python-version: ["3.11"]
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
fail-on-cache-miss: true
@@ -175,17 +175,17 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
+ python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- name: Set temp directory
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
# Workaround to set correct temp directory on Windows
# https://github.com/actions/virtual-environments/issues/712
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -197,7 +197,7 @@ jobs:
}}" >> $env:GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
@@ -225,13 +225,13 @@ jobs:
fail-fast: false
matrix:
# We only run on the oldest supported version on Mac
- python-version: [3.7]
+ python-version: [3.8]
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -243,7 +243,7 @@ jobs:
}}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
@@ -269,13 +269,13 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ["pypy-3.7", "pypy-3.8", "pypy-3.9"]
+ python-version: ["pypy-3.8", "pypy-3.9"]
steps:
- name: Check out code from GitHub
- uses: actions/checkout@v3.3.0
+ uses: actions/checkout@v3.5.2
- name: Set up Python ${{ matrix.python-version }}
id: python
- uses: actions/setup-python@v4.5.0
+ uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -287,7 +287,7 @@ jobs:
}}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v3.2.5
+ uses: actions/cache@v3.3.1
with:
path: venv
key: >-
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b4f4dc767..6b20db830 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -16,16 +16,16 @@ repos:
doc/data/messages/m/missing-final-newline/bad.py|
)$
- repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: "v0.0.254"
+ rev: "v0.0.263"
hooks:
- id: ruff
args: ["--fix"]
exclude: &fixtures tests(/\w*)*/functional/|tests/input|doc/data/messages|tests(/\w*)*data/
- repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: "v0.0.254"
+ rev: "v0.0.263"
hooks:
- id: ruff
- name: line-length-doc
+ name: ruff-doc
files: doc/data/messages
args: ["--config", "doc/data/ruff.toml"]
- repo: https://github.com/Pierre-Sassoulas/copyright_notice_precommit
@@ -36,22 +36,43 @@ repos:
exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|setup.py|tests(/\w*)*data/
types: [python]
- repo: https://github.com/asottile/pyupgrade
- rev: v3.3.1
+ rev: v3.3.2
hooks:
- id: pyupgrade
- args: [--py37-plus]
+ args: [--py38-plus]
exclude: *fixtures
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- exclude: doc/data/messages/(r/reimported|w/wrong-import-order|u/ungrouped-imports|m/misplaced-future|m/multiple-imports)/bad.py
+ exclude: doc/data/messages/
- repo: https://github.com/psf/black
- rev: 23.1.0
+ rev: 23.3.0
hooks:
- id: black
args: [--safe, --quiet]
exclude: *fixtures
+ - id: black
+ name: black-doc
+ args: [--safe, --quiet]
+ files: doc/data/messages/
+ exclude: |
+ (?x)^(
+ doc/data/messages/b/bad-indentation/bad.py|
+ doc/data/messages/i/inconsistent-quotes/bad.py|
+ doc/data/messages/i/invalid-format-index/bad.py|
+ doc/data/messages/l/line-too-long/bad.py|
+ doc/data/messages/m/missing-final-newline/bad.py|
+ doc/data/messages/m/multiple-statements/bad.py|
+ doc/data/messages/r/redundant-u-string-prefix/bad.py|
+ doc/data/messages/s/superfluous-parens/bad.py|
+ doc/data/messages/s/syntax-error/bad.py|
+ doc/data/messages/t/too-many-ancestors/bad.py|
+ doc/data/messages/t/trailing-comma-tuple/bad.py|
+ doc/data/messages/t/trailing-newlines/bad.py|
+ doc/data/messages/t/trailing-whitespace/bad.py|
+ doc/data/messages/u/unnecessary-semicolon/bad.py
+ )$
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker
rev: v1.1.3
hooks:
@@ -76,12 +97,6 @@ repos:
args: ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I", "--spelling-dict=en"]
exclude: tests(/\w*)*/functional/|tests/input|tests(/\w*)*data/|doc/
stages: [manual]
- - id: fix-documentation
- name: Fix documentation
- entry: python3 -m script.fix_documentation
- language: system
- types: [text]
- files: ^(doc/whatsnew/\d+\.\d+\.rst)
- id: check-newsfragments
name: Check newsfragments
entry: python3 -m script.check_newsfragments
@@ -90,14 +105,14 @@ repos:
files: ^(doc/whatsnew/fragments)
exclude: doc/whatsnew/fragments/_.*.rst
- repo: https://github.com/rstcheck/rstcheck
- rev: "v6.1.1"
+ rev: "v6.1.2"
hooks:
- id: rstcheck
args: ["--report-level=warning"]
files: ^(doc/(.*/)*.*\.rst)
additional_dependencies: [Sphinx==5.0.1]
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.0.1
+ rev: v1.2.0
hooks:
- id: mypy
name: mypy
@@ -116,7 +131,7 @@ repos:
]
exclude: tests(/\w*)*/functional/|tests/input|tests(/.*)+/conftest.py|doc/data/messages|tests(/\w*)*data/
- repo: https://github.com/pre-commit/mirrors-prettier
- rev: v3.0.0-alpha.6
+ rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
@@ -143,7 +158,7 @@ repos:
setup.cfg
)$
- repo: https://github.com/PyCQA/bandit
- rev: 1.7.4
+ rev: 1.7.5
hooks:
- id: bandit
args: ["-r", "-lll"]
diff --git a/.pyenchant_pylint_custom_dict.txt b/.pyenchant_pylint_custom_dict.txt
index 5969ff639..6cd91e1ba 100644
--- a/.pyenchant_pylint_custom_dict.txt
+++ b/.pyenchant_pylint_custom_dict.txt
@@ -132,6 +132,7 @@ globbing
GPL
graphname
graphviz
+grey
guido's
gv
hashable
@@ -260,6 +261,7 @@ pylint
pylintdict
pylintrc
pylint's
+pyproject
pypy
pyreverse
pytest
@@ -317,6 +319,8 @@ subtree
supcls
superclass
symilar
+symlink
+symlinks
sys
tbump
tempfile
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 2de0c8d4a..6241ecae2 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -106,12 +106,14 @@ contributors:
- Radu Ciorba <radu@devrandom.ro>: not-context-manager and confusing-with-statement warnings.
- Holger Peters <email@holger-peters.de>
- Cosmin Poieană <cmin@ropython.org>: unichr-builtin and improvements to bad-open-mode.
+- Zen Lee <53538590+zenlyj@users.noreply.github.com>
- Steven Myint <hg@stevenmyint.com>: duplicate-except.
- Peter Kolbus <peter.kolbus@gmail.com> (Garmin)
- Luigi Bertaco Cristofolini <lucristofolini@gmail.com> (luigibertaco)
- Glenn Matthews <glenn@e-dad.net>:
* autogenerated documentation for optional extensions,
* bug fixes and enhancements for docparams (née check_docs) extension
+- Yilei "Dolee" Yang <yileiyang@google.com>
- Vlad Temian <vladtemian@gmail.com>: redundant-unittest-assert and the JSON reporter.
- Julien Jehannet <julien.jehannet@logilab.fr>
- Boris Feld <lothiraldan@gmail.com>
@@ -121,7 +123,6 @@ contributors:
- David Liu <david@cs.toronto.edu> (david-yz-liu)
- Dan Goldsmith <djgoldsmith@googlemail.com>: support for msg-template in HTML reporter.
- Buck Evan <buck.2019@gmail.com>
-- Zen Lee <53538590+zenlyj@users.noreply.github.com>
- Robert Hofer <hofrob@protonmail.com>
- Mariatta Wijaya <Mariatta@users.noreply.github.com>
* Added new check `logging-fstring-interpolation`
@@ -130,7 +131,6 @@ contributors:
- Eli Fine <ejfine@gmail.com> (eli88fine): Fixed false positive duplicate code warning for lines with symbols only
- Andrew Haigh <nelfin@gmail.com> (nelfin)
- Émile Crater <emile@crater.logilab.fr>
-- Yilei "Dolee" Yang <yileiyang@google.com>
- Pavel Roskin <proski@gnu.org>
- David Gilman <davidgilman1@gmail.com>
- へーさん <hira9603859504@gmail.com>
@@ -175,6 +175,7 @@ contributors:
- Sneaky Pete <sneakypete81@gmail.com>
- Sergey B Kirpichev <skirpichev@gmail.com>
- Sandro Tosi <sandro.tosi@gmail.com>: Debian packaging
+- Rogdham <contact@rogdham.net>
- Rene Zhang <rz99@cornell.edu>
- Paul Lichtenberger <paul.lichtenberger.rgbg@gmail.com>
- Or Bahari <or.ba402@gmail.com>
@@ -206,7 +207,6 @@ contributors:
- chohner <mail@chohner.com>
- Tiago Honorato <61059243+tiagohonorato@users.noreply.github.com>
- Steven M. Vascellaro <svascellaro@gmail.com>
-- Rogdham <contact@rogdham.net>
- Robin Tweedie <70587124+robin-wayve@users.noreply.github.com>
- Roberto Leinardi <leinardi@gmail.com>: PyCharm plugin maintainer
- Ricardo Gemignani <ricardo.gemignani@gmail.com>
@@ -234,9 +234,11 @@ contributors:
- Federico Bond <federicobond@gmail.com>
- Erik Wright <erik.wright@shopify.com>
- Erik Eriksson <molobrakos@users.noreply.github.com>: Added overlapping-except error check.
+- Daniel Mouritzen <dmrtzn@gmail.com>
- Dan Hemberger <846186+hemberger@users.noreply.github.com>
- Chris Rebert <code@rebertia.com>: unidiomatic-typecheck.
- Aurelien Campeas <aurelien.campeas@logilab.fr>
+- Alvaro Frias <alvarofriasgaray@gmail.com>
- Alexander Pervakov <frost.nzcr4@jagmort.com>
- Alain Leufroy <alain.leufroy@logilab.fr>
- Adam Williamson <awilliam@redhat.com>
@@ -254,6 +256,7 @@ contributors:
- Sergei Lebedev <185856+superbobry@users.noreply.github.com>
- Scott Worley <scottworley@scottworley.com>
- Saugat Pachhai <suagatchhetri@outlook.com>
+- Samuel FORESTIER <HorlogeSkynet@users.noreply.github.com>
- Rémi Cardona <remi.cardona@polyconseil.fr>
- Raphael Gaschignard <raphael@makeleaps.com>
- Ram Rachum <ram@rachum.com> (cool-RR)
@@ -288,10 +291,10 @@ contributors:
- Fantix King <fantix@uchicago.edu> (UChicago)
- Eric McDonald <221418+emcd@users.noreply.github.com>
- Elias Dorneles <eliasdorneles@gmail.com>: minor adjust to config defaults and docs
+- Elazrod56 <thomas.lf5629@gmail.com>
- Derek Harland <derek.harland@finq.co.nz>
- David Pursehouse <david.pursehouse@gmail.com>
- Dave Bunten <dave.bunten@cuanschutz.edu>
-- Daniel Mouritzen <dmrtzn@gmail.com>
- Daniel Miller <millerdev@gmail.com>
- Christoph Blessing <33834216+cblessing24@users.noreply.github.com>
- Chris Murray <chris@chrismurray.scot>
@@ -306,7 +309,6 @@ contributors:
- Ben James <benjames1999@hotmail.co.uk>
- Ben Green <benhgreen@icloud.com>
- Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
-- Alvaro Frias <alvarofriasgaray@gmail.com>
- Alexander Kapshuna <kapsh@kap.sh>
- Adam Parkin <pzelnip@users.noreply.github.com>
- 谭九鼎 <109224573@qq.com>
@@ -339,6 +341,7 @@ contributors:
- danields <danields761@gmail.com>
- cosven <cosven@users.noreply.github.com>
- cordis-dev <darius@adroiti.com>
+- cherryblossom <31467609+cherryblossom000@users.noreply.github.com>
- bluesheeptoken <louis.fruleux1@gmail.com>
- anatoly techtonik <techtonik@gmail.com>
- agutole <toldo_carp@hotmail.com>
@@ -367,12 +370,14 @@ contributors:
- Tom <tsarantis@proton.me>
- Tim Hatch <tim@timhatch.com>
- Tim Gates <tim.gates@iress.com>
+- Théo Battrel <theo.util@protonmail.ch>
- Thomas Benhamou <thomas@lightricks.com>
- Tanvi Moharir <74228962+tanvimoharir@users.noreply.github.com>: Fix for invalid toml config
- T.Rzepka <Tobias.Rzepka@gmail.com>
- Svetoslav Neykov <svet@hyperscience.com>
- Stéphane Wirtel <stephane@wirtel.be>: nonlocal-without-binding
- Stephen Longofono <8992396+SLongofono@users.noreply.github.com>
+- Stephane Odul <1504511+sodul@users.noreply.github.com>
- Stanislav Levin <slev@altlinux.org>
- Sorin Sbarnea <ssbarnea@redhat.com>
- Slavfox <slavfoxman@gmail.com>
@@ -384,7 +389,6 @@ contributors:
- Sardorbek Imomaliev <sardorbek.imomaliev@gmail.com>
- Santiago Castro <bryant@montevideo.com.uy>
- Samuel Freilich <sfreilich@google.com> (sfreilich)
-- Samuel FORESTIER <HorlogeSkynet@users.noreply.github.com>
- Sam Vermeiren <88253337+PaaEl@users.noreply.github.com>
- Ryan McGuire <ryan@enigmacurry.com>
- Ry4an Brase <ry4an-hg@ry4an.org>
@@ -397,6 +401,7 @@ contributors:
- Randall Leeds <randall@bleeds.info>
- Ramon Saraiva <ramonsaraiva@gmail.com>
- Ramiro Leal-Cavazos <ramiroleal050@gmail.com> (ramiro050): Fixed bug preventing pylint from working with Emacs tramp
+- RSTdefg <34202999+RSTdefg@users.noreply.github.com>
- R. N. West <98110034+rnwst@users.noreply.github.com>
- Qwiddle13 <32040075+Qwiddle13@users.noreply.github.com>
- Quentin Young <qlyoung@users.noreply.github.com>
@@ -543,6 +548,7 @@ contributors:
- Benedikt Morbach <benedikt.morbach@googlemail.com>
- Ben Greiner <code@bnavigator.de>
- Banjamin Freeman <befreeman@users.noreply.github.com>
+- Avram Lubkin <avylove@rockhopper.net>
- Athos Ribeiro <athoscr@fedoraproject.org>: Fixed dict-keys-not-iterating false positive for inverse containment checks
- Arun Persaud <arun@nubati.net>
- Arthur Lutz <arthur.lutz@logilab.fr>
@@ -560,6 +566,7 @@ contributors:
- Alok Singh <8325708+alok@users.noreply.github.com>
- Allan Chandler <95424144+allanc65@users.noreply.github.com> (allanc65)
* Fixed issue 5452, false positive missing-param-doc for multi-line Google-style params
+- Alex Mor <5476113+nashcontrol@users.noreply.github.com>
- Alex Jurkiewicz <alex@jurkiewi.cz>
- Alex Hearn <alex.d.hearn@gmail.com>
- Alan Evangelista <alanoe@linux.vnet.ibm.com>
diff --git a/README.rst b/README.rst
index a29f3ece8..740f7f308 100644
--- a/README.rst
+++ b/README.rst
@@ -5,11 +5,11 @@
.. This is used inside the doc to recover the start of the introduction
-.. image:: https://github.com/PyCQA/pylint/actions/workflows/tests.yaml/badge.svg?branch=main
- :target: https://github.com/PyCQA/pylint/actions
+.. image:: https://github.com/pylint-dev/pylint/actions/workflows/tests.yaml/badge.svg?branch=main
+ :target: https://github.com/pylint-dev/pylint/actions
-.. image:: https://codecov.io/gh/PyCQA/pylint/branch/main/graph/badge.svg?token=ZETEzayrfk
- :target: https://codecov.io/gh/PyCQA/pylint
+.. image:: https://codecov.io/gh/pylint-dev/pylint/branch/main/graph/badge.svg?token=ZETEzayrfk
+ :target: https://codecov.io/gh/pylint-dev/pylint
.. image:: https://img.shields.io/pypi/v/pylint.svg
:alt: Pypi Package version
@@ -23,17 +23,17 @@
:target: https://github.com/ambv/black
.. image:: https://img.shields.io/badge/linting-pylint-yellowgreen
- :target: https://github.com/PyCQA/pylint
+ :target: https://github.com/pylint-dev/pylint
-.. image:: https://results.pre-commit.ci/badge/github/PyCQA/pylint/main.svg
- :target: https://results.pre-commit.ci/latest/github/PyCQA/pylint/main
+.. image:: https://results.pre-commit.ci/badge/github/pylint-dev/pylint/main.svg
+ :target: https://results.pre-commit.ci/latest/github/pylint-dev/pylint/main
:alt: pre-commit.ci status
.. image:: https://bestpractices.coreinfrastructure.org/projects/6328/badge
:target: https://bestpractices.coreinfrastructure.org/projects/6328
:alt: CII Best Practices
-.. image:: https://api.securityscorecards.dev/projects/github.com/PyCQA/pylint/badge
+.. image:: https://img.shields.io/ossf-scorecard/github.com/PyCQA/pylint?label=openssf%20scorecard&style=flat
:target: https://api.securityscorecards.dev/projects/github.com/PyCQA/pylint
:alt: OpenSSF Scorecard
@@ -45,7 +45,7 @@ What is Pylint?
---------------
Pylint is a `static code analyser`_ for Python 2 or 3. The latest version supports Python
-3.7.2 and above.
+3.8.0 and above.
.. _`static code analyser`: https://en.wikipedia.org/wiki/Static_code_analysis
@@ -78,14 +78,14 @@ It can also be integrated in most editors or IDEs. More information can be found
.. This is used inside the doc to recover the end of the short text for installation
-What differentiate Pylint?
---------------------------
+What differentiates Pylint?
+---------------------------
Pylint is not trusting your typing and is inferring the actual value of nodes (for a
start because there was no typing when pylint started off) using its internal code
representation (astroid). If your code is ``import logging as argparse``, Pylint
can check and know that ``argparse.error(...)`` is in fact a logging call and not an
-argparse call. This makes pylint slower, but it also let pylint find more issues if
+argparse call. This makes pylint slower, but it also lets pylint find more issues if
your code is not fully typed.
[inference] is the killer feature that keeps us using [pylint] in our project despite how painfully slow it is.
@@ -94,7 +94,8 @@ your code is not fully typed.
.. _`Realist pylint user`: https://github.com/charliermarsh/ruff/issues/970#issuecomment-1381067064
pylint, not afraid of being a little slower than it already is, is also a lot more thorough than other linters.
-There is more checks, some opinionated one that are deactivated by default, but can be enabled using configuration.
+There are more checks, including some opinionated ones that are deactivated by default
+but can be enabled using configuration.
How to use pylint
-----------------
@@ -103,12 +104,12 @@ Pylint isn't smarter than you: it may warn you about things that you have
conscientiously done or check for some things that you don't care about.
During adoption, especially in a legacy project where pylint was never enforced,
it's best to start with the ``--errors-only`` flag, then disable
-convention and refactor message with ``--disable=C,R`` and progressively
+convention and refactor messages with ``--disable=C,R`` and progressively
re-evaluate and re-enable messages as your priorities evolve.
Pylint is highly configurable and permits to write plugins in order to add your
own checks (for example, for internal libraries or an internal rule). Pylint also has an
-ecosystem of existing plugins for popular frameworks and third party libraries.
+ecosystem of existing plugins for popular frameworks and third-party libraries.
.. note::
@@ -128,7 +129,7 @@ Advised linters alongside pylint
--------------------------------
Projects that you might want to use alongside pylint include ruff_ (**really** fast,
-with builtin auto-fix, and a growing number of checks taken from popular
+with builtin auto-fix and a growing number of checks taken from popular
linters but implemented in ``rust``) or flake8_ (faster and simpler checks with very few false positives),
mypy_, pyright_ or pyre_ (typing checks), bandit_ (security oriented checks), black_ and
isort_ (auto-formatting), autoflake_ (automated removal of unused imports or variables),
@@ -173,7 +174,7 @@ Please follow the `code of conduct`_ and check `the Contributor Guides`_ if you
make a code contribution.
.. _creating issues because you found a bug or want a feature: https://pylint.readthedocs.io/en/latest/contact.html#bug-reports-feedback
-.. _code of conduct: https://github.com/PyCQA/pylint/blob/main/CODE_OF_CONDUCT.md
+.. _code of conduct: https://github.com/pylint-dev/pylint/blob/main/CODE_OF_CONDUCT.md
.. _the Contributor Guides: https://pylint.readthedocs.io/en/latest/development_guide/contribute.html
.. This is used inside the doc to recover the end of the short text for contribution
@@ -184,7 +185,7 @@ Show your usage
You can place this badge in your README to let others know your project uses pylint.
.. image:: https://img.shields.io/badge/linting-pylint-yellowgreen
- :target: https://github.com/PyCQA/pylint
+ :target: https://github.com/pylint-dev/pylint
Learn how to add a badge to your documentation in the `the badge documentation`_.
@@ -193,12 +194,12 @@ Learn how to add a badge to your documentation in the `the badge documentation`_
License
-------
-pylint is, with a few exceptions listed below, `GPLv2 <https://github.com/PyCQA/pylint/blob/main/LICENSE>`_.
+pylint is, with a few exceptions listed below, `GPLv2 <https://github.com/pylint-dev/pylint/blob/main/LICENSE>`_.
The icon files are licensed under the `CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0/>`_ license:
-- `doc/logo.png <https://raw.githubusercontent.com/PyCQA/pylint/main/doc/logo.png>`_
-- `doc/logo.svg <https://raw.githubusercontent.com/PyCQA/pylint/main/doc/logo.svg>`_
+- `doc/logo.png <https://raw.githubusercontent.com/pylint-dev/pylint/main/doc/logo.png>`_
+- `doc/logo.svg <https://raw.githubusercontent.com/pylint-dev/pylint/main/doc/logo.svg>`_
Support
-------
@@ -207,7 +208,7 @@ Please check `the contact information`_.
.. _`the contact information`: https://pylint.readthedocs.io/en/latest/contact.html
-.. |tideliftlogo| image:: https://raw.githubusercontent.com/PyCQA/pylint/main/doc/media/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White.png
+.. |tideliftlogo| image:: https://raw.githubusercontent.com/pylint-dev/pylint/main/doc/media/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White.png
:width: 200
:alt: Tidelift
diff --git a/doc/conf.py b/doc/conf.py
index 76968ec36..0da6091cc 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -109,7 +109,8 @@ master_doc = "index"
# General information about the project.
project = "Pylint"
current_year = datetime.utcnow().year
-copyright = f"2003-{current_year}, Logilab, PyCQA and contributors" # pylint: disable=redefined-builtin
+contributors = "Logilab and Pylint contributors"
+copyright = f"2003-{current_year}, {contributors}" # pylint: disable=redefined-builtin
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -249,7 +250,7 @@ latex_documents = [
"index",
"Pylint.tex",
"Pylint Documentation",
- "Logilab, PyCQA and contributors",
+ contributors,
"manual",
)
]
@@ -282,9 +283,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
-man_pages = [
- ("index", "pylint", "Pylint Documentation", ["Logilab, PyCQA and contributors"], 1)
-]
+man_pages = [("index", "pylint", "Pylint Documentation", [contributors], 1)]
# pylint: disable-next=consider-using-namedtuple-or-dataclass
intersphinx_mapping = {
@@ -297,7 +296,9 @@ intersphinx_mapping = {
autosectionlabel_prefix_document = True
# Permit duplicated titles in the resulting document.
-# See https://github.com/PyCQA/pylint/issues/7362#issuecomment-1256932866
+# See https://github.com/pylint-dev/pylint/issues/7362#issuecomment-1256932866
autosectionlabel_maxdepth = 2
-linkcheck_ignore = ["https://github.com/PyCQA/pylint/blob/main/pylint/extensions/.*"]
+linkcheck_ignore = [
+ "https://github.com/pylint-dev/pylint/blob/main/pylint/extensions/.*"
+]
diff --git a/doc/contact.rst b/doc/contact.rst
index 5c3920dfc..cd3594f39 100644
--- a/doc/contact.rst
+++ b/doc/contact.rst
@@ -9,12 +9,12 @@ You think you have found a bug in Pylint? Well, this may be the case
since Pylint and Python are under heavy development!
Please take the time to check if it is already in the issue tracker at
-https://github.com/PyCQA/pylint
+https://github.com/pylint-dev/pylint
Note that the issue might also be reported in one of Pylint's major dependencies,
astroid:
-* https://github.com/PyCQA/astroid
+* https://github.com/pylint-dev/astroid
Discord server
--------------
diff --git a/doc/data/messages/a/arguments-renamed/bad.py b/doc/data/messages/a/arguments-renamed/bad.py
index 87b45a0d5..c9d785320 100644
--- a/doc/data/messages/a/arguments-renamed/bad.py
+++ b/doc/data/messages/a/arguments-renamed/bad.py
@@ -2,12 +2,15 @@ class Fruit:
def brew(self, ingredient_name: str):
print(f"Brewing a {type(self)} with {ingredient_name}")
+
class Apple(Fruit):
...
+
class Orange(Fruit):
def brew(self, flavor: str): # [arguments-renamed]
print(f"Brewing an orange with {flavor}")
+
for fruit, ingredient_name in [[Orange(), "thyme"], [Apple(), "cinnamon"]]:
fruit.brew(ingredient_name=ingredient_name)
diff --git a/doc/data/messages/a/arguments-renamed/good.py b/doc/data/messages/a/arguments-renamed/good.py
index 0cd1db756..de6583806 100644
--- a/doc/data/messages/a/arguments-renamed/good.py
+++ b/doc/data/messages/a/arguments-renamed/good.py
@@ -2,12 +2,15 @@ class Fruit:
def brew(self, ingredient_name: str):
print(f"Brewing a {type(self)} with {ingredient_name}")
+
class Apple(Fruit):
...
+
class Orange(Fruit):
def brew(self, ingredient_name: str):
print(f"Brewing an orange with {ingredient_name}")
+
for fruit, ingredient_name in [[Orange(), "thyme"], [Apple(), "cinnamon"]]:
fruit.brew(ingredient_name=ingredient_name)
diff --git a/doc/data/messages/a/assigning-non-slot/bad.py b/doc/data/messages/a/assigning-non-slot/bad.py
index a1a658ba2..506ad42cd 100644
--- a/doc/data/messages/a/assigning-non-slot/bad.py
+++ b/doc/data/messages/a/assigning-non-slot/bad.py
@@ -1,5 +1,5 @@
class Student:
- __slots__ = ('name',)
+ __slots__ = ("name",)
def __init__(self, name, surname):
self.name = name
diff --git a/doc/data/messages/a/assigning-non-slot/good.py b/doc/data/messages/a/assigning-non-slot/good.py
index feb5a10fa..733728618 100644
--- a/doc/data/messages/a/assigning-non-slot/good.py
+++ b/doc/data/messages/a/assigning-non-slot/good.py
@@ -1,5 +1,5 @@
class Student:
- __slots__ = ('name', 'surname')
+ __slots__ = ("name", "surname")
def __init__(self, name, surname):
self.name = name
diff --git a/doc/data/messages/b/bad-chained-comparison/bad.py b/doc/data/messages/b/bad-chained-comparison/bad.py
index eeca75f13..09e3ab627 100644
--- a/doc/data/messages/b/bad-chained-comparison/bad.py
+++ b/doc/data/messages/b/bad-chained-comparison/bad.py
@@ -1,3 +1,5 @@
def xor_check(*, left=None, right=None):
if left is None != right is None: # [bad-chained-comparison]
- raise ValueError('Either both left= and right= need to be provided or none should.')
+ raise ValueError(
+ "Either both left= and right= need to be provided or none should."
+ )
diff --git a/doc/data/messages/b/bad-chained-comparison/good.py b/doc/data/messages/b/bad-chained-comparison/good.py
index 115f4a9db..79bb64151 100644
--- a/doc/data/messages/b/bad-chained-comparison/good.py
+++ b/doc/data/messages/b/bad-chained-comparison/good.py
@@ -1,3 +1,5 @@
def xor_check(*, left=None, right=None):
if (left is None) != (right is None):
- raise ValueError('Either both left= and right= need to be provided or none should.')
+ raise ValueError(
+ "Either both left= and right= need to be provided or none should."
+ )
diff --git a/doc/data/messages/b/bad-classmethod-argument/bad.py b/doc/data/messages/b/bad-classmethod-argument/bad.py
index 7e43001b5..b8c6d02a0 100644
--- a/doc/data/messages/b/bad-classmethod-argument/bad.py
+++ b/doc/data/messages/b/bad-classmethod-argument/bad.py
@@ -1,5 +1,4 @@
class Klass:
-
@classmethod
def get_instance(self): # [bad-classmethod-argument]
return self()
diff --git a/doc/data/messages/b/bad-classmethod-argument/good.py b/doc/data/messages/b/bad-classmethod-argument/good.py
index 3d4decea3..6097f1e36 100644
--- a/doc/data/messages/b/bad-classmethod-argument/good.py
+++ b/doc/data/messages/b/bad-classmethod-argument/good.py
@@ -1,5 +1,4 @@
class Klass:
-
@classmethod
def get_instance(cls):
return cls()
diff --git a/doc/data/messages/b/bad-docstring-quotes/bad.py b/doc/data/messages/b/bad-docstring-quotes/bad.py
index 561921db0..bd800a40c 100644
--- a/doc/data/messages/b/bad-docstring-quotes/bad.py
+++ b/doc/data/messages/b/bad-docstring-quotes/bad.py
@@ -1,3 +1,3 @@
def foo(): # [bad-docstring-quotes]
- 'Docstring.'
+ "Docstring."
return
diff --git a/doc/data/messages/b/bad-file-encoding/bad.py b/doc/data/messages/b/bad-file-encoding/bad.py
new file mode 100644
index 000000000..a4ab46ea3
--- /dev/null
+++ b/doc/data/messages/b/bad-file-encoding/bad.py
@@ -0,0 +1 @@
+# coding: latin_1 # [bad-file-encoding]
diff --git a/doc/data/messages/b/bad-file-encoding/details.rst b/doc/data/messages/b/bad-file-encoding/details.rst
deleted file mode 100644
index ab8204529..000000000
--- a/doc/data/messages/b/bad-file-encoding/details.rst
+++ /dev/null
@@ -1 +0,0 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/b/bad-file-encoding/good.py b/doc/data/messages/b/bad-file-encoding/good.py
index c40beb573..e69de29bb 100644
--- a/doc/data/messages/b/bad-file-encoding/good.py
+++ b/doc/data/messages/b/bad-file-encoding/good.py
@@ -1 +0,0 @@
-# This is a placeholder for correct code for this message.
diff --git a/doc/data/messages/b/bad-format-character/details.rst b/doc/data/messages/b/bad-format-character/details.rst
index 25a2d3f5c..94733967b 100644
--- a/doc/data/messages/b/bad-format-character/details.rst
+++ b/doc/data/messages/b/bad-format-character/details.rst
@@ -1,2 +1,2 @@
This check is currently only active for "old-style" string formatting as seen in the examples.
-See `Issue #6085 <https://github.com/PyCQA/pylint/issues/6085>`_ for more information.
+See `Issue #6085 <https://github.com/pylint-dev/pylint/issues/6085>`_ for more information.
diff --git a/doc/data/messages/b/bad-format-string/bad.py b/doc/data/messages/b/bad-format-string/bad.py
index 523b8fba8..4cb811261 100644
--- a/doc/data/messages/b/bad-format-string/bad.py
+++ b/doc/data/messages/b/bad-format-string/bad.py
@@ -1 +1 @@
-print('{a[0] + a[1]}'.format(a=[0, 1])) # [bad-format-string]
+print("{a[0] + a[1]}".format(a=[0, 1])) # [bad-format-string]
diff --git a/doc/data/messages/b/bad-format-string/good.py b/doc/data/messages/b/bad-format-string/good.py
index f2d8919b0..10475fd67 100644
--- a/doc/data/messages/b/bad-format-string/good.py
+++ b/doc/data/messages/b/bad-format-string/good.py
@@ -1 +1 @@
-print('{a[0]} + {a[1]}'.format(a=[0, 1]))
+print("{a[0]} + {a[1]}".format(a=[0, 1]))
diff --git a/doc/data/messages/b/bad-indentation/good.py b/doc/data/messages/b/bad-indentation/good.py
index 1a1f33c11..e7ba80a56 100644
--- a/doc/data/messages/b/bad-indentation/good.py
+++ b/doc/data/messages/b/bad-indentation/good.py
@@ -1,2 +1,2 @@
if input():
- print('yes')
+ print("yes")
diff --git a/doc/data/messages/b/bad-plugin-value/details.rst b/doc/data/messages/b/bad-plugin-value/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/b/bad-plugin-value/details.rst
+++ b/doc/data/messages/b/bad-plugin-value/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/b/bad-string-format-type/details.rst b/doc/data/messages/b/bad-string-format-type/details.rst
index 65752275c..c60738410 100644
--- a/doc/data/messages/b/bad-string-format-type/details.rst
+++ b/doc/data/messages/b/bad-string-format-type/details.rst
@@ -1,2 +1,2 @@
This check is currently only active for "old-style" string formatting as seen in the examples.
-See `Issue #6085 <https://github.com/PyCQA/pylint/issues/6163>`_ for more information.
+See `Issue #6085 <https://github.com/pylint-dev/pylint/issues/6163>`_ for more information.
diff --git a/doc/data/messages/b/bad-thread-instantiation/bad.py b/doc/data/messages/b/bad-thread-instantiation/bad.py
index 580786d85..20fa72f5a 100644
--- a/doc/data/messages/b/bad-thread-instantiation/bad.py
+++ b/doc/data/messages/b/bad-thread-instantiation/bad.py
@@ -2,7 +2,7 @@ import threading
def thread_target(n):
- print(n ** 2)
+ print(n**2)
thread = threading.Thread(lambda: None) # [bad-thread-instantiation]
diff --git a/doc/data/messages/b/bad-thread-instantiation/good.py b/doc/data/messages/b/bad-thread-instantiation/good.py
index 735fa4da1..0dce7c342 100644
--- a/doc/data/messages/b/bad-thread-instantiation/good.py
+++ b/doc/data/messages/b/bad-thread-instantiation/good.py
@@ -2,7 +2,7 @@ import threading
def thread_target(n):
- print(n ** 2)
+ print(n**2)
thread = threading.Thread(target=thread_target, args=(10,))
diff --git a/doc/data/messages/c/c-extension-no-member/details.rst b/doc/data/messages/c/c-extension-no-member/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/c/c-extension-no-member/details.rst
+++ b/doc/data/messages/c/c-extension-no-member/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/c/cell-var-from-loop/bad.py b/doc/data/messages/c/cell-var-from-loop/bad.py
index 9dbd43880..b31934189 100644
--- a/doc/data/messages/c/cell-var-from-loop/bad.py
+++ b/doc/data/messages/c/cell-var-from-loop/bad.py
@@ -1,5 +1,7 @@
def foo(numbers):
for i in numbers:
+
def bar():
print(i) # [cell-var-from-loop]
+
bar()
diff --git a/doc/data/messages/c/class-variable-slots-conflict/good.py b/doc/data/messages/c/class-variable-slots-conflict/good.py
index b5324bff0..2428f7866 100644
--- a/doc/data/messages/c/class-variable-slots-conflict/good.py
+++ b/doc/data/messages/c/class-variable-slots-conflict/good.py
@@ -1,5 +1,5 @@
class Person:
- __slots__ = ("_age", "name",)
+ __slots__ = ("_age", "name")
def __init__(self, age, name):
self._age = age
diff --git a/doc/data/messages/c/compare-to-empty-string/bad.py b/doc/data/messages/c/compare-to-empty-string/bad.py
deleted file mode 100644
index 1ab940de7..000000000
--- a/doc/data/messages/c/compare-to-empty-string/bad.py
+++ /dev/null
@@ -1,8 +0,0 @@
-x = ""
-y = "hello"
-
-if x == "": # [compare-to-empty-string]
- print("x is an empty string")
-
-if y != "": # [compare-to-empty-string]
- print("y is not an empty string")
diff --git a/doc/data/messages/c/compare-to-empty-string/good.py b/doc/data/messages/c/compare-to-empty-string/good.py
deleted file mode 100644
index 6c4c67e36..000000000
--- a/doc/data/messages/c/compare-to-empty-string/good.py
+++ /dev/null
@@ -1,8 +0,0 @@
-x = ""
-y = "hello"
-
-if not x:
- print("x is an empty string")
-
-if y:
- print("y is not an empty string")
diff --git a/doc/data/messages/c/compare-to-empty-string/pylintrc b/doc/data/messages/c/compare-to-empty-string/pylintrc
deleted file mode 100644
index 13b9afd7e..000000000
--- a/doc/data/messages/c/compare-to-empty-string/pylintrc
+++ /dev/null
@@ -1,2 +0,0 @@
-[main]
-load-plugins=pylint.extensions.emptystring
diff --git a/doc/data/messages/c/compare-to-zero/bad.py b/doc/data/messages/c/compare-to-zero/bad.py
deleted file mode 100644
index a6b64a407..000000000
--- a/doc/data/messages/c/compare-to-zero/bad.py
+++ /dev/null
@@ -1,8 +0,0 @@
-x = 0
-y = 1
-
-if x == 0: # [compare-to-zero]
- print("x is equal to zero")
-
-if y != 0: # [compare-to-zero]
- print("y is not equal to zero")
diff --git a/doc/data/messages/c/compare-to-zero/good.py b/doc/data/messages/c/compare-to-zero/good.py
deleted file mode 100644
index bea3733e2..000000000
--- a/doc/data/messages/c/compare-to-zero/good.py
+++ /dev/null
@@ -1,8 +0,0 @@
-x = 0
-y = 1
-
-if not x:
- print("x is equal to zero")
-
-if y:
- print("y is not equal to zero")
diff --git a/doc/data/messages/c/compare-to-zero/pylintrc b/doc/data/messages/c/compare-to-zero/pylintrc
deleted file mode 100644
index 895291f84..000000000
--- a/doc/data/messages/c/compare-to-zero/pylintrc
+++ /dev/null
@@ -1,2 +0,0 @@
-[main]
-load-plugins=pylint.extensions.comparetozero
diff --git a/doc/data/messages/c/comparison-with-callable/bad.py b/doc/data/messages/c/comparison-with-callable/bad.py
index 9dc5ecd92..1dbdad07c 100644
--- a/doc/data/messages/c/comparison-with-callable/bad.py
+++ b/doc/data/messages/c/comparison-with-callable/bad.py
@@ -1,6 +1,7 @@
def function_returning_a_fruit() -> str:
return "orange"
+
def is_an_orange(fruit: str = "apple"):
# apple == <function function_returning_a_fruit at 0x7f343ff0a1f0>
return fruit == function_returning_a_fruit # [comparison-with-callable]
diff --git a/doc/data/messages/c/comparison-with-callable/good.py b/doc/data/messages/c/comparison-with-callable/good.py
index 587cf1b98..a49007128 100644
--- a/doc/data/messages/c/comparison-with-callable/good.py
+++ b/doc/data/messages/c/comparison-with-callable/good.py
@@ -1,6 +1,7 @@
def function_returning_a_fruit() -> str:
return "orange"
+
def is_an_orange(fruit: str = "apple"):
# apple == orange
return fruit == function_returning_a_fruit()
diff --git a/doc/data/messages/c/confusing-with-statement/bad.py b/doc/data/messages/c/confusing-with-statement/bad.py
index d84288058..e6570a5aa 100644
--- a/doc/data/messages/c/confusing-with-statement/bad.py
+++ b/doc/data/messages/c/confusing-with-statement/bad.py
@@ -1,2 +1,2 @@
-with open('file.txt', 'w') as fh1, fh2: # [confusing-with-statement]
+with open("file.txt", "w") as fh1, fh2: # [confusing-with-statement]
pass
diff --git a/doc/data/messages/c/confusing-with-statement/good.py b/doc/data/messages/c/confusing-with-statement/good.py
index e8b39d500..bcedaafa6 100644
--- a/doc/data/messages/c/confusing-with-statement/good.py
+++ b/doc/data/messages/c/confusing-with-statement/good.py
@@ -1,3 +1,3 @@
-with open('file.txt', 'w', encoding="utf8") as fh1:
- with open('file.txt', 'w', encoding="utf8") as fh2:
+with open("file.txt", "w", encoding="utf8") as fh1:
+ with open("file.txt", "w", encoding="utf8") as fh2:
pass
diff --git a/doc/data/messages/c/consider-merging-isinstance/bad.py b/doc/data/messages/c/consider-merging-isinstance/bad.py
index dca0ecf05..c7b059cb4 100644
--- a/doc/data/messages/c/consider-merging-isinstance/bad.py
+++ b/doc/data/messages/c/consider-merging-isinstance/bad.py
@@ -2,4 +2,5 @@ from typing import Any
def is_number(value: Any) -> bool:
- return isinstance(value, int) or isinstance(value, float) # [consider-merging-isinstance]
+ # +1: [consider-merging-isinstance]
+ return isinstance(value, int) or isinstance(value, float)
diff --git a/doc/data/messages/c/consider-using-any-or-all/good.py b/doc/data/messages/c/consider-using-any-or-all/good.py
index 5acf18e74..71a727e57 100644
--- a/doc/data/messages/c/consider-using-any-or-all/good.py
+++ b/doc/data/messages/c/consider-using-any-or-all/good.py
@@ -1,8 +1,8 @@
-
def any_even(items):
"""Return True if the list contains any even numbers"""
return any(item % 2 == 0 for item in items)
+
def all_even(items):
"""Return True if the list contains all even numbers"""
return all(item % 2 == 0 for item in items)
diff --git a/doc/data/messages/c/consider-using-enumerate/bad.py b/doc/data/messages/c/consider-using-enumerate/bad.py
index 25d7cbf6b..0beee2ecd 100644
--- a/doc/data/messages/c/consider-using-enumerate/bad.py
+++ b/doc/data/messages/c/consider-using-enumerate/bad.py
@@ -1,4 +1,4 @@
-seasons = ['Spring', 'Summer', 'Fall', 'Winter']
+seasons = ["Spring", "Summer", "Fall", "Winter"]
for i in range(len(seasons)): # [consider-using-enumerate]
print(i, seasons[i])
diff --git a/doc/data/messages/c/consider-using-enumerate/good.py b/doc/data/messages/c/consider-using-enumerate/good.py
index c52c27066..b078e48cb 100644
--- a/doc/data/messages/c/consider-using-enumerate/good.py
+++ b/doc/data/messages/c/consider-using-enumerate/good.py
@@ -1,4 +1,4 @@
-seasons = ['Spring', 'Summer', 'Fall', 'Winter']
+seasons = ["Spring", "Summer", "Fall", "Winter"]
for i, season in enumerate(seasons):
print(i, season)
diff --git a/doc/data/messages/c/consider-using-f-string/good.py b/doc/data/messages/c/consider-using-f-string/good.py
index eec5abf0f..f7913fa44 100644
--- a/doc/data/messages/c/consider-using-f-string/good.py
+++ b/doc/data/messages/c/consider-using-f-string/good.py
@@ -1,3 +1,3 @@
-menu = ('eggs', 'spam', 42.4)
+menu = ("eggs", "spam", 42.4)
f_string_order = f"{menu[0]} and {menu[1]}: {menu[2]:0.2f} ¤"
diff --git a/doc/data/messages/c/consider-using-generator/related.rst b/doc/data/messages/c/consider-using-generator/related.rst
index f380655fb..24727cf25 100644
--- a/doc/data/messages/c/consider-using-generator/related.rst
+++ b/doc/data/messages/c/consider-using-generator/related.rst
@@ -1,3 +1,3 @@
- `PEP 289 <https://peps.python.org/pep-0289/>`_
-- `Benchmark and discussion for any/all/list/tuple <https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109>`_
-- `Benchmark and discussion for sum/max/min <https://github.com/PyCQA/pylint/pull/6595#issuecomment-1125704244>`_
+- `Benchmark and discussion for any/all/list/tuple <https://github.com/pylint-dev/pylint/pull/3309#discussion_r576683109>`_
+- `Benchmark and discussion for sum/max/min <https://github.com/pylint-dev/pylint/pull/6595#issuecomment-1125704244>`_
diff --git a/doc/data/messages/c/consider-using-in/bad.py b/doc/data/messages/c/consider-using-in/bad.py
index 7199c1d82..81eddb7f3 100644
--- a/doc/data/messages/c/consider-using-in/bad.py
+++ b/doc/data/messages/c/consider-using-in/bad.py
@@ -1,2 +1,3 @@
def fruit_is_round(fruit):
- return fruit == "apple" or fruit == "orange" or fruit == "melon" # [consider-using-in]
+ # +1: [consider-using-in]
+ return fruit == "apple" or fruit == "orange" or fruit == "melon"
diff --git a/doc/data/messages/c/consider-using-join/bad.py b/doc/data/messages/c/consider-using-join/bad.py
index c77b6f767..5d5a32fb7 100644
--- a/doc/data/messages/c/consider-using-join/bad.py
+++ b/doc/data/messages/c/consider-using-join/bad.py
@@ -4,4 +4,5 @@ def fruits_to_string(fruits):
formatted_fruit += fruit # [consider-using-join]
return formatted_fruit
+
print(fruits_to_string(["apple", "pear", "peach"]))
diff --git a/doc/data/messages/c/cyclic-import/details.rst b/doc/data/messages/c/cyclic-import/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/c/cyclic-import/details.rst
+++ b/doc/data/messages/c/cyclic-import/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/d/deprecated-method/bad.py b/doc/data/messages/d/deprecated-method/bad.py
index dd75a258a..78870f3c3 100644
--- a/doc/data/messages/d/deprecated-method/bad.py
+++ b/doc/data/messages/d/deprecated-method/bad.py
@@ -1,3 +1,3 @@
import logging
-logging.warn("I'm coming, world !") # [deprecated-method]
+logging.warn("I'm coming, world !") # [deprecated-method]
diff --git a/doc/data/messages/d/dict-init-mutate/bad.py b/doc/data/messages/d/dict-init-mutate/bad.py
index d6d1cfe18..d7db9c528 100644
--- a/doc/data/messages/d/dict-init-mutate/bad.py
+++ b/doc/data/messages/d/dict-init-mutate/bad.py
@@ -1,3 +1,3 @@
fruit_prices = {} # [dict-init-mutate]
-fruit_prices['apple'] = 1
-fruit_prices['banana'] = 10
+fruit_prices["apple"] = 1
+fruit_prices["banana"] = 10
diff --git a/doc/data/messages/d/dict-iter-missing-items/bad.py b/doc/data/messages/d/dict-iter-missing-items/bad.py
index ec9dbd924..52efa3ad7 100644
--- a/doc/data/messages/d/dict-iter-missing-items/bad.py
+++ b/doc/data/messages/d/dict-iter-missing-items/bad.py
@@ -1,3 +1,3 @@
-data = {'Paris': 2_165_423, 'New York City': 8_804_190, 'Tokyo': 13_988_129}
+data = {"Paris": 2_165_423, "New York City": 8_804_190, "Tokyo": 13_988_129}
for city, population in data: # [dict-iter-missing-items]
print(f"{city} has population {population}.")
diff --git a/doc/data/messages/d/dict-iter-missing-items/good.py b/doc/data/messages/d/dict-iter-missing-items/good.py
index b94f125a3..3eb97f9e2 100644
--- a/doc/data/messages/d/dict-iter-missing-items/good.py
+++ b/doc/data/messages/d/dict-iter-missing-items/good.py
@@ -1,3 +1,3 @@
-data = {'Paris': 2_165_423, 'New York City': 8_804_190, 'Tokyo': 13_988_129}
+data = {"Paris": 2_165_423, "New York City": 8_804_190, "Tokyo": 13_988_129}
for city, population in data.items():
print(f"{city} has population {population}.")
diff --git a/doc/data/messages/d/duplicate-code/bad/orange.py b/doc/data/messages/d/duplicate-code/bad/orange.py
index faafce747..9be3c7b40 100644
--- a/doc/data/messages/d/duplicate-code/bad/orange.py
+++ b/doc/data/messages/d/duplicate-code/bad/orange.py
@@ -1,4 +1,4 @@
-class Orange: # [duplicate-code]
+class Orange: # [duplicate-code]
def __init__(self):
self.remaining_bites = 3
diff --git a/doc/data/messages/d/duplicate-value/bad.py b/doc/data/messages/d/duplicate-value/bad.py
index bf6f8ad00..975eebdae 100644
--- a/doc/data/messages/d/duplicate-value/bad.py
+++ b/doc/data/messages/d/duplicate-value/bad.py
@@ -1 +1 @@
-incorrect_set = {'value1', 23, 5, 'value1'} # [duplicate-value]
+incorrect_set = {"value1", 23, 5, "value1"} # [duplicate-value]
diff --git a/doc/data/messages/d/duplicate-value/good.py b/doc/data/messages/d/duplicate-value/good.py
index c30cd7821..beeeb39b9 100644
--- a/doc/data/messages/d/duplicate-value/good.py
+++ b/doc/data/messages/d/duplicate-value/good.py
@@ -1 +1 @@
-correct_set = {'value1', 23, 5}
+correct_set = {"value1", 23, 5}
diff --git a/doc/data/messages/e/exec-used/good.py b/doc/data/messages/e/exec-used/good.py
index ef9b17f3f..f3e1dd7b7 100644
--- a/doc/data/messages/e/exec-used/good.py
+++ b/doc/data/messages/e/exec-used/good.py
@@ -1,8 +1,9 @@
def get_user_code(name):
- return input(f'Enter code to be executed please, {name}: ')
+ return input(f"Enter code to be executed please, {name}: ")
username = "Ada"
-allowed_globals = {'__builtins__' : None}
-allowed_locals = {'print': print}
-exec(get_user_code(username), allowed_globals, allowed_locals) # pylint: disable=exec-used
+allowed_globals = {"__builtins__": None}
+allowed_locals = {"print": print}
+# pylint: disable-next=exec-used
+exec(get_user_code(username), allowed_globals, allowed_locals)
diff --git a/doc/data/messages/f/fixme/details.rst b/doc/data/messages/f/fixme/details.rst
index 02869b537..732b4d88d 100644
--- a/doc/data/messages/f/fixme/details.rst
+++ b/doc/data/messages/f/fixme/details.rst
@@ -1,2 +1,2 @@
You can get use regular expressions and the ``notes-rgx`` option to create some constraints for this message.
-See `the following issue <https://github.com/PyCQA/pylint/issues/2874>`_ for some examples.
+See `the following issue <https://github.com/pylint-dev/pylint/issues/2874>`_ for some examples.
diff --git a/doc/data/messages/f/forgotten-debug-statement/bad.py b/doc/data/messages/f/forgotten-debug-statement/bad.py
index 6a2a34580..e37185371 100644
--- a/doc/data/messages/f/forgotten-debug-statement/bad.py
+++ b/doc/data/messages/f/forgotten-debug-statement/bad.py
@@ -3,10 +3,15 @@ import pdb
def find_the_treasure(clues):
for clue in clues:
- pdb.set_trace() # [forgotten-debug-statement]
+ pdb.set_trace() # [forgotten-debug-statement]
if "treasure" in clue:
return True
return False
-treasure_hunt = ["Dead Man's Chest", "X marks the spot", "The treasure is buried near the palm tree"]
+
+treasure_hunt = [
+ "Dead Man's Chest",
+ "X marks the spot",
+ "The treasure is buried near the palm tree",
+]
find_the_treasure(treasure_hunt)
diff --git a/doc/data/messages/f/forgotten-debug-statement/good.py b/doc/data/messages/f/forgotten-debug-statement/good.py
index 21132cb47..7896ff50e 100644
--- a/doc/data/messages/f/forgotten-debug-statement/good.py
+++ b/doc/data/messages/f/forgotten-debug-statement/good.py
@@ -4,5 +4,10 @@ def find_the_treasure(clues):
return True
return False
-treasure_hunt = ["Dead Man's Chest", "X marks the spot", "The treasure is buried near the palm tree"]
+
+treasure_hunt = [
+ "Dead Man's Chest",
+ "X marks the spot",
+ "The treasure is buried near the palm tree",
+]
find_the_treasure(treasure_hunt)
diff --git a/doc/data/messages/f/format-combined-specification/bad.py b/doc/data/messages/f/format-combined-specification/bad.py
index 6a6a051f2..f530aa0d5 100644
--- a/doc/data/messages/f/format-combined-specification/bad.py
+++ b/doc/data/messages/f/format-combined-specification/bad.py
@@ -1 +1 @@
-print('{} {1}'.format('hello', 'world')) # [format-combined-specification]
+print("{} {1}".format("hello", "world")) # [format-combined-specification]
diff --git a/doc/data/messages/f/format-combined-specification/good.py b/doc/data/messages/f/format-combined-specification/good.py
index 542b77507..8aaab67f2 100644
--- a/doc/data/messages/f/format-combined-specification/good.py
+++ b/doc/data/messages/f/format-combined-specification/good.py
@@ -1,3 +1,3 @@
-print('{0} {1}'.format('hello', 'world'))
+print("{0} {1}".format("hello", "world"))
# or
-print('{} {}'.format('hello', 'world'))
+print("{} {}".format("hello", "world"))
diff --git a/doc/data/messages/i/implicit-str-concat/details.rst b/doc/data/messages/i/implicit-str-concat/details.rst
new file mode 100644
index 000000000..f09d48110
--- /dev/null
+++ b/doc/data/messages/i/implicit-str-concat/details.rst
@@ -0,0 +1,26 @@
+By default, detection of implicit string concatenation of line jumps is disabled.
+Hence the following code will not trigger this rule:
+
+.. code-block:: python
+
+ SEQ = ('a', 'b'
+ 'c')
+
+In order to detect this case, you must enable `check-str-concat-over-line-jumps`:
+
+.. code-block:: toml
+
+ [STRING_CONSTANT]
+ check-str-concat-over-line-jumps = yes
+
+However, the drawback of this setting is that it will trigger false positive
+for string parameters passed on multiple lines in function calls:
+
+.. code-block:: python
+
+ warnings.warn(
+ "rotate() is deprecated and will be removed in a future release. "
+ "Use the rotation() context manager instead.",
+ DeprecationWarning,
+ stacklevel=3,
+ )
diff --git a/doc/data/messages/i/implicit-str-concat/related.rst b/doc/data/messages/i/implicit-str-concat/related.rst
new file mode 100644
index 000000000..90d29dbdf
--- /dev/null
+++ b/doc/data/messages/i/implicit-str-concat/related.rst
@@ -0,0 +1 @@
+- `Allowing parenthesized implicitly concatenated strings, to be more compatible with black <https://github.com/pylint-dev/pylint/pull/8590>`_
diff --git a/doc/data/messages/i/import-outside-toplevel/bad.py b/doc/data/messages/i/import-outside-toplevel/bad.py
index 54db8840d..5262ba770 100644
--- a/doc/data/messages/i/import-outside-toplevel/bad.py
+++ b/doc/data/messages/i/import-outside-toplevel/bad.py
@@ -1,3 +1,4 @@
def print_python_version():
import sys # [import-outside-toplevel]
+
print(sys.version_info)
diff --git a/doc/data/messages/i/import-private-name/bad.py b/doc/data/messages/i/import-private-name/bad.py
index 96a2a9fc9..e562e4928 100644
--- a/doc/data/messages/i/import-private-name/bad.py
+++ b/doc/data/messages/i/import-private-name/bad.py
@@ -2,6 +2,7 @@ from argparse import _AttributeHolder, _SubParsersAction # [import-private-name
attr_holder = _AttributeHolder()
+
def add_sub_parser(sub_parsers: _SubParsersAction):
- sub_parsers.add_parser('my_subparser')
+ sub_parsers.add_parser("my_subparser")
# ...
diff --git a/doc/data/messages/i/import-private-name/good.py b/doc/data/messages/i/import-private-name/good.py
index 3a5599cfb..810005fea 100644
--- a/doc/data/messages/i/import-private-name/good.py
+++ b/doc/data/messages/i/import-private-name/good.py
@@ -4,5 +4,5 @@ from argparse import _SubParsersAction
def add_sub_parser(sub_parsers: _SubParsersAction):
- sub_parsers.add_parser('my_subparser')
+ sub_parsers.add_parser("my_subparser")
# ...
diff --git a/doc/data/messages/i/init-is-generator/bad.py b/doc/data/messages/i/init-is-generator/bad.py
index 37c204ab2..415b94c4d 100644
--- a/doc/data/messages/i/init-is-generator/bad.py
+++ b/doc/data/messages/i/init-is-generator/bad.py
@@ -2,4 +2,5 @@ class Fruit:
def __init__(self, worms): # [init-is-generator]
yield from worms
+
apple = Fruit(["Fahad", "Anisha", "Tabatha"])
diff --git a/doc/data/messages/i/init-is-generator/good.py b/doc/data/messages/i/init-is-generator/good.py
index 483cd46c1..1f5bf0047 100644
--- a/doc/data/messages/i/init-is-generator/good.py
+++ b/doc/data/messages/i/init-is-generator/good.py
@@ -5,6 +5,7 @@ class Fruit:
def worms(self):
yield from self.__worms
+
apple = Fruit(["Fahad", "Anisha", "Tabatha"])
for worm in apple.worms():
pass
diff --git a/doc/data/messages/i/invalid-all-format/bad.py b/doc/data/messages/i/invalid-all-format/bad.py
index 9559869a9..c89137734 100644
--- a/doc/data/messages/i/invalid-all-format/bad.py
+++ b/doc/data/messages/i/invalid-all-format/bad.py
@@ -1,3 +1,3 @@
-__all__ = ("CONST") # [invalid-all-format]
+__all__ = "CONST" # [invalid-all-format]
CONST = 42
diff --git a/doc/data/messages/i/invalid-all-object/bad.py b/doc/data/messages/i/invalid-all-object/bad.py
index 74cf738dc..04509727b 100644
--- a/doc/data/messages/i/invalid-all-object/bad.py
+++ b/doc/data/messages/i/invalid-all-object/bad.py
@@ -4,8 +4,10 @@ __all__ = (
Worm,
)
+
class Fruit:
pass
+
class Worm:
pass
diff --git a/doc/data/messages/i/invalid-all-object/good.py b/doc/data/messages/i/invalid-all-object/good.py
index db5879cf3..351cfa1c6 100644
--- a/doc/data/messages/i/invalid-all-object/good.py
+++ b/doc/data/messages/i/invalid-all-object/good.py
@@ -1,7 +1,9 @@
-__all__ = ['Fruit', 'Worm']
+__all__ = ["Fruit", "Worm"]
+
class Fruit:
pass
+
class Worm:
pass
diff --git a/doc/data/messages/i/invalid-character-backspace/bad.py b/doc/data/messages/i/invalid-character-backspace/bad.py
index a41d6b2bc..ac9ed67a3 100644
--- a/doc/data/messages/i/invalid-character-backspace/bad.py
+++ b/doc/data/messages/i/invalid-character-backspace/bad.py
@@ -1 +1 @@
-STRING = "Invalid character backspace " # [invalid-character-backspace]
+STRING = "Invalid character backspace " # [invalid-character-backspace]
diff --git a/doc/data/messages/i/invalid-character-carriage-return/details.rst b/doc/data/messages/i/invalid-character-carriage-return/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/i/invalid-character-carriage-return/details.rst
+++ b/doc/data/messages/i/invalid-character-carriage-return/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/i/invalid-character-esc/bad.py b/doc/data/messages/i/invalid-character-esc/bad.py
index 24c6a79ea..0d50cab42 100644
--- a/doc/data/messages/i/invalid-character-esc/bad.py
+++ b/doc/data/messages/i/invalid-character-esc/bad.py
@@ -1 +1 @@
-STRING = "Invalid escape character " # [invalid-character-esc]
+STRING = "Invalid escape character " # [invalid-character-esc]
diff --git a/doc/data/messages/i/invalid-character-nul/details.rst b/doc/data/messages/i/invalid-character-nul/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/i/invalid-character-nul/details.rst
+++ b/doc/data/messages/i/invalid-character-nul/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/i/invalid-character-sub/bad.py b/doc/data/messages/i/invalid-character-sub/bad.py
index 96f8c06fe..313066d3b 100644
--- a/doc/data/messages/i/invalid-character-sub/bad.py
+++ b/doc/data/messages/i/invalid-character-sub/bad.py
@@ -1 +1 @@
-STRING = "Invalid character sub " # [invalid-character-sub]
+STRING = "Invalid character sub " # [invalid-character-sub]
diff --git a/doc/data/messages/i/invalid-character-zero-width-space/bad.py b/doc/data/messages/i/invalid-character-zero-width-space/bad.py
index 1854893b4..99160fc8f 100644
--- a/doc/data/messages/i/invalid-character-zero-width-space/bad.py
+++ b/doc/data/messages/i/invalid-character-zero-width-space/bad.py
@@ -1 +1 @@
-STRING = "Invalid character zero-width-space ​" # [invalid-character-zero-width-space]
+STRING = "Invalid character zero-width-space ​" # [invalid-character-zero-width-space]
diff --git a/doc/data/messages/i/invalid-envvar-default/bad.py b/doc/data/messages/i/invalid-envvar-default/bad.py
index 8d66765ee..9b564b9c8 100644
--- a/doc/data/messages/i/invalid-envvar-default/bad.py
+++ b/doc/data/messages/i/invalid-envvar-default/bad.py
@@ -1,3 +1,3 @@
import os
-env = os.getenv('SECRET_KEY', 1) # [invalid-envvar-default]
+env = os.getenv("SECRET_KEY", 1) # [invalid-envvar-default]
diff --git a/doc/data/messages/i/invalid-envvar-default/good.py b/doc/data/messages/i/invalid-envvar-default/good.py
index 67656d04a..103925941 100644
--- a/doc/data/messages/i/invalid-envvar-default/good.py
+++ b/doc/data/messages/i/invalid-envvar-default/good.py
@@ -1,3 +1,3 @@
import os
-env = os.getenv('SECRET_KEY', '1')
+env = os.getenv("SECRET_KEY", "1")
diff --git a/doc/data/messages/i/invalid-envvar-value/good.py b/doc/data/messages/i/invalid-envvar-value/good.py
index 0b510db39..fd082ecfd 100644
--- a/doc/data/messages/i/invalid-envvar-value/good.py
+++ b/doc/data/messages/i/invalid-envvar-value/good.py
@@ -1,3 +1,3 @@
import os
-os.getenv('1')
+os.getenv("1")
diff --git a/doc/data/messages/i/invalid-format-index/good.py b/doc/data/messages/i/invalid-format-index/good.py
index 37129745b..69557980b 100644
--- a/doc/data/messages/i/invalid-format-index/good.py
+++ b/doc/data/messages/i/invalid-format-index/good.py
@@ -1,2 +1,2 @@
enough_fruits = ["apple", "banana"]
-print('The second fruit is a {fruits[1]}'.format(fruits=enough_fruits))
+print("The second fruit is a {fruits[1]}".format(fruits=enough_fruits))
diff --git a/doc/data/messages/i/invalid-length-returned/bad.py b/doc/data/messages/i/invalid-length-returned/bad.py
index 0dcac176c..2ae1396c3 100644
--- a/doc/data/messages/i/invalid-length-returned/bad.py
+++ b/doc/data/messages/i/invalid-length-returned/bad.py
@@ -3,4 +3,4 @@ class FruitBasket:
self.fruits = ["Apple", "Banana", "Orange"]
def __len__(self): # [invalid-length-returned]
- return - len(self.fruits)
+ return -len(self.fruits)
diff --git a/doc/data/messages/i/invalid-metaclass/good.py b/doc/data/messages/i/invalid-metaclass/good.py
index e8b90fc01..07c907f10 100644
--- a/doc/data/messages/i/invalid-metaclass/good.py
+++ b/doc/data/messages/i/invalid-metaclass/good.py
@@ -1,5 +1,6 @@
class Plant:
pass
+
class Apple(Plant):
pass
diff --git a/doc/data/messages/i/invalid-name/bad.py b/doc/data/messages/i/invalid-name/bad.py
index fac9b4947..b40ee4746 100644
--- a/doc/data/messages/i/invalid-name/bad.py
+++ b/doc/data/messages/i/invalid-name/bad.py
@@ -1,5 +1,4 @@
class cat: # [invalid-name]
-
def Meow(self, NUMBER_OF_MEOW): # [invalid-name, invalid-name]
print("Meow" * NUMBER_OF_MEOW)
return NUMBER_OF_MEOW
diff --git a/doc/data/messages/i/invalid-name/good.py b/doc/data/messages/i/invalid-name/good.py
index 3decdb3e4..d747a72f0 100644
--- a/doc/data/messages/i/invalid-name/good.py
+++ b/doc/data/messages/i/invalid-name/good.py
@@ -1,5 +1,4 @@
class Cat:
-
def meow(self, number_of_meow):
print("Meow" * number_of_meow)
return number_of_meow
diff --git a/doc/data/messages/i/invalid-overridden-method/bad.py b/doc/data/messages/i/invalid-overridden-method/bad.py
index 379f7c0a1..c7e250fb5 100644
--- a/doc/data/messages/i/invalid-overridden-method/bad.py
+++ b/doc/data/messages/i/invalid-overridden-method/bad.py
@@ -2,6 +2,7 @@ class Fruit:
async def bore(self, insect):
insect.eat(self)
+
class Apple(Fruit):
def bore(self, insect): # [invalid-overridden-method]
insect.eat(self)
diff --git a/doc/data/messages/i/invalid-overridden-method/good.py b/doc/data/messages/i/invalid-overridden-method/good.py
index f5b56308f..320663778 100644
--- a/doc/data/messages/i/invalid-overridden-method/good.py
+++ b/doc/data/messages/i/invalid-overridden-method/good.py
@@ -2,6 +2,7 @@ class Fruit:
async def bore(self, insect):
insect.eat(self)
+
class Apple(Fruit):
async def bore(self, insect):
insect.eat(self)
diff --git a/doc/data/messages/i/invalid-sequence-index/bad.py b/doc/data/messages/i/invalid-sequence-index/bad.py
index f153503b9..c13a3742a 100644
--- a/doc/data/messages/i/invalid-sequence-index/bad.py
+++ b/doc/data/messages/i/invalid-sequence-index/bad.py
@@ -1,2 +1,2 @@
-fruits = ['apple', 'banana', 'orange']
-print(fruits['apple']) # [invalid-sequence-index]
+fruits = ["apple", "banana", "orange"]
+print(fruits["apple"]) # [invalid-sequence-index]
diff --git a/doc/data/messages/i/invalid-sequence-index/good.py b/doc/data/messages/i/invalid-sequence-index/good.py
index 04bdf3ffd..840f3c3f3 100644
--- a/doc/data/messages/i/invalid-sequence-index/good.py
+++ b/doc/data/messages/i/invalid-sequence-index/good.py
@@ -1,2 +1,2 @@
-fruits = ['apple', 'banana', 'orange']
+fruits = ["apple", "banana", "orange"]
print(fruits[0])
diff --git a/doc/data/messages/i/invalid-slots-object/bad.py b/doc/data/messages/i/invalid-slots-object/bad.py
index 41baaa54f..03690cf36 100644
--- a/doc/data/messages/i/invalid-slots-object/bad.py
+++ b/doc/data/messages/i/invalid-slots-object/bad.py
@@ -1,2 +1,2 @@
class Person:
- __slots__ = ('name', 3) # [invalid-slots-object]
+ __slots__ = ("name", 3) # [invalid-slots-object]
diff --git a/doc/data/messages/i/invalid-slots-object/good.py b/doc/data/messages/i/invalid-slots-object/good.py
index e8eec6949..823a971f1 100644
--- a/doc/data/messages/i/invalid-slots-object/good.py
+++ b/doc/data/messages/i/invalid-slots-object/good.py
@@ -1,2 +1,2 @@
class Person:
- __slots__ = ('name', 'surname')
+ __slots__ = ("name", "surname")
diff --git a/doc/data/messages/i/invalid-slots/good.py b/doc/data/messages/i/invalid-slots/good.py
index 0cb4d1b1e..b7881356c 100644
--- a/doc/data/messages/i/invalid-slots/good.py
+++ b/doc/data/messages/i/invalid-slots/good.py
@@ -1,2 +1,2 @@
class Person:
- __slots__ = ("name", "age",)
+ __slots__ = ("name", "age")
diff --git a/doc/data/messages/i/invalid-star-assignment-target/bad.py b/doc/data/messages/i/invalid-star-assignment-target/bad.py
index fc69dc7e6..476928560 100644
--- a/doc/data/messages/i/invalid-star-assignment-target/bad.py
+++ b/doc/data/messages/i/invalid-star-assignment-target/bad.py
@@ -1 +1 @@
-*fruit = ['apple', 'banana', 'orange'] # [invalid-star-assignment-target]
+*fruit = ["apple", "banana", "orange"] # [invalid-star-assignment-target]
diff --git a/doc/data/messages/i/invalid-star-assignment-target/good.py b/doc/data/messages/i/invalid-star-assignment-target/good.py
index 74cf088e2..b174bcd20 100644
--- a/doc/data/messages/i/invalid-star-assignment-target/good.py
+++ b/doc/data/messages/i/invalid-star-assignment-target/good.py
@@ -1 +1 @@
-fruit = ['apple', 'banana', 'orange']
+fruit = ["apple", "banana", "orange"]
diff --git a/doc/data/messages/i/invalid-unary-operand-type/bad.py b/doc/data/messages/i/invalid-unary-operand-type/bad.py
index 77391c3d9..b01195194 100644
--- a/doc/data/messages/i/invalid-unary-operand-type/bad.py
+++ b/doc/data/messages/i/invalid-unary-operand-type/bad.py
@@ -1,3 +1,3 @@
cherries = 10
eaten_cherries = int
-cherries = - eaten_cherries # [invalid-unary-operand-type]
+cherries = -eaten_cherries # [invalid-unary-operand-type]
diff --git a/doc/data/messages/i/invalid-unicode-codec/details.rst b/doc/data/messages/i/invalid-unicode-codec/details.rst
index ab8204529..67001aca8 100644
--- a/doc/data/messages/i/invalid-unicode-codec/details.rst
+++ b/doc/data/messages/i/invalid-unicode-codec/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+This message is a placeholder for a potential future issue with unicode codecs.
diff --git a/doc/data/messages/i/invalid-unicode-codec/good.py b/doc/data/messages/i/invalid-unicode-codec/good.py
deleted file mode 100644
index c40beb573..000000000
--- a/doc/data/messages/i/invalid-unicode-codec/good.py
+++ /dev/null
@@ -1 +0,0 @@
-# This is a placeholder for correct code for this message.
diff --git a/doc/data/messages/l/line-too-long/details.rst b/doc/data/messages/l/line-too-long/details.rst
index 7f774a661..3a3a03897 100644
--- a/doc/data/messages/l/line-too-long/details.rst
+++ b/doc/data/messages/l/line-too-long/details.rst
@@ -2,4 +2,4 @@ Pragma controls such as ``# pylint: disable=all`` are not counted toward line le
If you attempt to disable this message via ``# pylint: disable=line-too-long`` in a module with no code, you may receive a message for ``useless-suppression``. This is a false positive of ``useless-suppression`` we can't easily fix.
-See https://github.com/PyCQA/pylint/issues/3368 for more information.
+See https://github.com/pylint-dev/pylint/issues/3368 for more information.
diff --git a/doc/data/messages/l/locally-disabled/bad.py b/doc/data/messages/l/locally-disabled/bad.py
index 5bfbd58f8..1a3307856 100644
--- a/doc/data/messages/l/locally-disabled/bad.py
+++ b/doc/data/messages/l/locally-disabled/bad.py
@@ -3,5 +3,6 @@ def wizard_spells(spell_book):
for spell in spell_book:
print(f"Abracadabra! {spell}.")
+
spell_list = ["Levitation", "Invisibility", "Fireball", "Teleportation"]
wizard_spells(spell_list)
diff --git a/doc/data/messages/l/locally-disabled/good.py b/doc/data/messages/l/locally-disabled/good.py
index 322a78f27..1bf60bca0 100644
--- a/doc/data/messages/l/locally-disabled/good.py
+++ b/doc/data/messages/l/locally-disabled/good.py
@@ -2,5 +2,6 @@ def wizard_spells(spell_book):
for spell in spell_book:
print(f"Abracadabra! {spell}.")
+
spell_list = ["Levitation", "Invisibility", "Fireball", "Teleportation"]
wizard_spells(spell_list)
diff --git a/doc/data/messages/l/logging-format-interpolation/bad.py b/doc/data/messages/l/logging-format-interpolation/bad.py
index 0cef831d2..dd828e1f9 100644
--- a/doc/data/messages/l/logging-format-interpolation/bad.py
+++ b/doc/data/messages/l/logging-format-interpolation/bad.py
@@ -1,4 +1,5 @@
import logging
import sys
-logging.error('Python version: {}'.format(sys.version)) # [logging-format-interpolation]
+# +1: [logging-format-interpolation]
+logging.error("Python version: {}".format(sys.version))
diff --git a/doc/data/messages/l/logging-format-interpolation/good.py b/doc/data/messages/l/logging-format-interpolation/good.py
index 7f54cebfb..a993d0dd8 100644
--- a/doc/data/messages/l/logging-format-interpolation/good.py
+++ b/doc/data/messages/l/logging-format-interpolation/good.py
@@ -1,4 +1,4 @@
import logging
import sys
-logging.error('Python version: %s', sys.version)
+logging.error("Python version: %s", sys.version)
diff --git a/doc/data/messages/l/logging-fstring-interpolation/bad.py b/doc/data/messages/l/logging-fstring-interpolation/bad.py
index dfee6d4c6..773435fb4 100644
--- a/doc/data/messages/l/logging-fstring-interpolation/bad.py
+++ b/doc/data/messages/l/logging-fstring-interpolation/bad.py
@@ -1,4 +1,4 @@
import logging
import sys
-logging.error(f'Python version: {sys.version}') # [logging-fstring-interpolation]
+logging.error(f"Python version: {sys.version}") # [logging-fstring-interpolation]
diff --git a/doc/data/messages/l/logging-fstring-interpolation/good.py b/doc/data/messages/l/logging-fstring-interpolation/good.py
index 7f54cebfb..a993d0dd8 100644
--- a/doc/data/messages/l/logging-fstring-interpolation/good.py
+++ b/doc/data/messages/l/logging-fstring-interpolation/good.py
@@ -1,4 +1,4 @@
import logging
import sys
-logging.error('Python version: %s', sys.version)
+logging.error("Python version: %s", sys.version)
diff --git a/doc/data/messages/l/logging-not-lazy/bad.py b/doc/data/messages/l/logging-not-lazy/bad.py
index cb6bc3d84..7ba0631db 100644
--- a/doc/data/messages/l/logging-not-lazy/bad.py
+++ b/doc/data/messages/l/logging-not-lazy/bad.py
@@ -3,5 +3,5 @@ import logging
try:
function()
except Exception as e:
- logging.error('Error occurred: %s' % e) # [logging-not-lazy]
+ logging.error("Error occurred: %s" % e) # [logging-not-lazy]
raise
diff --git a/doc/data/messages/l/logging-not-lazy/good.py b/doc/data/messages/l/logging-not-lazy/good.py
index c61704872..ede0050cb 100644
--- a/doc/data/messages/l/logging-not-lazy/good.py
+++ b/doc/data/messages/l/logging-not-lazy/good.py
@@ -3,5 +3,5 @@ import logging
try:
function()
except Exception as e:
- logging.error('Error occurred: %s', e)
+ logging.error("Error occurred: %s", e)
raise
diff --git a/doc/data/messages/l/logging-too-few-args/bad.py b/doc/data/messages/l/logging-too-few-args/bad.py
index 66d88d0b3..a20b83b12 100644
--- a/doc/data/messages/l/logging-too-few-args/bad.py
+++ b/doc/data/messages/l/logging-too-few-args/bad.py
@@ -3,5 +3,5 @@ import logging
try:
function()
except Exception as e:
- logging.error('%s error occurred: %s', e) # [logging-too-few-args]
+ logging.error("%s error occurred: %s", e) # [logging-too-few-args]
raise
diff --git a/doc/data/messages/l/logging-too-few-args/good.py b/doc/data/messages/l/logging-too-few-args/good.py
index 4b34b58b9..4812aec01 100644
--- a/doc/data/messages/l/logging-too-few-args/good.py
+++ b/doc/data/messages/l/logging-too-few-args/good.py
@@ -3,5 +3,5 @@ import logging
try:
function()
except Exception as e:
- logging.error('%s error occurred: %s', type(e), e)
+ logging.error("%s error occurred: %s", type(e), e)
raise
diff --git a/doc/data/messages/l/logging-too-many-args/bad.py b/doc/data/messages/l/logging-too-many-args/bad.py
index 45f485d93..03753f607 100644
--- a/doc/data/messages/l/logging-too-many-args/bad.py
+++ b/doc/data/messages/l/logging-too-many-args/bad.py
@@ -3,5 +3,5 @@ import logging
try:
function()
except Exception as e:
- logging.error('Error occurred: %s', type(e), e) # [logging-too-many-args]
+ logging.error("Error occurred: %s", type(e), e) # [logging-too-many-args]
raise
diff --git a/doc/data/messages/l/logging-too-many-args/good.py b/doc/data/messages/l/logging-too-many-args/good.py
index 4b34b58b9..4812aec01 100644
--- a/doc/data/messages/l/logging-too-many-args/good.py
+++ b/doc/data/messages/l/logging-too-many-args/good.py
@@ -3,5 +3,5 @@ import logging
try:
function()
except Exception as e:
- logging.error('%s error occurred: %s', type(e), e)
+ logging.error("%s error occurred: %s", type(e), e)
raise
diff --git a/doc/data/messages/l/logging-unsupported-format/bad.py b/doc/data/messages/l/logging-unsupported-format/bad.py
index 5b5ea5a5f..1f36a0d34 100644
--- a/doc/data/messages/l/logging-unsupported-format/bad.py
+++ b/doc/data/messages/l/logging-unsupported-format/bad.py
@@ -1,3 +1,3 @@
import logging
-logging.info("%s %y !", "Hello", "World") # [logging-unsupported-format]
+logging.info("%s %y !", "Hello", "World") # [logging-unsupported-format]
diff --git a/doc/data/messages/m/magic-value-comparison/bad.py b/doc/data/messages/m/magic-value-comparison/bad.py
index 536659abe..eef9e5d27 100644
--- a/doc/data/messages/m/magic-value-comparison/bad.py
+++ b/doc/data/messages/m/magic-value-comparison/bad.py
@@ -3,8 +3,8 @@ import random
measurement = random.randint(0, 200)
above_threshold = False
i = 0
-while i < 5: # [magic-value-comparison]
- above_threshold = measurement > 100 # [magic-value-comparison]
+while i < 5: # [magic-value-comparison]
+ above_threshold = measurement > 100 # [magic-value-comparison]
if above_threshold:
break
measurement = random.randint(0, 200)
diff --git a/doc/data/messages/m/misplaced-format-function/bad.py b/doc/data/messages/m/misplaced-format-function/bad.py
index 0bd172369..bc40bba4d 100644
--- a/doc/data/messages/m/misplaced-format-function/bad.py
+++ b/doc/data/messages/m/misplaced-format-function/bad.py
@@ -1 +1 @@
-print('Value: {}').format('Car') # [misplaced-format-function]
+print("Value: {}").format("Car") # [misplaced-format-function]
diff --git a/doc/data/messages/m/misplaced-format-function/good.py b/doc/data/messages/m/misplaced-format-function/good.py
index 809dcf974..8b31d5cf5 100644
--- a/doc/data/messages/m/misplaced-format-function/good.py
+++ b/doc/data/messages/m/misplaced-format-function/good.py
@@ -1 +1 @@
-print('Value: {}'.format('Car'))
+print("Value: {}".format("Car"))
diff --git a/doc/data/messages/m/missing-any-param-doc/bad.py b/doc/data/messages/m/missing-any-param-doc/bad.py
index ca92793f5..bf5f232ce 100644
--- a/doc/data/messages/m/missing-any-param-doc/bad.py
+++ b/doc/data/messages/m/missing-any-param-doc/bad.py
@@ -1,3 +1,3 @@
-def puppies(head, tail): #[missing-any-param-doc]
+def puppies(head, tail): # [missing-any-param-doc]
"""Print puppy's details."""
print(head, tail)
diff --git a/doc/data/messages/m/missing-any-param-doc/good.py b/doc/data/messages/m/missing-any-param-doc/good.py
index 238ea1bce..6fa9622ee 100644
--- a/doc/data/messages/m/missing-any-param-doc/good.py
+++ b/doc/data/messages/m/missing-any-param-doc/good.py
@@ -1,7 +1,7 @@
def puppies(head: str, tail: str):
"""Print puppy's details.
- :param head: description of the head of the dog
- :param tail: description of the tail of the dog
+ :param head: description of the head of the dog
+ :param tail: description of the tail of the dog
"""
print(head, tail)
diff --git a/doc/data/messages/m/missing-class-docstring/bad.py b/doc/data/messages/m/missing-class-docstring/bad.py
index 1d0f79c75..e3e1ddbf5 100644
--- a/doc/data/messages/m/missing-class-docstring/bad.py
+++ b/doc/data/messages/m/missing-class-docstring/bad.py
@@ -1,5 +1,4 @@
class Person: # [missing-class-docstring]
-
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
diff --git a/doc/data/messages/m/missing-final-newline/good.py b/doc/data/messages/m/missing-final-newline/good.py
index fa1e5072e..02d068916 100644
--- a/doc/data/messages/m/missing-final-newline/good.py
+++ b/doc/data/messages/m/missing-final-newline/good.py
@@ -1,6 +1,6 @@
# using LF
-eat("apple", "candy") # \n
+eat("apple", "candy") # \n
print(123) # \nEOF
# using CRLF
diff --git a/doc/data/messages/m/missing-kwoa/bad.py b/doc/data/messages/m/missing-kwoa/bad.py
index 4039c8ff2..2b8deabdf 100644
--- a/doc/data/messages/m/missing-kwoa/bad.py
+++ b/doc/data/messages/m/missing-kwoa/bad.py
@@ -1,5 +1,6 @@
def target(pos, *, keyword):
return pos + keyword
+
def not_forwarding_kwargs(*args, **kwargs):
- target(*args) # [missing-kwoa]
+ target(*args) # [missing-kwoa]
diff --git a/doc/data/messages/m/missing-kwoa/good.py b/doc/data/messages/m/missing-kwoa/good.py
index abb80a118..c212deb98 100644
--- a/doc/data/messages/m/missing-kwoa/good.py
+++ b/doc/data/messages/m/missing-kwoa/good.py
@@ -1,5 +1,6 @@
def target(pos, *, keyword):
return pos + keyword
+
def not_forwarding_kwargs(*args, **kwargs):
target(*args, **kwargs)
diff --git a/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py b/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py
index 3f67322dc..e4a7172a4 100644
--- a/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py
+++ b/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py
@@ -4,5 +4,6 @@ import random
def is_it_a_good_day():
return random.choice([True, False])
+
if is_it_a_good_day: # [missing-parentheses-for-call-in-test]
print("Today is a good day!")
diff --git a/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py b/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py
index 63c8ccc89..80afd7769 100644
--- a/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py
+++ b/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py
@@ -4,5 +4,6 @@ import random
def is_it_a_good_day():
return random.choice([True, False])
+
if is_it_a_good_day():
print("Today is a good day!")
diff --git a/doc/data/messages/m/missing-raises-doc/bad.py b/doc/data/messages/m/missing-raises-doc/bad.py
index 9a59fea88..51efd3910 100644
--- a/doc/data/messages/m/missing-raises-doc/bad.py
+++ b/doc/data/messages/m/missing-raises-doc/bad.py
@@ -4,5 +4,5 @@ def integer_sum(a: int, b: int): # [missing-raises-doc]
:param b: second integer
"""
if not (isinstance(a, int) and isinstance(b, int)):
- raise ValueError('Function supports only integer parameters.')
+ raise ValueError("Function supports only integer parameters.")
return a + b
diff --git a/doc/data/messages/m/missing-raises-doc/good.py b/doc/data/messages/m/missing-raises-doc/good.py
index c274493ea..6ca44d0fd 100644
--- a/doc/data/messages/m/missing-raises-doc/good.py
+++ b/doc/data/messages/m/missing-raises-doc/good.py
@@ -5,5 +5,5 @@ def integer_sum(a: int, b: int):
:raises ValueError: One of the parameters is not an integer.
"""
if not (isinstance(a, int) and isinstance(b, int)):
- raise ValueError('Function supports only integer parameters.')
+ raise ValueError("Function supports only integer parameters.")
return a + b
diff --git a/doc/data/messages/m/mixed-line-endings/details.rst b/doc/data/messages/m/mixed-line-endings/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/m/mixed-line-endings/details.rst
+++ b/doc/data/messages/m/mixed-line-endings/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/n/named-expr-without-context/good.py b/doc/data/messages/n/named-expr-without-context/good.py
index 50f6b2621..fb088bb99 100644
--- a/doc/data/messages/n/named-expr-without-context/good.py
+++ b/doc/data/messages/n/named-expr-without-context/good.py
@@ -1,2 +1,2 @@
-if (a := 42):
- print('Success')
+if a := 42:
+ print("Success")
diff --git a/doc/data/messages/n/no-else-continue/bad.py b/doc/data/messages/n/no-else-continue/bad.py
index 5e3172947..a561f93cc 100644
--- a/doc/data/messages/n/no-else-continue/bad.py
+++ b/doc/data/messages/n/no-else-continue/bad.py
@@ -1,6 +1,6 @@
def even_number_under(n: int):
for i in range(n):
- if i%2 == 1: # [no-else-continue]
+ if i % 2 == 1: # [no-else-continue]
continue
else:
yield i
diff --git a/doc/data/messages/n/no-else-continue/good.py b/doc/data/messages/n/no-else-continue/good.py
index 8aaef7014..e73e0e21c 100644
--- a/doc/data/messages/n/no-else-continue/good.py
+++ b/doc/data/messages/n/no-else-continue/good.py
@@ -1,5 +1,5 @@
def even_number_under(n: int):
for i in range(n):
- if i%2 == 1:
+ if i % 2 == 1:
continue
yield i
diff --git a/doc/data/messages/n/no-else-raise/bad.py b/doc/data/messages/n/no-else-raise/bad.py
index d2f590ab8..c5fdf996e 100644
--- a/doc/data/messages/n/no-else-raise/bad.py
+++ b/doc/data/messages/n/no-else-raise/bad.py
@@ -1,5 +1,5 @@
def integer_sum(a: int, b: int) -> int:
- if not (isinstance(a, int) and isinstance(b, int)): # [no-else-raise]
- raise ValueError('Function supports only integer parameters.')
+ if not (isinstance(a, int) and isinstance(b, int)): # [no-else-raise]
+ raise ValueError("Function supports only integer parameters.")
else:
return a + b
diff --git a/doc/data/messages/n/no-else-raise/good.py b/doc/data/messages/n/no-else-raise/good.py
index c0d577cfa..bf2918148 100644
--- a/doc/data/messages/n/no-else-raise/good.py
+++ b/doc/data/messages/n/no-else-raise/good.py
@@ -1,4 +1,4 @@
def integer_sum(a: int, b: int) -> int:
if not (isinstance(a, int) and isinstance(b, int)):
- raise ValueError('Function supports only integer parameters.')
+ raise ValueError("Function supports only integer parameters.")
return a + b
diff --git a/doc/data/messages/n/no-self-use/bad.py b/doc/data/messages/n/no-self-use/bad.py
index 8c44a3c1e..07ab6f3ab 100644
--- a/doc/data/messages/n/no-self-use/bad.py
+++ b/doc/data/messages/n/no-self-use/bad.py
@@ -1,5 +1,4 @@
class Person:
-
def developer_greeting(self): # [no-self-use]
print("Greetings developer!")
diff --git a/doc/data/messages/n/no-value-for-parameter/bad.py b/doc/data/messages/n/no-value-for-parameter/bad.py
index cf10d9a57..31b08a16a 100644
--- a/doc/data/messages/n/no-value-for-parameter/bad.py
+++ b/doc/data/messages/n/no-value-for-parameter/bad.py
@@ -1,4 +1,5 @@
def add(x, y):
return x + y
+
add(1) # [no-value-for-parameter]
diff --git a/doc/data/messages/n/no-value-for-parameter/good.py b/doc/data/messages/n/no-value-for-parameter/good.py
index e14c45c21..068b52527 100644
--- a/doc/data/messages/n/no-value-for-parameter/good.py
+++ b/doc/data/messages/n/no-value-for-parameter/good.py
@@ -1,4 +1,5 @@
def add(x, y):
return x + y
+
add(1, 2)
diff --git a/doc/data/messages/o/overlapping-except/good.py b/doc/data/messages/o/overlapping-except/good.py
index 41a727545..0cace420e 100644
--- a/doc/data/messages/o/overlapping-except/good.py
+++ b/doc/data/messages/o/overlapping-except/good.py
@@ -7,10 +7,14 @@ def divide_x_by_y(x: float, y: float):
# FloatingPointError were already caught at this point
print(f"There was an OverflowError or a ZeroDivisionError: {e}")
+
# Or:
+
def divide_x_by_y(x: float, y: float):
try:
print(x / y)
except ArithmeticError as e:
- print(f"There was an OverflowError, a ZeroDivisionError or a FloatingPointError: {e}")
+ print(
+ f"There was an OverflowError, a ZeroDivisionError or a FloatingPointError: {e}"
+ )
diff --git a/doc/data/messages/p/positional-only-arguments-expected/bad.py b/doc/data/messages/p/positional-only-arguments-expected/bad.py
index 30720555a..75e63e572 100644
--- a/doc/data/messages/p/positional-only-arguments-expected/bad.py
+++ b/doc/data/messages/p/positional-only-arguments-expected/bad.py
@@ -2,4 +2,5 @@ def cube(n, /):
"""Takes in a number n, returns the cube of n"""
return n**3
-cube(n=2) # [positional-only-arguments-expected]
+
+cube(n=2) # [positional-only-arguments-expected]
diff --git a/doc/data/messages/p/positional-only-arguments-expected/good.py b/doc/data/messages/p/positional-only-arguments-expected/good.py
index ca734e546..77cdc80a4 100644
--- a/doc/data/messages/p/positional-only-arguments-expected/good.py
+++ b/doc/data/messages/p/positional-only-arguments-expected/good.py
@@ -2,4 +2,5 @@ def cube(n, /):
"""Takes in a number n, returns the cube of n"""
return n**3
+
cube(2)
diff --git a/doc/data/messages/r/raw-checker-failed/details.rst b/doc/data/messages/r/raw-checker-failed/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/r/raw-checker-failed/details.rst
+++ b/doc/data/messages/r/raw-checker-failed/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/r/redefined-argument-from-local/bad.py b/doc/data/messages/r/redefined-argument-from-local/bad.py
index 24d441219..733f307b3 100644
--- a/doc/data/messages/r/redefined-argument-from-local/bad.py
+++ b/doc/data/messages/r/redefined-argument-from-local/bad.py
@@ -1,3 +1,4 @@
def show(host_id=10.11):
- for host_id, host in [[12.13, 'Venus'], [14.15, 'Mars']]: # [redefined-argument-from-local]
+ # +1: [redefined-argument-from-local]
+ for host_id, host in [[12.13, "Venus"], [14.15, "Mars"]]:
print(host_id, host)
diff --git a/doc/data/messages/r/redefined-argument-from-local/good.py b/doc/data/messages/r/redefined-argument-from-local/good.py
index 330f94f45..fd7c081ac 100644
--- a/doc/data/messages/r/redefined-argument-from-local/good.py
+++ b/doc/data/messages/r/redefined-argument-from-local/good.py
@@ -1,3 +1,3 @@
def show(host_id=10.11):
- for inner_host_id, host in [[12.13, 'Venus'], [14.15, 'Mars']]:
+ for inner_host_id, host in [[12.13, "Venus"], [14.15, "Mars"]]:
print(host_id, inner_host_id, host)
diff --git a/doc/data/messages/r/relative-beyond-top-level/details.rst b/doc/data/messages/r/relative-beyond-top-level/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/r/relative-beyond-top-level/details.rst
+++ b/doc/data/messages/r/relative-beyond-top-level/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/r/return-arg-in-generator/details.rst b/doc/data/messages/r/return-arg-in-generator/details.rst
deleted file mode 100644
index ab8204529..000000000
--- a/doc/data/messages/r/return-arg-in-generator/details.rst
+++ /dev/null
@@ -1 +0,0 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/r/return-arg-in-generator/good.py b/doc/data/messages/r/return-arg-in-generator/good.py
index c40beb573..72dc95e7b 100644
--- a/doc/data/messages/r/return-arg-in-generator/good.py
+++ b/doc/data/messages/r/return-arg-in-generator/good.py
@@ -1 +1,4 @@
-# This is a placeholder for correct code for this message.
+def yield_numbers():
+ for number in range(10):
+ yield number
+ return "I am now allowed!" # This was not allowed in Python 3.3 and earlier.
diff --git a/doc/data/messages/r/return-in-init/bad.py b/doc/data/messages/r/return-in-init/bad.py
index 70fc2d0fd..044174e0a 100644
--- a/doc/data/messages/r/return-in-init/bad.py
+++ b/doc/data/messages/r/return-in-init/bad.py
@@ -1,4 +1,3 @@
class Sum:
-
def __init__(self, a, b): # [return-in-init]
return a + b
diff --git a/doc/data/messages/r/return-in-init/good.py b/doc/data/messages/r/return-in-init/good.py
index ef8e6e09b..0efe05af4 100644
--- a/doc/data/messages/r/return-in-init/good.py
+++ b/doc/data/messages/r/return-in-init/good.py
@@ -1,4 +1,3 @@
class Sum:
-
def __init__(self, a, b) -> None:
self.result = a + b
diff --git a/doc/data/messages/s/self-cls-assignment/bad.py b/doc/data/messages/s/self-cls-assignment/bad.py
index 64541405f..50fe89015 100644
--- a/doc/data/messages/s/self-cls-assignment/bad.py
+++ b/doc/data/messages/s/self-cls-assignment/bad.py
@@ -1,7 +1,7 @@
class Fruit:
@classmethod
def list_fruits(cls):
- cls = 'apple' # [self-cls-assignment]
+ cls = "apple" # [self-cls-assignment]
def print_color(self, *colors):
self = "red" # [self-cls-assignment]
diff --git a/doc/data/messages/s/self-cls-assignment/good.py b/doc/data/messages/s/self-cls-assignment/good.py
index ae8b172fa..d1960f251 100644
--- a/doc/data/messages/s/self-cls-assignment/good.py
+++ b/doc/data/messages/s/self-cls-assignment/good.py
@@ -1,7 +1,7 @@
class Fruit:
@classmethod
def list_fruits(cls):
- fruit = 'apple'
+ fruit = "apple"
print(fruit)
def print_color(self, *colors):
diff --git a/doc/data/messages/s/simplifiable-if-statement/bad.py b/doc/data/messages/s/simplifiable-if-statement/bad.py
index 0c9fb317f..1a8d6f0f7 100644
--- a/doc/data/messages/s/simplifiable-if-statement/bad.py
+++ b/doc/data/messages/s/simplifiable-if-statement/bad.py
@@ -2,7 +2,8 @@ FLYING_THINGS = ["bird", "plane", "superman", "this example"]
def is_flying_animal(an_object):
- if isinstance(an_object, Animal) and an_object in FLYING_THINGS: # [simplifiable-if-statement]
+ # +1: [simplifiable-if-statement]
+ if isinstance(an_object, Animal) and an_object in FLYING_THINGS:
is_flying = True
else:
is_flying = False
diff --git a/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py b/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py
index c0d3f7bfa..6be75e472 100644
--- a/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py
+++ b/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py
@@ -5,4 +5,4 @@ def foo():
pass
-subprocess.Popen(preexec_fn=foo) # [subprocess-popen-preexec-fn]
+subprocess.Popen(preexec_fn=foo) # [subprocess-popen-preexec-fn]
diff --git a/doc/data/messages/s/syntax-error/good.py b/doc/data/messages/s/syntax-error/good.py
index eccab8746..10a644f1b 100644
--- a/doc/data/messages/s/syntax-error/good.py
+++ b/doc/data/messages/s/syntax-error/good.py
@@ -1,5 +1 @@
-fruit_stock = {
- 'apple': 42,
- 'orange': 21,
- 'banana': 12
-}
+fruit_stock = {"apple": 42, "orange": 21, "banana": 12}
diff --git a/doc/data/messages/t/too-few-public-methods/good.py b/doc/data/messages/t/too-few-public-methods/good.py
index ca4b5b6fb..b0de1ef75 100644
--- a/doc/data/messages/t/too-few-public-methods/good.py
+++ b/doc/data/messages/t/too-few-public-methods/good.py
@@ -12,17 +12,22 @@ class Worm:
def wiggle(self):
print(f"{self.name} wiggle around wormily.")
+
# or
+
@dataclasses.dataclass
class Worm:
- name:str
+ name: str
fruit_of_residence: Fruit
+
def bore(worm: Worm):
print(f"{worm.name} is boring into {worm.fruit_of_residence}")
+
# or
+
def bore(fruit: Fruit, worm_name: str):
print(f"{worm_name} is boring into {fruit}")
diff --git a/doc/data/messages/t/too-many-boolean-expressions/good.py b/doc/data/messages/t/too-many-boolean-expressions/good.py
index 1da025460..8405d4f29 100644
--- a/doc/data/messages/t/too-many-boolean-expressions/good.py
+++ b/doc/data/messages/t/too-many-boolean-expressions/good.py
@@ -1,3 +1,3 @@
def can_be_divided_by_two_and_are_not_zero(x, y, z):
- if all(i and i%2==0 for i in [x, y, z]):
+ if all(i and i % 2 == 0 for i in [x, y, z]):
pass
diff --git a/doc/data/messages/t/too-many-locals/bad.py b/doc/data/messages/t/too-many-locals/bad.py
index dae054ed8..d2a762b49 100644
--- a/doc/data/messages/t/too-many-locals/bad.py
+++ b/doc/data/messages/t/too-many-locals/bad.py
@@ -20,7 +20,9 @@ def handle_sweets(infos): # [too-many-locals]
# Calculate remaining money
remaining_money = money - cost_of_children
# Calculate time it took
- time_it_took_assuming_parallel_eating = time_to_eat_sweet * number_of_sweet_per_child
+ time_it_took_assuming_parallel_eating = (
+ time_to_eat_sweet * number_of_sweet_per_child
+ )
print(
f"{children} ate {cost_of_children}¤ of sweets in {time_it_took_assuming_parallel_eating}, "
f"you still have {remaining_money}"
diff --git a/doc/data/messages/t/too-many-return-statements/bad.py b/doc/data/messages/t/too-many-return-statements/bad.py
index e421d29a7..827177f1b 100644
--- a/doc/data/messages/t/too-many-return-statements/bad.py
+++ b/doc/data/messages/t/too-many-return-statements/bad.py
@@ -1,16 +1,16 @@
def to_string(x): # [too-many-return-statements]
# max of 6 by default, can be configured
if x == 1:
- return 'This is one.'
+ return "This is one."
if x == 2:
- return 'This is two.'
+ return "This is two."
if x == 3:
- return 'This is three.'
+ return "This is three."
if x == 4:
- return 'This is four.'
+ return "This is four."
if x == 5:
- return 'This is five.'
+ return "This is five."
if x == 6:
- return 'This is six.'
+ return "This is six."
if x == 7:
- return 'This is seven.'
+ return "This is seven."
diff --git a/doc/data/messages/t/too-many-return-statements/good.py b/doc/data/messages/t/too-many-return-statements/good.py
index 0c4032f53..80ae2ac19 100644
--- a/doc/data/messages/t/too-many-return-statements/good.py
+++ b/doc/data/messages/t/too-many-return-statements/good.py
@@ -1,13 +1,13 @@
NUMBERS_TO_STRINGS = {
- 1: 'one',
- 2: 'two',
- 3: 'three',
- 4: 'four',
- 5: 'five',
- 6: 'six',
- 7: 'seven'
+ 1: "one",
+ 2: "two",
+ 3: "three",
+ 4: "four",
+ 5: "five",
+ 6: "six",
+ 7: "seven",
}
def to_string(x):
- return f'This is {NUMBERS_TO_STRINGS.get(x)}.'
+ return f"This is {NUMBERS_TO_STRINGS.get(x)}."
diff --git a/doc/data/messages/t/truncated-format-string/bad.py b/doc/data/messages/t/truncated-format-string/bad.py
index 961582bff..a44bca2f3 100644
--- a/doc/data/messages/t/truncated-format-string/bad.py
+++ b/doc/data/messages/t/truncated-format-string/bad.py
@@ -1,3 +1,3 @@
PARG_2 = 1
-print("strange format %2" % PARG_2) # [truncated-format-string]
+print("strange format %2" % PARG_2) # [truncated-format-string]
diff --git a/doc/data/messages/u/undefined-all-variable/bad.py b/doc/data/messages/u/undefined-all-variable/bad.py
index dd7bef8cb..3168018d5 100644
--- a/doc/data/messages/u/undefined-all-variable/bad.py
+++ b/doc/data/messages/u/undefined-all-variable/bad.py
@@ -1,4 +1,5 @@
__all__ = ["get_fruit_colour"] # [undefined-all-variable]
+
def get_fruit_color():
pass
diff --git a/doc/data/messages/u/undefined-all-variable/good.py b/doc/data/messages/u/undefined-all-variable/good.py
index 3fb85e824..950222b56 100644
--- a/doc/data/messages/u/undefined-all-variable/good.py
+++ b/doc/data/messages/u/undefined-all-variable/good.py
@@ -1,4 +1,5 @@
__all__ = ["get_fruit_color"]
+
def get_fruit_color():
pass
diff --git a/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py b/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py
index 1057f8be6..280fb3b75 100644
--- a/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py
+++ b/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py
@@ -1 +1 @@
-y = (lambda x: x**2 + 2*x + 1)(a) # [unnecessary-direct-lambda-call]
+y = (lambda x: x**2 + 2 * x + 1)(a) # [unnecessary-direct-lambda-call]
diff --git a/doc/data/messages/u/unnecessary-direct-lambda-call/good.py b/doc/data/messages/u/unnecessary-direct-lambda-call/good.py
index 1fe996f69..5870a4a23 100644
--- a/doc/data/messages/u/unnecessary-direct-lambda-call/good.py
+++ b/doc/data/messages/u/unnecessary-direct-lambda-call/good.py
@@ -1 +1 @@
-y = a**2 + 2*a + 1
+y = a**2 + 2 * a + 1
diff --git a/doc/data/messages/u/unnecessary-dunder-call/bad.py b/doc/data/messages/u/unnecessary-dunder-call/bad.py
index 66149d772..49405d47b 100644
--- a/doc/data/messages/u/unnecessary-dunder-call/bad.py
+++ b/doc/data/messages/u/unnecessary-dunder-call/bad.py
@@ -1,4 +1,4 @@
-three = 3.0.__str__() # [unnecessary-dunder-call]
+three = (3.0).__str__() # [unnecessary-dunder-call]
twelve = "1".__add__("2") # [unnecessary-dunder-call]
diff --git a/doc/data/messages/u/unnecessary-lambda-assignment/bad.py b/doc/data/messages/u/unnecessary-lambda-assignment/bad.py
index b31553e4a..87e7ccdba 100644
--- a/doc/data/messages/u/unnecessary-lambda-assignment/bad.py
+++ b/doc/data/messages/u/unnecessary-lambda-assignment/bad.py
@@ -1 +1 @@
-foo = lambda x: x**2 + 2*x + 1 # [unnecessary-lambda-assignment]
+foo = lambda x: x**2 + 2 * x + 1 # [unnecessary-lambda-assignment]
diff --git a/doc/data/messages/u/unnecessary-lambda-assignment/good.py b/doc/data/messages/u/unnecessary-lambda-assignment/good.py
index 19c0a07d5..5c7da57a0 100644
--- a/doc/data/messages/u/unnecessary-lambda-assignment/good.py
+++ b/doc/data/messages/u/unnecessary-lambda-assignment/good.py
@@ -1,2 +1,2 @@
def foo(x):
- return x**2 + 2*x + 1
+ return x**2 + 2 * x + 1
diff --git a/doc/data/messages/u/unnecessary-list-index-lookup/bad.py b/doc/data/messages/u/unnecessary-list-index-lookup/bad.py
index d312d36a0..b671b3add 100644
--- a/doc/data/messages/u/unnecessary-list-index-lookup/bad.py
+++ b/doc/data/messages/u/unnecessary-list-index-lookup/bad.py
@@ -1,4 +1,4 @@
-letters = ['a', 'b', 'c']
+letters = ["a", "b", "c"]
for index, letter in enumerate(letters):
print(letters[index]) # [unnecessary-list-index-lookup]
diff --git a/doc/data/messages/u/unnecessary-list-index-lookup/good.py b/doc/data/messages/u/unnecessary-list-index-lookup/good.py
index 5d3370c0e..2d1a3425c 100644
--- a/doc/data/messages/u/unnecessary-list-index-lookup/good.py
+++ b/doc/data/messages/u/unnecessary-list-index-lookup/good.py
@@ -1,4 +1,4 @@
-letters = ['a', 'b', 'c']
+letters = ["a", "b", "c"]
for index, letter in enumerate(letters):
print(letter)
diff --git a/doc/data/messages/u/unnecessary-pass/bad.py b/doc/data/messages/u/unnecessary-pass/bad.py
index 32eee7f94..c22786f63 100644
--- a/doc/data/messages/u/unnecessary-pass/bad.py
+++ b/doc/data/messages/u/unnecessary-pass/bad.py
@@ -1,3 +1,4 @@
class Foo:
"""Foo docstring."""
+
pass # [unnecessary-pass]
diff --git a/doc/data/messages/u/unrecognized-option/details.rst b/doc/data/messages/u/unrecognized-option/details.rst
index ab8204529..c1e9b976a 100644
--- a/doc/data/messages/u/unrecognized-option/details.rst
+++ b/doc/data/messages/u/unrecognized-option/details.rst
@@ -1 +1 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ !
diff --git a/doc/data/messages/u/unsupported-binary-operation/good.py b/doc/data/messages/u/unsupported-binary-operation/good.py
index 8dc2893c3..6a6be9a72 100644
--- a/doc/data/messages/u/unsupported-binary-operation/good.py
+++ b/doc/data/messages/u/unsupported-binary-operation/good.py
@@ -1,2 +1,2 @@
masked = 0b111111 & 0b001100
-result = 0xaeff | 0x0b99
+result = 0xAEFF | 0x0B99
diff --git a/doc/data/messages/u/unsupported-membership-test/good.py b/doc/data/messages/u/unsupported-membership-test/good.py
index 96b96d4d5..a5af58d5d 100644
--- a/doc/data/messages/u/unsupported-membership-test/good.py
+++ b/doc/data/messages/u/unsupported-membership-test/good.py
@@ -1,5 +1,6 @@
class Fruit:
FRUITS = ["apple", "orange"]
+
def __contains__(self, name):
return name in self.FRUITS
diff --git a/doc/data/messages/u/unused-format-string-key/bad.py b/doc/data/messages/u/unused-format-string-key/bad.py
index b4c518fc3..7a326da28 100644
--- a/doc/data/messages/u/unused-format-string-key/bad.py
+++ b/doc/data/messages/u/unused-format-string-key/bad.py
@@ -1,2 +1,5 @@
-"The quick %(color)s fox jumps over the lazy dog." % {"color": "brown", "action": "hops"}
-# -1: [unused-format-string-key]
+"The quick %(color)s fox jumps over the lazy dog." % {
+ "color": "brown",
+ "action": "hops",
+}
+# -4: [unused-format-string-key]
diff --git a/doc/data/messages/u/unused-format-string-key/good.py b/doc/data/messages/u/unused-format-string-key/good.py
index 5e45475fd..9347a3d8f 100644
--- a/doc/data/messages/u/unused-format-string-key/good.py
+++ b/doc/data/messages/u/unused-format-string-key/good.py
@@ -1 +1,4 @@
-"The quick %(color)s fox %(action)s over the lazy dog." % {"color": "brown", "action": "hops"}
+"The quick %(color)s fox %(action)s over the lazy dog." % {
+ "color": "brown",
+ "action": "hops",
+}
diff --git a/doc/data/messages/u/unused-wildcard-import/bad.py b/doc/data/messages/u/unused-wildcard-import/bad.py
index 8d4858161..74e052c84 100644
--- a/doc/data/messages/u/unused-wildcard-import/bad.py
+++ b/doc/data/messages/u/unused-wildcard-import/bad.py
@@ -1,4 +1,5 @@
from abc import * # [unused-wildcard-import]
-class Animal(ABC): ...
+class Animal(ABC):
+ ...
diff --git a/doc/data/messages/u/unused-wildcard-import/good.py b/doc/data/messages/u/unused-wildcard-import/good.py
index 961af9915..46fab6d4c 100644
--- a/doc/data/messages/u/unused-wildcard-import/good.py
+++ b/doc/data/messages/u/unused-wildcard-import/good.py
@@ -1,4 +1,5 @@
from abc import ABC
-class Animal(ABC): ...
+class Animal(ABC):
+ ...
diff --git a/doc/data/messages/u/use-a-generator/related.rst b/doc/data/messages/u/use-a-generator/related.rst
index 5d4660bec..1ec9e139e 100644
--- a/doc/data/messages/u/use-a-generator/related.rst
+++ b/doc/data/messages/u/use-a-generator/related.rst
@@ -1,2 +1,2 @@
- `PEP 289 – Generator Expressions <https://peps.python.org/pep-0289/>`_
-- `Benchmark and discussion during initial implementation <https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109>`_
+- `Benchmark and discussion during initial implementation <https://github.com/pylint-dev/pylint/pull/3309#discussion_r576683109>`_
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py
new file mode 100644
index 000000000..119fd8b43
--- /dev/null
+++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py
@@ -0,0 +1,6 @@
+def important_string_manipulation(x: str, y: str) -> None:
+ if x == "": # [use-implicit-booleaness-not-comparison-to-string]
+ print("x is an empty string")
+
+ if y != "": # [use-implicit-booleaness-not-comparison-to-string]
+ print("y is not an empty string")
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py
new file mode 100644
index 000000000..21f222e9b
--- /dev/null
+++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py
@@ -0,0 +1,6 @@
+def important_string_manipulation(x: str, y: str) -> None:
+ if not x:
+ print("x is an empty string")
+
+ if y:
+ print("y is not an empty string")
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc
new file mode 100644
index 000000000..aa53d9346
--- /dev/null
+++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc
@@ -0,0 +1,2 @@
+[main]
+enable=use-implicit-booleaness-not-comparison-to-string
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py
new file mode 100644
index 000000000..2f93afd31
--- /dev/null
+++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py
@@ -0,0 +1,6 @@
+def important_math(x: int, y: int) -> None:
+ if x == 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ print("x is equal to zero")
+
+ if y != 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ print("y is not equal to zero")
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py
new file mode 100644
index 000000000..feae7fe30
--- /dev/null
+++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py
@@ -0,0 +1,6 @@
+def important_math(x: int, y: int) -> None:
+ if not x:
+ print("x is equal to zero")
+
+ if y:
+ print("y is not equal to zero")
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc
new file mode 100644
index 000000000..43d8bd751
--- /dev/null
+++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc
@@ -0,0 +1,2 @@
+[main]
+enable=use-implicit-booleaness-not-comparison-to-zero
diff --git a/doc/data/messages/u/useless-option-value/bad.py b/doc/data/messages/u/useless-option-value/bad.py
index 291528732..e284b3fea 100644
--- a/doc/data/messages/u/useless-option-value/bad.py
+++ b/doc/data/messages/u/useless-option-value/bad.py
@@ -1,3 +1,3 @@
-"""'bad-continuation' was removed from pylint in https://github.com/PyCQA/pylint/pull/3571"""
+"""'bad-continuation' was removed from pylint in https://github.com/pylint-dev/pylint/pull/3571"""
# pylint: disable=bad-continuation # [useless-option-value]
diff --git a/doc/data/messages/u/useless-option-value/good.py b/doc/data/messages/u/useless-option-value/good.py
index eb6b246c6..619b5b6f6 100644
--- a/doc/data/messages/u/useless-option-value/good.py
+++ b/doc/data/messages/u/useless-option-value/good.py
@@ -1 +1 @@
-"""'bad-continuation' was removed from pylint in https://github.com/PyCQA/pylint/pull/3571"""
+"""'bad-continuation' was removed from pylint in https://github.com/pylint-dev/pylint/pull/3571"""
diff --git a/doc/data/messages/u/useless-parent-delegation/bad.py b/doc/data/messages/u/useless-parent-delegation/bad.py
index 9010c9ea9..5132e358c 100644
--- a/doc/data/messages/u/useless-parent-delegation/bad.py
+++ b/doc/data/messages/u/useless-parent-delegation/bad.py
@@ -1,10 +1,8 @@
class Animal:
-
def eat(self, food):
print(f"Eating {food}")
class Human(Animal):
-
def eat(self, food): # [useless-parent-delegation]
super(Human, self).eat(food)
diff --git a/doc/data/messages/u/useless-parent-delegation/good.py b/doc/data/messages/u/useless-parent-delegation/good.py
index d463b4564..890a43116 100644
--- a/doc/data/messages/u/useless-parent-delegation/good.py
+++ b/doc/data/messages/u/useless-parent-delegation/good.py
@@ -1,5 +1,4 @@
class Animal:
-
def eat(self, food):
print(f"Eating {food}")
diff --git a/doc/data/messages/u/using-constant-test/bad.py b/doc/data/messages/u/using-constant-test/bad.py
index aee0b407c..a995d7804 100644
--- a/doc/data/messages/u/using-constant-test/bad.py
+++ b/doc/data/messages/u/using-constant-test/bad.py
@@ -1,4 +1,4 @@
if 0: # [using-constant-test]
- print('This code is never executed.')
+ print("This code is never executed.")
if 1: # [using-constant-test]
- print('This code is always executed.')
+ print("This code is always executed.")
diff --git a/doc/data/messages/u/using-constant-test/good.py b/doc/data/messages/u/using-constant-test/good.py
index 151e1d518..c8441a924 100644
--- a/doc/data/messages/u/using-constant-test/good.py
+++ b/doc/data/messages/u/using-constant-test/good.py
@@ -1 +1 @@
-print('This code is always executed.')
+print("This code is always executed.")
diff --git a/doc/data/messages/w/while-used/bad.py b/doc/data/messages/w/while-used/bad.py
index 8839b1a83..44e8df854 100644
--- a/doc/data/messages/w/while-used/bad.py
+++ b/doc/data/messages/w/while-used/bad.py
@@ -4,9 +4,9 @@ import requests
def fetch_data():
i = 1
while i < 6: # [while-used]
- print(f'Attempt {i}...')
+ print(f"Attempt {i}...")
try:
- return requests.get('https://example.com/data')
+ return requests.get("https://example.com/data")
except requests.exceptions.RequestException:
pass
i += 1
diff --git a/doc/data/messages/w/while-used/good.py b/doc/data/messages/w/while-used/good.py
index 3f2be4860..762d73840 100644
--- a/doc/data/messages/w/while-used/good.py
+++ b/doc/data/messages/w/while-used/good.py
@@ -3,8 +3,8 @@ import requests
def fetch_data():
for i in range(1, 6):
- print(f'Attempt {i}...')
+ print(f"Attempt {i}...")
try:
- return requests.get('https://example.com/data')
+ return requests.get("https://example.com/data")
except requests.exceptions.RequestException:
pass
diff --git a/doc/data/messages/w/wrong-exception-operation/bad.py b/doc/data/messages/w/wrong-exception-operation/bad.py
index 20fcc2aab..e4aff5d8b 100644
--- a/doc/data/messages/w/wrong-exception-operation/bad.py
+++ b/doc/data/messages/w/wrong-exception-operation/bad.py
@@ -1,4 +1,4 @@
try:
- 1/0
-except (ValueError + TypeError): # [wrong-exception-operation]
+ 1 / 0
+except ValueError + TypeError: # [wrong-exception-operation]
pass
diff --git a/doc/data/messages/w/wrong-exception-operation/good.py b/doc/data/messages/w/wrong-exception-operation/good.py
index 4171dbb60..b5170dd0e 100644
--- a/doc/data/messages/w/wrong-exception-operation/good.py
+++ b/doc/data/messages/w/wrong-exception-operation/good.py
@@ -1,4 +1,4 @@
try:
- 1/0
+ 1 / 0
except (ValueError, TypeError):
pass
diff --git a/doc/data/messages/w/wrong-import-position/bad.py b/doc/data/messages/w/wrong-import-position/bad.py
index f5162adeb..38e442e97 100644
--- a/doc/data/messages/w/wrong-import-position/bad.py
+++ b/doc/data/messages/w/wrong-import-position/bad.py
@@ -1,7 +1,7 @@
import os
-home = os.environ['HOME']
+home = os.environ["HOME"]
import sys # [wrong-import-position]
-print(f'Home directory is {home}', file=sys.stderr)
+print(f"Home directory is {home}", file=sys.stderr)
diff --git a/doc/data/messages/w/wrong-import-position/good.py b/doc/data/messages/w/wrong-import-position/good.py
index 413e1944e..37330eb23 100644
--- a/doc/data/messages/w/wrong-import-position/good.py
+++ b/doc/data/messages/w/wrong-import-position/good.py
@@ -1,5 +1,5 @@
import os
import sys
-home = os.environ['HOME']
-print(f'Home directory is {home}', file=sys.stderr)
+home = os.environ["HOME"]
+print(f"Home directory is {home}", file=sys.stderr)
diff --git a/doc/data/ruff.toml b/doc/data/ruff.toml
index da929be3b..773f7a313 100644
--- a/doc/data/ruff.toml
+++ b/doc/data/ruff.toml
@@ -2,4 +2,12 @@ ignore = []
# Reading ease is drastically reduced on read the doc after 103 chars
# (Because of horizontal scrolling)
line-length = 103
-select = ["E501"]
+select = ["E501", "I"]
+
+
+[per-file-ignores]
+"doc/data/messages/r/reimported/bad.py" = ["I"]
+"doc/data/messages/w/wrong-import-order/bad.py" = ["I"]
+"doc/data/messages/u/ungrouped-imports/bad.py" = ["I"]
+"doc/data/messages/m/misplaced-future/bad.py" = ["I"]
+"doc/data/messages/m/multiple-imports/bad.py" = ["I"]
diff --git a/doc/development_guide/api/epylint.rst b/doc/development_guide/api/epylint.rst
deleted file mode 100644
index 8359587ed..000000000
--- a/doc/development_guide/api/epylint.rst
+++ /dev/null
@@ -1,22 +0,0 @@
-=======
-epylint
-=======
-
-To silently run epylint on a ``module_name.py`` module, and get its standard output and error:
-
-.. sourcecode:: python
-
- from pylint import epylint as lint
-
- (pylint_stdout, pylint_stderr) = lint.py_run('module_name.py', return_std=True)
-
-It is also possible to include additional Pylint options in the first argument to ``py_run``:
-
-.. sourcecode:: python
-
- from pylint import epylint as lint
-
- (pylint_stdout, pylint_stderr) = lint.py_run('module_name.py --disable C0114', return_std=True)
-
-The options ``--msg-template="{path}:{line}: {category} ({msg_id}, {symbol}, {obj}) {msg}"`` and
-``--reports=n`` are set implicitly inside the ``epylint`` module.
diff --git a/doc/development_guide/api/index.rst b/doc/development_guide/api/index.rst
index 00e6e1a9f..ac4e96900 100644
--- a/doc/development_guide/api/index.rst
+++ b/doc/development_guide/api/index.rst
@@ -2,7 +2,7 @@
API
###
-You can call ``Pylint``, ``epylint``, ``symilar`` and ``pyreverse`` from another
+You can call ``Pylint``, ``symilar`` and ``pyreverse`` from another
Python program thanks to their APIs:
.. sourcecode:: python
@@ -19,4 +19,3 @@ Python program thanks to their APIs:
:hidden:
pylint
- epylint
diff --git a/doc/development_guide/contributor_guide/contribute.rst b/doc/development_guide/contributor_guide/contribute.rst
index 2ebc895b0..dee22aa69 100644
--- a/doc/development_guide/contributor_guide/contribute.rst
+++ b/doc/development_guide/contributor_guide/contribute.rst
@@ -24,18 +24,18 @@ Here's a list of links you can check depending on what you want to do:
- `Reviewing pull requests`_
.. _`Asking a question on discord`: https://discord.com/invite/qYxpadCgkx
-.. _`on github`: https://github.com/PyCQA/pylint/issues/new/choose
-.. _`Opening an issue`: https://github.com/PyCQA/pylint/issues/new?assignees=&labels=Needs+triage+%3Ainbox_tray%3A&template=BUG-REPORT.yml
-.. _`Making the documentation better`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Documentation+%3Agreen_book%3A%22
-.. _`Making the error message better`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+project%3Apycqa%2Fpylint%2F4+
-.. _`Reproducing bugs and confirming that issues are valid`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+reproduction+%3Amag%3A%22%2C%22Cannot+reproduce+%F0%9F%A4%B7%22
-.. _`Investigating or debugging complicated issues`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+investigation+%F0%9F%94%AC%22
-.. _`Designing or specifying a solution`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+design+proposal+%3Alock%3A%22%2C%22Needs+specification+%3Aclosed_lock_with_key%3A%22
-.. _`Giving your opinion on ongoing discussion`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+decision+%3Alock%3A%22
-.. _`Fixing bugs and crashes`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Bug+%3Abeetle%3A%22%2C%22Crash+%F0%9F%92%A5%22
-.. _`Fixing false positives`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Positive+%F0%9F%A6%9F%22
-.. _`Creating new features or fixing false negatives`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Negative+%F0%9F%A6%8B%22%2C%22Enhancement+%E2%9C%A8%22
-.. _`Reviewing pull requests`: https://github.com/PyCQA/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Needs+review+%F0%9F%94%8D%22
+.. _`on github`: https://github.com/pylint-dev/pylint/issues/new/choose
+.. _`Opening an issue`: https://github.com/pylint-dev/pylint/issues/new?assignees=&labels=Needs+triage+%3Ainbox_tray%3A&template=BUG-REPORT.yml
+.. _`Making the documentation better`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Documentation+%3Agreen_book%3A%22
+.. _`Making the error message better`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen%20is%3Aissue%20project%3Apylint-dev%2Fpylint%2F4
+.. _`Reproducing bugs and confirming that issues are valid`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+reproduction+%3Amag%3A%22%2C%22Cannot+reproduce+%F0%9F%A4%B7%22
+.. _`Investigating or debugging complicated issues`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+investigation+%F0%9F%94%AC%22
+.. _`Designing or specifying a solution`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+design+proposal+%3Alock%3A%22%2C%22Needs+specification+%3Aclosed_lock_with_key%3A%22
+.. _`Giving your opinion on ongoing discussion`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+decision+%3Alock%3A%22
+.. _`Fixing bugs and crashes`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Bug+%3Abeetle%3A%22%2C%22Crash+%F0%9F%92%A5%22
+.. _`Fixing false positives`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Positive+%F0%9F%A6%9F%22
+.. _`Creating new features or fixing false negatives`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Negative+%F0%9F%A6%8B%22%2C%22Enhancement+%E2%9C%A8%22
+.. _`Reviewing pull requests`: https://github.com/pylint-dev/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Needs+review+%F0%9F%94%8D%22
If you are a pylint maintainer there's also:
@@ -45,10 +45,10 @@ If you are a pylint maintainer there's also:
- `Preparing the next patch release`_
- `Checking stale pull requests status`_
-.. _`Triaging issues`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+triage+%3Ainbox_tray%3A%22
-.. _`Labeling issues that do not have an actionable label yet`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+-label%3A%22Needs+astroid+Brain+%F0%9F%A7%A0%22+-label%3A%22Needs+astroid+update%22+-label%3A%22Needs+backport%22+-label%3A%22Needs+decision+%3Alock%3A%22+-label%3A%22Needs+investigation+%F0%9F%94%AC%22+-label%3A%22Needs+PR%22+-label%3A%22Needs+reproduction+%3Amag%3A%22+-label%3A%22Needs+review+%F0%9F%94%8D%22+-label%3A%22Needs+triage+%3Ainbox_tray%3A%22+-label%3A%22Waiting+on+author%22+-label%3A%22Work+in+progress%22+-label%3AMaintenance+sort%3Aupdated-desc+-label%3A%22Needs+specification+%3Aclosed_lock_with_key%3A%22+-label%3A%22Needs+design+proposal+%3Alock%3A%22
-.. _`Preparing the next patch release`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+backport%22
-.. _`Checking stale pull requests status`: https://github.com/PyCQA/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Work+in+progress%22%2C%22Needs+astroid+update%22%2C%22Waiting+on+author%22
+.. _`Triaging issues`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+triage+%3Ainbox_tray%3A%22
+.. _`Labeling issues that do not have an actionable label yet`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+-label%3A%22Needs+astroid+Brain+%F0%9F%A7%A0%22+-label%3A%22Needs+astroid+update%22+-label%3A%22Needs+backport%22+-label%3A%22Needs+decision+%3Alock%3A%22+-label%3A%22Needs+investigation+%F0%9F%94%AC%22+-label%3A%22Needs+PR%22+-label%3A%22Needs+reproduction+%3Amag%3A%22+-label%3A%22Needs+review+%F0%9F%94%8D%22+-label%3A%22Needs+triage+%3Ainbox_tray%3A%22+-label%3A%22Waiting+on+author%22+-label%3A%22Work+in+progress%22+-label%3AMaintenance+sort%3Aupdated-desc+-label%3A%22Needs+specification+%3Aclosed_lock_with_key%3A%22+-label%3A%22Needs+design+proposal+%3Alock%3A%22
+.. _`Preparing the next patch release`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+backport%22
+.. _`Checking stale pull requests status`: https://github.com/pylint-dev/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Work+in+progress%22%2C%22Needs+astroid+update%22%2C%22Waiting+on+author%22
Creating a pull request
@@ -100,7 +100,7 @@ your patch gets accepted:
.. _pytest: https://docs.pytest.org/en/latest/
.. _black: https://github.com/psf/black
.. _isort: https://github.com/PyCQA/isort
-.. _astroid: https://github.com/pycqa/astroid
+.. _astroid: https://github.com/pylint-dev/astroid
Tips for Getting Started with Pylint Development
diff --git a/doc/development_guide/contributor_guide/release.md b/doc/development_guide/contributor_guide/release.md
index a076838fd..e1635345b 100644
--- a/doc/development_guide/contributor_guide/release.md
+++ b/doc/development_guide/contributor_guide/release.md
@@ -39,8 +39,16 @@ branch
- Push the tag.
- Release the version on GitHub with the same name as the tag and copy and paste the
appropriate changelog in the description. This triggers the PyPI release.
-- Delete the `maintenance/X.Y-1.x` branch. (For example: `maintenance/2.3.x`)
- Create a `maintenance/X.Y.x` (For example: `maintenance/2.4.x` from the `v2.4.0` tag.)
+- Upgrade the pattern for the protected branches in the settings under `Branches` /
+ `Branch protection rules`. (For example: `maintenance/2.4*` instead of
+ `maintenance/2.3*`.). There's a lot of configuration done in these settings, do NOT
+ recreate it from scratch.
+- Delete the `maintenance/X.Y-1.x` branch. (For example: `maintenance/2.3.x`)
+- Select all the issues labelled `backport maintenance/X.Y-1.x` and label them
+ `backported`, then rename the `backport maintenance/X.Y-1.x` label to
+ `backport maintenance/X.Y.x` (for example rename `backport maintenance/2.3.x` to
+ `backport maintenance/2.4.x`)
- Close the current milestone and create the new ones (For example: close `2.4.0`,
create `2.4.1` and `2.6.0`)
- Hide and deactivate all the patch releases for the previous minor release on
diff --git a/doc/development_guide/contributor_guide/tests/install.rst b/doc/development_guide/contributor_guide/tests/install.rst
index c150d0b91..24783ea2c 100644
--- a/doc/development_guide/contributor_guide/tests/install.rst
+++ b/doc/development_guide/contributor_guide/tests/install.rst
@@ -10,7 +10,7 @@ Pylint is developed using the git_ distributed version control system.
You can clone Pylint using ::
- git clone https://github.com/PyCQA/pylint
+ git clone https://github.com/pylint-dev/pylint
Before you start testing your code, you need to install your source-code package locally.
Suppose you just cloned pylint with the previous ``git clone`` command. To set up your
@@ -34,7 +34,7 @@ If you're testing new changes in astroid you need to also clone astroid_ and ins
with an editable installation alongside pylint as follows::
# Suppose you're in the pylint directory
- git clone https://github.com/PyCQA/astroid.git
+ git clone https://github.com/pylint-dev/astroid.git
python3 -m pip install -e astroid/
You're now using the local astroid in pylint and can control the version with git for example::
@@ -43,5 +43,5 @@ You're now using the local astroid in pylint and can control the version with gi
git switch my-astroid-dev-branch
.. _pytest-cov: https://pypi.org/project/pytest-cov/
-.. _astroid: https://github.com/pycqa/astroid
+.. _astroid: https://github.com/pylint-dev/astroid
.. _git: https://git-scm.com/
diff --git a/doc/development_guide/contributor_guide/tests/launching_test.rst b/doc/development_guide/contributor_guide/tests/launching_test.rst
index 02114f01f..78f42e144 100644
--- a/doc/development_guide/contributor_guide/tests/launching_test.rst
+++ b/doc/development_guide/contributor_guide/tests/launching_test.rst
@@ -7,7 +7,7 @@ pytest
Since we use pytest_ to run the tests, you can also use it on its own.
We do recommend using the tox_ command though::
- pytest pylint -k test_functional
+ pytest tests/ -k test_functional
You can use pytest_ directly. If you want to run tests on a specific portion of the
code with pytest_ and your local python version::
@@ -85,4 +85,4 @@ You can find the latest list of repositories and any relevant code for these tes
directory.
.. _pytest-cov: https://pypi.org/project/pytest-cov/
-.. _astroid: https://github.com/pycqa/astroid
+.. _astroid: https://github.com/pylint-dev/astroid
diff --git a/doc/development_guide/contributor_guide/tests/writing_test.rst b/doc/development_guide/contributor_guide/tests/writing_test.rst
index c616d172b..9ce9ca1f0 100644
--- a/doc/development_guide/contributor_guide/tests/writing_test.rst
+++ b/doc/development_guide/contributor_guide/tests/writing_test.rst
@@ -137,4 +137,4 @@ module name should be ``{abspath}`` and the file name ``{relpath}``.
.. _tox: https://tox.wiki/en/latest/
.. _pytest: https://docs.pytest.org/en/latest/
.. _pytest-cov: https://pypi.org/project/pytest-cov/
-.. _astroid: https://github.com/pycqa/astroid
+.. _astroid: https://github.com/pylint-dev/astroid
diff --git a/doc/development_guide/how_tos/custom_checkers.rst b/doc/development_guide/how_tos/custom_checkers.rst
index c7b1b64f8..6ab9a9e35 100644
--- a/doc/development_guide/how_tos/custom_checkers.rst
+++ b/doc/development_guide/how_tos/custom_checkers.rst
@@ -3,11 +3,11 @@
How to Write a Checker
======================
You can find some simple examples in the distribution
-(`custom.py <https://github.com/PyCQA/pylint/blob/main/examples/custom.py>`_
+(`custom.py <https://github.com/pylint-dev/pylint/blob/main/examples/custom.py>`_
,
-`custom_raw.py <https://github.com/PyCQA/pylint/blob/main/examples/custom_raw.py>`_
+`custom_raw.py <https://github.com/pylint-dev/pylint/blob/main/examples/custom_raw.py>`_
and
-`deprecation_checker.py <https://github.com/PyCQA/pylint/blob/main/examples/deprecation_checker.py>`_).
+`deprecation_checker.py <https://github.com/pylint-dev/pylint/blob/main/examples/deprecation_checker.py>`_).
.. TODO Create custom_token.py
diff --git a/doc/development_guide/how_tos/transform_plugins.rst b/doc/development_guide/how_tos/transform_plugins.rst
index 031faa0f1..e1f7e9e64 100644
--- a/doc/development_guide/how_tos/transform_plugins.rst
+++ b/doc/development_guide/how_tos/transform_plugins.rst
@@ -114,4 +114,4 @@ an example, any code transformation can be done by plugins.
See `astroid/brain`_ for real life examples of transform plugins.
.. _`warnings.py`: https://hg.python.org/cpython/file/2.7/Lib/warnings.py
-.. _`astroid/brain`: https://github.com/PyCQA/astroid/tree/main/astroid/brain
+.. _`astroid/brain`: https://github.com/pylint-dev/astroid/tree/main/astroid/brain
diff --git a/doc/exts/pylint_extensions.py b/doc/exts/pylint_extensions.py
index 406d2d39d..cadcbdcba 100755
--- a/doc/exts/pylint_extensions.py
+++ b/doc/exts/pylint_extensions.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Script used to generate the extensions file before building the actual documentation."""
@@ -11,8 +11,7 @@ from __future__ import annotations
import os
import re
import sys
-import warnings
-from typing import Any
+from typing import Any, TypedDict
import sphinx
from sphinx.application import Sphinx
@@ -23,11 +22,6 @@ from pylint.lint import PyLinter
from pylint.typing import MessageDefinitionTuple, OptionDict, ReportsCallable
from pylint.utils import get_rst_title
-if sys.version_info >= (3, 8):
- from typing import TypedDict
-else:
- from typing_extensions import TypedDict
-
class _CheckerInfo(TypedDict):
"""Represents data about a checker."""
@@ -134,24 +128,20 @@ def get_plugins_info(
doc = f.read()
try:
by_checker[checker]["checker"] = checker
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- by_checker[checker]["options"] += checker.options_and_values()
+ by_checker[checker]["options"] += checker._options_and_values()
by_checker[checker]["msgs"].update(checker.msgs)
by_checker[checker]["reports"] += checker.reports
by_checker[checker]["doc"] += doc
by_checker[checker]["module"] += module
except KeyError:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- by_checker[checker] = _CheckerInfo(
- checker=checker,
- options=list(checker.options_and_values()),
- msgs=dict(checker.msgs),
- reports=list(checker.reports),
- doc=doc,
- module=module,
- )
+ by_checker[checker] = _CheckerInfo(
+ checker=checker,
+ options=list(checker._options_and_values()),
+ msgs=dict(checker.msgs),
+ reports=list(checker.reports),
+ doc=doc,
+ module=module,
+ )
return by_checker
diff --git a/doc/exts/pylint_features.py b/doc/exts/pylint_features.py
index fcf4f01c8..4a8575151 100755
--- a/doc/exts/pylint_features.py
+++ b/doc/exts/pylint_features.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Script used to generate the features file before building the actual
documentation.
diff --git a/doc/exts/pylint_messages.py b/doc/exts/pylint_messages.py
index b16f7b026..81a9bc542 100644
--- a/doc/exts/pylint_messages.py
+++ b/doc/exts/pylint_messages.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Script used to generate the messages files."""
@@ -336,7 +336,7 @@ def _generate_checker_url(message: MessageData) -> str:
checker_module_rel_path = os.path.relpath(
message.checker_module_path, PYLINT_BASE_PATH
)
- return f"https://github.com/PyCQA/pylint/blob/main/{checker_module_rel_path}"
+ return f"https://github.com/pylint-dev/pylint/blob/main/{checker_module_rel_path}"
def _write_single_shared_message_page(
diff --git a/doc/exts/pylint_options.py b/doc/exts/pylint_options.py
index 2e6be23e2..170eefd1d 100644
--- a/doc/exts/pylint_options.py
+++ b/doc/exts/pylint_options.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Script used to generate the options page."""
diff --git a/doc/pyreverse.rst b/doc/pyreverse.rst
index fecbbaf5a..7595683d7 100644
--- a/doc/pyreverse.rst
+++ b/doc/pyreverse.rst
@@ -5,7 +5,7 @@ Pyreverse
``pyreverse`` analyzes your source code and generates package and class diagrams.
-It supports output to ``.dot``/``.gv``, ``.vcg``, ``.puml``/``.plantuml`` (PlantUML) and ``.mmd``/``.html`` (MermaidJS) file formats.
+It supports output to ``.dot``/``.gv``, ``.puml``/``.plantuml`` (PlantUML) and ``.mmd``/``.html`` (MermaidJS) file formats.
If Graphviz (or the ``dot`` command) is installed, all `output formats supported by Graphviz <https://graphviz.org/docs/outputs/>`_
can be used as well. In this case, ``pyreverse`` first generates a temporary ``.gv`` file, which is then
fed to Graphviz to generate the final image.
diff --git a/doc/requirements.txt b/doc/requirements.txt
index 1a9e621b6..62b6b6b0f 100644
--- a/doc/requirements.txt
+++ b/doc/requirements.txt
@@ -1,6 +1,6 @@
-Sphinx==6.1.3
+Sphinx==6.2.0
sphinx-reredirects<1
-myst-parser~=0.19
+myst-parser~=1.0
towncrier~=22.12
-furo==2022.12.7
+furo==2023.3.27
-e .
diff --git a/doc/symilar.rst b/doc/symilar.rst
index 5b75ff38f..fd7124e1d 100644
--- a/doc/symilar.rst
+++ b/doc/symilar.rst
@@ -20,7 +20,6 @@ All files that shall be checked have to be passed in explicitly, e.g.::
==tests/data/suppliermodule_test.py:12
class Ancestor:
""" Ancestor method """
- __implements__ = (Interface,)
cls_member = DoNothing()
def __init__(self, value):
diff --git a/doc/test_messages_documentation.py b/doc/test_messages_documentation.py
index 80e44c4a2..058dcbe49 100644
--- a/doc/test_messages_documentation.py
+++ b/doc/test_messages_documentation.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Functional tests for the code examples in the messages' documentation."""
diff --git a/doc/user_guide/checkers/extensions.rst b/doc/user_guide/checkers/extensions.rst
index 793b3889b..79a797a7c 100644
--- a/doc/user_guide/checkers/extensions.rst
+++ b/doc/user_guide/checkers/extensions.rst
@@ -10,7 +10,6 @@ Pylint provides the following optional plugins:
- :ref:`pylint.extensions.broad_try_clause`
- :ref:`pylint.extensions.check_elif`
- :ref:`pylint.extensions.code_style`
-- :ref:`pylint.extensions.comparetozero`
- :ref:`pylint.extensions.comparison_placement`
- :ref:`pylint.extensions.confusing_elif`
- :ref:`pylint.extensions.consider_refactoring_into_while_condition`
@@ -20,7 +19,6 @@ Pylint provides the following optional plugins:
- :ref:`pylint.extensions.docstyle`
- :ref:`pylint.extensions.dunder`
- :ref:`pylint.extensions.empty_comment`
-- :ref:`pylint.extensions.emptystring`
- :ref:`pylint.extensions.eq_without_hash`
- :ref:`pylint.extensions.for_any_all`
- :ref:`pylint.extensions.magic_value`
@@ -88,34 +86,6 @@ Code Style checker Messages
to. This can be changed to be an augmented assign. Disabled by default!
-.. _pylint.extensions.emptystring:
-
-Compare-To-Empty-String checker
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This checker is provided by ``pylint.extensions.emptystring``.
-Verbatim name of the checker is ``compare-to-empty-string``.
-
-Compare-To-Empty-String checker Messages
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-:compare-to-empty-string (C1901): *"%s" can be simplified to "%s" as an empty string is falsey*
- Used when Pylint detects comparison to an empty string constant.
-
-
-.. _pylint.extensions.comparetozero:
-
-Compare-To-Zero checker
-~~~~~~~~~~~~~~~~~~~~~~~
-
-This checker is provided by ``pylint.extensions.comparetozero``.
-Verbatim name of the checker is ``compare-to-zero``.
-
-Compare-To-Zero checker Messages
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-:compare-to-zero (C2001): *"%s" can be simplified to "%s" as 0 is falsey*
- Used when Pylint detects comparison to a 0 constant.
-
-
.. _pylint.extensions.comparison_placement:
Comparison-Placement checker
diff --git a/doc/user_guide/checkers/features.rst b/doc/user_guide/checkers/features.rst
index 9a7c8a4ff..eb716d389 100644
--- a/doc/user_guide/checkers/features.rst
+++ b/doc/user_guide/checkers/features.rst
@@ -893,10 +893,21 @@ Refactoring checker Messages
Emitted when a single "return" or "return None" statement is found at the end
of function or method definition. This statement can safely be removed
because Python will implicitly return None
-:use-implicit-booleaness-not-comparison (C1803): *'%s' can be simplified to '%s' as an empty %s is falsey*
- Used when Pylint detects that collection literal comparison is being used to
- check for emptiness; Use implicit booleaness instead of a collection classes;
- empty collections are considered as false
+:use-implicit-booleaness-not-comparison-to-string (C1804): *"%s" can be simplified to "%s", if it is striclty a string, as an empty string is falsey*
+ Empty string are considered false in a boolean context. Following this check
+ blindly in weakly typed code base can create hard to debug issues. If the
+ value can be something else that is falsey but not a string (for example
+ ``None``, an empty sequence, or ``0``) the code will not be equivalent.
+:use-implicit-booleaness-not-comparison (C1803): *"%s" can be simplified to "%s", if it is strictly a sequence, as an empty %s is falsey*
+ Empty sequences are considered false in a boolean context. Following this
+ check blindly in weakly typed code base can create hard to debug issues. If
+ the value can be something else that is falsey but not a sequence (for
+ example ``None``, an empty string, or ``0``) the code will not be equivalent.
+:use-implicit-booleaness-not-comparison-to-zero (C1805): *"%s" can be simplified to "%s", if it is strictly an int, as 0 is falsey*
+ 0 is considered false in a boolean context. Following this check blindly in
+ weakly typed code base can create hard to debug issues. If the value can be
+ something else that is falsey but not an int (for example ``None``, an empty
+ string, or an empty sequence) the code will not be equivalent.
:unneeded-not (C0113): *Consider changing "%s" to "%s"*
Used when a boolean expression contains an unneeded negation.
:consider-iterating-dictionary (C0201): *Consider iterating the dictionary directly instead of calling .keys()*
@@ -912,13 +923,12 @@ Refactoring checker Messages
Emitted when code that iterates with range and len is encountered. Such code
can be simplified by using the enumerate builtin.
:use-implicit-booleaness-not-len (C1802): *Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty*
- Used when Pylint detects that len(sequence) is being used without explicit
- comparison inside a condition to determine if a sequence is empty. Instead of
- coercing the length to a boolean, either rely on the fact that empty
- sequences are false or compare the length against a scalar.
-:consider-using-f-string (C0209): *Formatting a regular string which could be a f-string*
+ Empty sequences are considered false in a boolean context. You can either
+ remove the call to 'len' (``if not x``) or compare the length against ascalar
+ (``if len(x) > 1``).
+:consider-using-f-string (C0209): *Formatting a regular string which could be an f-string*
Used when we detect a string that is being formatted with format() or % which
- could potentially be a f-string. The use of f-strings is preferred. Requires
+ could potentially be an f-string. The use of f-strings is preferred. Requires
Python 3.6 and ``py-version >= 3.6``.
:use-maxsplit-arg (C0207): *Use %s instead*
Emitted when accessing only the first or last element of str.split(). The
@@ -1308,7 +1318,7 @@ Unsupported Version checker Messages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:using-f-string-in-unsupported-version (W2601): *F-strings are not supported by all versions included in the py-version setting*
Used when the py-version set by the user is lower than 3.6 and pylint
- encounters a f-string.
+ encounters an f-string.
:using-final-decorator-in-unsupported-version (W2602): *typing.final is not supported by all versions included in the py-version setting*
Used when the py-version set by the user is lower than 3.8 and pylint
encounters a ``typing.final`` decorator.
diff --git a/doc/user_guide/configuration/all-options.rst b/doc/user_guide/configuration/all-options.rst
index ecdfc9ef5..8b68ab7dd 100644
--- a/doc/user_guide/configuration/all-options.rst
+++ b/doc/user_guide/configuration/all-options.rst
@@ -233,7 +233,7 @@ Standard Checkers
confidence = ["HIGH", "CONTROL_FLOW", "INFERENCE", "INFERENCE_FAILURE", "UNDEFINED"]
- disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-symbolic-message-instead", "consider-using-augmented-assign"]
+ disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-implicit-booleaness-not-comparison-to-string", "use-implicit-booleaness-not-comparison-to-zero", "use-symbolic-message-instead", "consider-using-augmented-assign"]
enable = []
diff --git a/doc/user_guide/installation/badge.rst b/doc/user_guide/installation/badge.rst
index 8463d40b3..3c5df9e82 100644
--- a/doc/user_guide/installation/badge.rst
+++ b/doc/user_guide/installation/badge.rst
@@ -7,16 +7,16 @@ Show your usage
You can place this badge in your README to let others know your project uses pylint.
.. image:: https://img.shields.io/badge/linting-pylint-yellowgreen
- :target: https://github.com/PyCQA/pylint
+ :target: https://github.com/pylint-dev/pylint
Use the badge in your project's README.md (or any other Markdown file)::
- [![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/PyCQA/pylint)
+ [![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
Use the badge in your project's README.rst (or any other rst file)::
.. image:: https://img.shields.io/badge/linting-pylint-yellowgreen
- :target: https://github.com/PyCQA/pylint
+ :target: https://github.com/pylint-dev/pylint
If you use GitHub Actions, and one of your CI workflows begins with "name: pylint", you
diff --git a/doc/user_guide/installation/ide_integration/flymake-emacs.rst b/doc/user_guide/installation/ide_integration/flymake-emacs.rst
index 79310ff59..64aad8a66 100644
--- a/doc/user_guide/installation/ide_integration/flymake-emacs.rst
+++ b/doc/user_guide/installation/ide_integration/flymake-emacs.rst
@@ -4,75 +4,6 @@ Using Pylint through Flymake in Emacs
=====================================
.. warning::
- The Emacs package now has its own repository and is looking for a maintainer.
- If you're reading this doc and are interested in maintaining this package or
- are actually using flymake please open an issue at
- https://github.com/emacsorphanage/pylint/issues/new/choose
-
-To enable Flymake for Python, insert the following into your .emacs:
-
-.. sourcecode:: common-lisp
-
- ;; Configure Flymake for Python
- (when (load "flymake" t)
- (defun flymake-pylint-init ()
- (let* ((temp-file (flymake-init-create-temp-buffer-copy
- 'flymake-create-temp-inplace))
- (local-file (file-relative-name
- temp-file
- (file-name-directory buffer-file-name))))
- (list "epylint" (list local-file))))
- (add-to-list 'flymake-allowed-file-name-masks
- '("\\.py\\'" flymake-pylint-init)))
-
- ;; Set as a minor mode for Python
- (add-hook 'python-mode-hook '(lambda () (flymake-mode)))
-
-Above stuff is in ``pylint/elisp/pylint-flymake.el``, which should be automatically
-installed on Debian systems, in which cases you don't have to put it in your ``.emacs`` file.
-
-Other things you may find useful to set:
-
-.. sourcecode:: common-lisp
-
- ;; Configure to wait a bit longer after edits before starting
- (setq-default flymake-no-changes-timeout '3)
-
- ;; Keymaps to navigate to the errors
- (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-cn" 'flymake-goto-next-error)))
- (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-cp" 'flymake-goto-prev-error)))
-
-
-Finally, by default Flymake only displays the extra information about the error when you
-hover the mouse over the highlighted line. The following will use the minibuffer to display
-messages when you the cursor is on the line.
-
-.. sourcecode:: common-lisp
-
- ;; To avoid having to mouse hover for the error message, these functions make Flymake error messages
- ;; appear in the minibuffer
- (defun show-fly-err-at-point ()
- "If the cursor is sitting on a Flymake error, display the message in the minibuffer"
- (require 'cl)
- (interactive)
- (let ((line-no (line-number-at-pos)))
- (dolist (elem flymake-err-info)
- (if (eq (car elem) line-no)
- (let ((err (car (second elem))))
- (message "%s" (flymake-ler-text err)))))))
-
- (add-hook 'post-command-hook 'show-fly-err-at-point)
-
-
-Alternative, if you only wish to pollute the minibuffer after an explicit flymake-goto-* then use
-the following instead of a post-command-hook
-
-.. sourcecode:: common-lisp
-
- (defadvice flymake-goto-next-error (after display-message activate compile)
- "Display the error in the mini-buffer rather than having to mouse over it"
- (show-fly-err-at-point))
-
- (defadvice flymake-goto-prev-error (after display-message activate compile)
- "Display the error in the mini-buffer rather than having to mouse over it"
- (show-fly-err-at-point))
+ epylint was deprecated in 2.16.0 and targeted for deletion in 3.0.0.
+ All emacs and flymake related files were removed and their support will
+ now happen in an external repository: https://github.com/emacsorphanage/pylint.
diff --git a/doc/user_guide/messages/messages_overview.rst b/doc/user_guide/messages/messages_overview.rst
index 167802ae2..9515fecb4 100644
--- a/doc/user_guide/messages/messages_overview.rst
+++ b/doc/user_guide/messages/messages_overview.rst
@@ -390,8 +390,6 @@ All messages in the convention category:
convention/bad-file-encoding
convention/bad-mcs-classmethod-argument
convention/bad-mcs-method-argument
- convention/compare-to-empty-string
- convention/compare-to-zero
convention/consider-iterating-dictionary
convention/consider-using-any-or-all
convention/consider-using-dict-items
@@ -433,6 +431,8 @@ All messages in the convention category:
convention/unnecessary-lambda-assignment
convention/unneeded-not
convention/use-implicit-booleaness-not-comparison
+ convention/use-implicit-booleaness-not-comparison-to-string
+ convention/use-implicit-booleaness-not-comparison-to-zero
convention/use-implicit-booleaness-not-len
convention/use-maxsplit-arg
convention/use-sequence-for-iteration
@@ -449,6 +449,8 @@ All renamed messages in the convention category:
:titlesonly:
convention/blacklisted-name
+ convention/compare-to-empty-string
+ convention/compare-to-zero
convention/len-as-condition
convention/missing-docstring
convention/old-misplaced-comparison-constant
diff --git a/doc/user_guide/usage/run.rst b/doc/user_guide/usage/run.rst
index b9dfedc88..7e6e1a830 100644
--- a/doc/user_guide/usage/run.rst
+++ b/doc/user_guide/usage/run.rst
@@ -105,6 +105,9 @@ configuration file in the following order and uses the first one it finds:
providing it has at least one ``pylint.`` section
#. ``tox.ini`` in the current working directory,
providing it has at least one ``pylint.`` section
+#. Pylint will search for the ``pyproject.toml`` file up the directories hierarchy
+ unless it's found, or a ``.git``/``.hg`` directory is found, or the file system root
+ is approached.
#. If the current working directory is in a Python package, Pylint searches \
up the hierarchy of Python packages until it finds a ``pylintrc`` file. \
This allows you to specify coding standards on a module-by-module \
diff --git a/doc/whatsnew/2/2.1/full.rst b/doc/whatsnew/2/2.1/full.rst
index a1e7e24c1..03d1e82ac 100644
--- a/doc/whatsnew/2/2.1/full.rst
+++ b/doc/whatsnew/2/2.1/full.rst
@@ -42,7 +42,7 @@ Release date: 2018-08-01
* Correctly handle the new name of the Python implementation of the ``abc`` module.
- Closes PyCQA/astroid#2288
+ Closes pylint-dev/astroid#2288
* Modules with ``__getattr__`` are exempted by default from ``no-member``
diff --git a/doc/whatsnew/2/2.10/summary.rst b/doc/whatsnew/2/2.10/summary.rst
index 6b3689643..814fd94f5 100644
--- a/doc/whatsnew/2/2.10/summary.rst
+++ b/doc/whatsnew/2/2.10/summary.rst
@@ -21,7 +21,7 @@ We're going to continue working on improving performance during 2.11. We're also
a new ``possible-forgotten-f-prefix`` check that had too much false positives at release time.
Check the `possible-forgotten-f-prefix`_ issue if you want to provide knowledge or use case :)
-.. _possible-forgotten-f-prefix: https://github.com/PyCQA/pylint/pull/4787
+.. _possible-forgotten-f-prefix: https://github.com/pylint-dev/pylint/pull/4787
New checkers
============
diff --git a/doc/whatsnew/2/2.11/summary.rst b/doc/whatsnew/2/2.11/summary.rst
index 39851b0e8..1d16bc521 100644
--- a/doc/whatsnew/2/2.11/summary.rst
+++ b/doc/whatsnew/2/2.11/summary.rst
@@ -26,7 +26,7 @@ The future ``possible-forgotten-f-prefix`` check still had too much false positi
and is delayed again. Check the `possible-forgotten-f-prefix`_ issue if you want
to provide knowledge or use case :)
-.. _possible-forgotten-f-prefix: https://github.com/PyCQA/pylint/pull/4787
+.. _possible-forgotten-f-prefix: https://github.com/pylint-dev/pylint/pull/4787
.. _pyupgrade: https://github.com/asottile/pyupgrade
.. _flynt: https://github.com/ikamensh/flynt
diff --git a/doc/whatsnew/2/2.12/full.rst b/doc/whatsnew/2/2.12/full.rst
index 923dd9a25..d3f7d0922 100644
--- a/doc/whatsnew/2/2.12/full.rst
+++ b/doc/whatsnew/2/2.12/full.rst
@@ -83,7 +83,7 @@ Release date: 2021-11-24
and allows it to be checked against actual output in a test.
* Fix a crash in the ``check_elif`` extensions where an undetected if in a comprehension
- with an if statement within a f-string resulted in an out of range error. The checker no
+ with an if statement within an f-string resulted in an out of range error. The checker no
longer relies on counting if statements anymore and uses known if statements locations instead.
It should not crash on badly parsed if statements anymore.
diff --git a/doc/whatsnew/2/2.13/full.rst b/doc/whatsnew/2/2.13/full.rst
index f723731dc..797648431 100644
--- a/doc/whatsnew/2/2.13/full.rst
+++ b/doc/whatsnew/2/2.13/full.rst
@@ -250,7 +250,7 @@ Release date: 2022-03-24
* 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.
- Refs PyCQA/astroid#1360
+ Refs pylint-dev/astroid#1360
Closes #4826
* Output better error message if unsupported file formats are used with ``pyreverse``.
@@ -389,7 +389,7 @@ Release date: 2022-03-24
* Fixed a crash involving a ``NewType`` named with an f-string.
Closes #5770
- Ref PyCQA/astroid#1400
+ Ref pylint-dev/astroid#1400
* Improved ``bad-open-mode`` message when providing ``None`` to the ``mode``
argument of an ``open()`` call.
@@ -406,13 +406,13 @@ Release date: 2022-03-24
the class itself.
Closes #5408
- Ref PyCQA/astroid#1392
+ Ref pylint-dev/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
+ Ref pylint-dev/astroid#1382
* The issue template for crashes is now created for crashes which were previously not covered
by this mechanism.
diff --git a/doc/whatsnew/2/2.13/summary.rst b/doc/whatsnew/2/2.13/summary.rst
index 73d377a76..ddfb98f84 100644
--- a/doc/whatsnew/2/2.13/summary.rst
+++ b/doc/whatsnew/2/2.13/summary.rst
@@ -16,7 +16,7 @@ A lot of ``undefined-variables`` and ``used-before-assignment`` issues were reso
We started integrating ``pylint-error`` the documentation created by @vald-phoenix a developer from Hlyniane,
Ukraine. We hope he's doing well despite the current situation. The deployment is set up but `there's still a lot to do so we welcome any community effort
-help to review, integrate, and add good/bad examples <https://github.com/PyCQA/pylint/issues/5953>`_. This should be doable
+help to review, integrate, and add good/bad examples <https://github.com/pylint-dev/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 without investing any time learning the internals.
@@ -144,7 +144,7 @@ Other Changes
* 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.
- Refs PyCQA/astroid#1360
+ Refs pylint-dev/astroid#1360
Closes #4826
* Fix matching ``--notes`` options that end in a non-word character.
@@ -295,13 +295,13 @@ Other Changes
the class itself.
Closes #5408
- RefsPyCQA/astroid#1392
+ Refs pylint-dev/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
- RefsPyCQA/astroid#1382
+ Refs pylint-dev/astroid#1382
* Optimize parsing of long lines when ``missing-final-newline`` is enabled.
@@ -343,7 +343,7 @@ Other Changes
* Fixed a crash involving a ``NewType`` named with an f-string.
Closes #5770
- RefsPyCQA/astroid#1400
+ Refs pylint-dev/astroid#1400
* Improved ``bad-open-mode`` message when providing ``None`` to the ``mode``
argument of an ``open()`` call.
diff --git a/doc/whatsnew/2/2.14/summary.rst b/doc/whatsnew/2/2.14/summary.rst
index 9ef0f04d9..7101c69b6 100644
--- a/doc/whatsnew/2/2.14/summary.rst
+++ b/doc/whatsnew/2/2.14/summary.rst
@@ -23,7 +23,7 @@ maintainer that depends on pylint, please verify that you're ready for pylint 3.
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 <https://github.com/PyCQA/pylint/issues/5953>`_. This should be doable
+to help review, integrate, and add good/bad examples <https://github.com/pylint-dev/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!
diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst
index aab05caef..91e70e341 100644
--- a/doc/whatsnew/2/2.15/index.rst
+++ b/doc/whatsnew/2/2.15/index.rst
@@ -18,7 +18,7 @@ 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``
+<https://github.com/pylint-dev/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!
@@ -39,23 +39,23 @@ False Positives Fixed
- Fix ``use-sequence-for-iteration`` when unpacking a set with ``*``.
- Closes #5788 (`#5788 <https://github.com/PyCQA/pylint/issues/5788>`_)
+ Closes #5788 (`#5788 <https://github.com/pylint-dev/pylint/issues/5788>`_)
- Fix false positive ``assigning-non-slot`` when a class attribute is
re-assigned.
- Closes #6001 (`#6001 <https://github.com/PyCQA/pylint/issues/6001>`_)
+ Closes #6001 (`#6001 <https://github.com/pylint-dev/pylint/issues/6001>`_)
- Fixes ``used-before-assignment`` false positive when the walrus operator
is used in a ternary operator.
- Closes #7779 (`#7779 <https://github.com/PyCQA/pylint/issues/7779>`_)
+ Closes #7779 (`#7779 <https://github.com/pylint-dev/pylint/issues/7779>`_)
- Prevent ``used-before-assignment`` when imports guarded by ``if
TYPE_CHECKING``
are guarded again when used.
- Closes #7979 (`#7979 <https://github.com/PyCQA/pylint/issues/7979>`_)
+ Closes #7979 (`#7979 <https://github.com/pylint-dev/pylint/issues/7979>`_)
@@ -64,7 +64,7 @@ Other Bug Fixes
- Using custom braces in ``msg-template`` will now work properly.
- Closes #5636 (`#5636 <https://github.com/PyCQA/pylint/issues/5636>`_)
+ Closes #5636 (`#5636 <https://github.com/pylint-dev/pylint/issues/5636>`_)
What's new in Pylint 2.15.9?
@@ -78,7 +78,7 @@ False Positives Fixed
- Fix false-positive for ``used-before-assignment`` in pattern matching
with a guard.
- Closes #5327 (`#5327 <https://github.com/PyCQA/pylint/issues/5327>`_)
+ Closes #5327 (`#5327 <https://github.com/pylint-dev/pylint/issues/5327>`_)
@@ -88,17 +88,17 @@ Other Bug Fixes
- Pylint will no longer deadlock if a parallel job is killed but fail
immediately instead.
- Closes #3899 (`#3899 <https://github.com/PyCQA/pylint/issues/3899>`_)
+ Closes #3899 (`#3899 <https://github.com/pylint-dev/pylint/issues/3899>`_)
- When pylint exit due to bad arguments being provided the exit code will now
be the expected ``32``.
- Refs #7931 (`#7931 <https://github.com/PyCQA/pylint/issues/7931>`_)
+ Refs #7931 (`#7931 <https://github.com/pylint-dev/pylint/issues/7931>`_)
- Fixes a ``ModuleNotFound`` exception when running pylint on a Django project
with the ``pylint_django`` plugin enabled.
- Closes #7938 (`#7938 <https://github.com/PyCQA/pylint/issues/7938>`_)
+ Closes #7938 (`#7938 <https://github.com/pylint-dev/pylint/issues/7938>`_)
What's new in Pylint 2.15.8?
@@ -112,26 +112,26 @@ 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 (`#3368 <https://github.com/PyCQA/pylint/issues/3368>`_)
+ Closes #3368 (`#3368 <https://github.com/pylint-dev/pylint/issues/3368>`_)
- Fix ``logging-fstring-interpolation`` false positive raised when logging and
f-string with ``%s`` formatting.
- Closes #4984 (`#4984 <https://github.com/PyCQA/pylint/issues/4984>`_)
+ Closes #4984 (`#4984 <https://github.com/pylint-dev/pylint/issues/4984>`_)
- Fixes false positive ``abstract-method`` on Protocol classes.
- Closes #7209 (`#7209 <https://github.com/PyCQA/pylint/issues/7209>`_)
+ Closes #7209 (`#7209 <https://github.com/pylint-dev/pylint/issues/7209>`_)
- Fix ``missing-param-doc`` false positive when function parameter has an
escaped underscore.
- Closes #7827 (`#7827 <https://github.com/PyCQA/pylint/issues/7827>`_)
+ Closes #7827 (`#7827 <https://github.com/pylint-dev/pylint/issues/7827>`_)
- ``multiple-statements`` no longer triggers for function stubs using inlined
``...``.
- Closes #7860 (`#7860 <https://github.com/PyCQA/pylint/issues/7860>`_)
+ Closes #7860 (`#7860 <https://github.com/pylint-dev/pylint/issues/7860>`_)
What's new in Pylint 2.15.7?
@@ -145,12 +145,12 @@ False Positives Fixed
- Fix ``deprecated-method`` false positive when alias for method is similar to
name of deprecated method.
- Closes #5886 (`#5886 <https://github.com/PyCQA/pylint/issues/5886>`_)
+ Closes #5886 (`#5886 <https://github.com/pylint-dev/pylint/issues/5886>`_)
- Fix a false positive for ``used-before-assignment`` for imports guarded by
``typing.TYPE_CHECKING`` later used in variable annotations.
- Closes #7609 (`#7609 <https://github.com/PyCQA/pylint/issues/7609>`_)
+ Closes #7609 (`#7609 <https://github.com/pylint-dev/pylint/issues/7609>`_)
@@ -161,12 +161,12 @@ Other Bug Fixes
should
be the same whether a file is given/discovered multiple times or not.
- Closes #6242, #4053 (`#6242 <https://github.com/PyCQA/pylint/issues/6242>`_)
+ Closes #6242, #4053 (`#6242 <https://github.com/pylint-dev/pylint/issues/6242>`_)
- Fixes a crash in ``stop-iteration-return`` when the ``next`` builtin is
called without arguments.
- Closes #7828 (`#7828 <https://github.com/PyCQA/pylint/issues/7828>`_)
+ Closes #7828 (`#7828 <https://github.com/pylint-dev/pylint/issues/7828>`_)
What's new in Pylint 2.15.6?
@@ -180,17 +180,17 @@ False Positives Fixed
- Fix false positive for ``unhashable-member`` when subclassing ``dict`` and
using the subclass as a dictionary key.
- Closes #7501 (`#7501 <https://github.com/PyCQA/pylint/issues/7501>`_)
+ Closes #7501 (`#7501 <https://github.com/pylint-dev/pylint/issues/7501>`_)
- ``unnecessary-list-index-lookup`` will not be wrongly emitted if
``enumerate`` is called with ``start``.
- Closes #7682 (`#7682 <https://github.com/PyCQA/pylint/issues/7682>`_)
+ Closes #7682 (`#7682 <https://github.com/pylint-dev/pylint/issues/7682>`_)
- Don't warn about ``stop-iteration-return`` when using ``next()`` over
``itertools.cycle``.
- Closes #7765 (`#7765 <https://github.com/PyCQA/pylint/issues/7765>`_)
+ Closes #7765 (`#7765 <https://github.com/pylint-dev/pylint/issues/7765>`_)
@@ -200,21 +200,21 @@ Other Bug Fixes
- Messages sent to reporter are now copied so a reporter cannot modify the
message sent to other reporters.
- Closes #7214 (`#7214 <https://github.com/PyCQA/pylint/issues/7214>`_)
+ Closes #7214 (`#7214 <https://github.com/pylint-dev/pylint/issues/7214>`_)
- Fixes edge case of custom method named ``next`` raised an astroid error.
- Closes #7610 (`#7610 <https://github.com/PyCQA/pylint/issues/7610>`_)
+ Closes #7610 (`#7610 <https://github.com/pylint-dev/pylint/issues/7610>`_)
- Fix crash that happened when parsing files with unexpected encoding starting
with 'utf' like ``utf13``.
- Closes #7661 (`#7661 <https://github.com/PyCQA/pylint/issues/7661>`_)
+ Closes #7661 (`#7661 <https://github.com/pylint-dev/pylint/issues/7661>`_)
- Fix a crash when a child class with an ``__init__`` method inherits from a
parent class with an ``__init__`` class attribute.
- Closes #7742 (`#7742 <https://github.com/PyCQA/pylint/issues/7742>`_)
+ Closes #7742 (`#7742 <https://github.com/pylint-dev/pylint/issues/7742>`_)
What's new in Pylint 2.15.5?
@@ -228,7 +228,7 @@ False Positives Fixed
- Fix a false positive for ``simplify-boolean-expression`` when multiple values
are inferred for a constant.
- Closes #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_)
+ Closes #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_)
@@ -238,7 +238,7 @@ Other Bug Fixes
- Remove ``__index__`` dunder method call from ``unnecessary-dunder-call``
check.
- Closes #6795 (`#6795 <https://github.com/PyCQA/pylint/issues/6795>`_)
+ Closes #6795 (`#6795 <https://github.com/pylint-dev/pylint/issues/6795>`_)
- Fixed a multi-processing crash that prevents using any more than 1 thread on
MacOS.
@@ -249,7 +249,7 @@ Other Bug Fixes
when
attempting to serialise the linter object for multi-processing use.
- Closes #7635. (`#7635 <https://github.com/PyCQA/pylint/issues/7635>`_)
+ Closes #7635. (`#7635 <https://github.com/pylint-dev/pylint/issues/7635>`_)
@@ -258,11 +258,11 @@ Other Changes
- Add a keyword-only ``compare_constants`` argument to ``safe_infer``.
- Refs #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_)
+ Refs #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_)
- Sort ``--generated-rcfile`` output.
- Refs #7655 (`#7655 <https://github.com/PyCQA/pylint/issues/7655>`_)
+ Refs #7655 (`#7655 <https://github.com/pylint-dev/pylint/issues/7655>`_)
What's new in Pylint 2.15.4?
@@ -277,7 +277,7 @@ False Positives Fixed
``__anext__``. Also
only emit the warning when ``py-version`` >= 3.10.
- Closes #7529 (`#7529 <https://github.com/PyCQA/pylint/issues/7529>`_)
+ Closes #7529 (`#7529 <https://github.com/pylint-dev/pylint/issues/7529>`_)
@@ -286,39 +286,39 @@ Other Bug Fixes
- Fix bug in detecting ``unused-variable`` when iterating on variable.
- Closes #3044 (`#3044 <https://github.com/PyCQA/pylint/issues/3044>`_)
+ Closes #3044 (`#3044 <https://github.com/pylint-dev/pylint/issues/3044>`_)
- Fixed handling of ``--`` as separator between positional arguments and flags.
This was not actually fixed in 2.14.5.
Closes #7003, Refs #7096 (`#7003
- <https://github.com/PyCQA/pylint/issues/7003>`_)
+ <https://github.com/pylint-dev/pylint/issues/7003>`_)
- Report ``no-self-argument`` rather than ``no-method-argument`` for methods
with variadic arguments.
- Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_)
+ Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_)
- Fixed an issue where ``syntax-error`` couldn't be raised on files with
invalid encodings.
- Closes #7522 (`#7522 <https://github.com/PyCQA/pylint/issues/7522>`_)
+ Closes #7522 (`#7522 <https://github.com/pylint-dev/pylint/issues/7522>`_)
- Fix false positive for ``redefined-outer-name`` when aliasing ``typing``
e.g. as ``t`` and guarding imports under ``t.TYPE_CHECKING``.
- Closes #7524 (`#7524 <https://github.com/PyCQA/pylint/issues/7524>`_)
+ Closes #7524 (`#7524 <https://github.com/pylint-dev/pylint/issues/7524>`_)
- Fixed a crash of the ``modified_iterating`` checker when iterating on a set
defined as a class attribute.
- Closes #7528 (`#7528 <https://github.com/PyCQA/pylint/issues/7528>`_)
+ Closes #7528 (`#7528 <https://github.com/pylint-dev/pylint/issues/7528>`_)
- Fix bug in scanning of names inside arguments to ``typing.Literal``.
See https://peps.python.org/pep-0586/#literals-enums-and-forward-references
for details.
- Refs #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_)
+ Refs #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_)
Other Changes
@@ -327,7 +327,7 @@ Other Changes
- Add method name to the error messages of ``no-method-argument`` and
``no-self-argument``.
- Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_)
+ Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_)
What's new in Pylint 2.15.3?
@@ -337,23 +337,23 @@ Release date: 2022-09-19
- Fixed a crash in the ``unhashable-member`` checker when using a ``lambda`` as a dict key.
- Closes #7453 (`#7453 <https://github.com/PyCQA/pylint/issues/7453>`_)
+ Closes #7453 (`#7453 <https://github.com/pylint-dev/pylint/issues/7453>`_)
- Fix a crash in the ``modified-iterating-dict`` checker involving instance attributes.
- Closes #7461 (`#7461 <https://github.com/PyCQA/pylint/issues/7461>`_)
+ Closes #7461 (`#7461 <https://github.com/pylint-dev/pylint/issues/7461>`_)
- ``invalid-class-object`` does not crash anymore when ``__class__`` is assigned alongside another variable.
- Closes #7467 (`#7467 <https://github.com/PyCQA/pylint/issues/7467>`_)
+ Closes #7467 (`#7467 <https://github.com/pylint-dev/pylint/issues/7467>`_)
- Fix false positive for ``global-variable-not-assigned`` when a global variable is re-assigned via an ``ImportFrom`` node.
- Closes #4809 (`#4809 <https://github.com/PyCQA/pylint/issues/4809>`_)
+ Closes #4809 (`#4809 <https://github.com/pylint-dev/pylint/issues/4809>`_)
- Fix false positive for ``undefined-loop-variable`` in ``for-else`` loops that use a function
having a return type annotation of ``NoReturn`` or ``Never``.
- Closes #7311 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_)
+ Closes #7311 (`#7311 <https://github.com/pylint-dev/pylint/issues/7311>`_)
- ``--help-msg`` now accepts a comma-separated list of message IDs again.
- Closes #7471 (`#7471 <https://github.com/PyCQA/pylint/issues/7471>`_)
+ Closes #7471 (`#7471 <https://github.com/pylint-dev/pylint/issues/7471>`_)
What's new in Pylint 2.15.2?
----------------------------
@@ -366,42 +366,42 @@ Release date: 2022-09-07
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. (`#7264 <https://github.com/PyCQA/pylint/issues/7264>`_)
+ Fixes part of #7264. (`#7264 <https://github.com/pylint-dev/pylint/issues/7264>`_)
- Fix ``used-before-assignment`` for functions/classes defined in type checking guard.
- Closes #7368 (`#7368 <https://github.com/PyCQA/pylint/issues/7368>`_)
+ Closes #7368 (`#7368 <https://github.com/pylint-dev/pylint/issues/7368>`_)
- Update ``modified_iterating`` checker to fix a crash with ``for`` loops on empty list.
- Closes #7380 (`#7380 <https://github.com/PyCQA/pylint/issues/7380>`_)
+ Closes #7380 (`#7380 <https://github.com/pylint-dev/pylint/issues/7380>`_)
- The ``docparams`` extension now considers typing in Numpy style docstrings
as "documentation" for the ``missing-param-doc`` message.
- Refs #7398 (`#7398 <https://github.com/PyCQA/pylint/issues/7398>`_)
+ Refs #7398 (`#7398 <https://github.com/pylint-dev/pylint/issues/7398>`_)
- Fix false positive for ``unused-variable`` and ``unused-import`` when a name is only used in a string literal type annotation.
- Closes #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_)
+ Closes #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_)
- Fix false positive for ``too-many-function-args`` when a function call is assigned to a class attribute inside the class where the function is defined.
- Closes #6592 (`#6592 <https://github.com/PyCQA/pylint/issues/6592>`_)
+ Closes #6592 (`#6592 <https://github.com/pylint-dev/pylint/issues/6592>`_)
- Fix ``used-before-assignment`` for functions/classes defined in type checking guard.
- Closes #7368 (`#7368 <https://github.com/PyCQA/pylint/issues/7368>`_)
+ Closes #7368 (`#7368 <https://github.com/pylint-dev/pylint/issues/7368>`_)
- Fix ignored files being linted when passed on stdin.
- Closes #4354 (`#4354 <https://github.com/PyCQA/pylint/issues/4354>`_)
+ Closes #4354 (`#4354 <https://github.com/pylint-dev/pylint/issues/4354>`_)
- ``missing-return-doc``, ``missing-raises-doc`` and ``missing-yields-doc`` now respect
the ``no-docstring-rgx`` option.
- Closes #4743 (`#4743 <https://github.com/PyCQA/pylint/issues/4743>`_)
+ Closes #4743 (`#4743 <https://github.com/pylint-dev/pylint/issues/4743>`_)
- Don't crash on ``OSError`` in config file discovery.
- Closes #7169 (`#7169 <https://github.com/PyCQA/pylint/issues/7169>`_)
+ Closes #7169 (`#7169 <https://github.com/pylint-dev/pylint/issues/7169>`_)
- ``disable-next`` is now correctly scoped to only the succeeding line.
- Closes #7401 (`#7401 <https://github.com/PyCQA/pylint/issues/7401>`_)
+ Closes #7401 (`#7401 <https://github.com/pylint-dev/pylint/issues/7401>`_)
- Update ``modified_iterating`` checker to fix a crash with ``for`` loops on empty list.
- Closes #7380 (`#7380 <https://github.com/PyCQA/pylint/issues/7380>`_)
+ Closes #7380 (`#7380 <https://github.com/pylint-dev/pylint/issues/7380>`_)
What's new in Pylint 2.15.1?
----------------------------
@@ -418,7 +418,7 @@ New Checks
- Added new checker ``missing-timeout`` to warn of default timeout values that could cause
a program to be hanging indefinitely.
- Refs #6780 (`#6780 <https://github.com/PyCQA/pylint/issues/6780>`_)
+ Refs #6780 (`#6780 <https://github.com/pylint-dev/pylint/issues/6780>`_)
False Positives Fixed
@@ -426,39 +426,39 @@ False Positives Fixed
- Don't report ``super-init-not-called`` for abstract ``__init__`` methods.
- Closes #3975 (`#3975 <https://github.com/PyCQA/pylint/issues/3975>`_)
+ Closes #3975 (`#3975 <https://github.com/pylint-dev/pylint/issues/3975>`_)
- Don't report ``unsupported-binary-operation`` on Python <= 3.9 when using the ``|`` operator
with types, if one has a metaclass that overloads ``__or__`` or ``__ror__`` as appropriate.
- Closes #4951 (`#4951 <https://github.com/PyCQA/pylint/issues/4951>`_)
+ Closes #4951 (`#4951 <https://github.com/pylint-dev/pylint/issues/4951>`_)
- Don't report ``no-value-for-parameter`` for dataclasses fields annotated with ``KW_ONLY``.
- Closes #5767 (`#5767 <https://github.com/PyCQA/pylint/issues/5767>`_)
+ Closes #5767 (`#5767 <https://github.com/pylint-dev/pylint/issues/5767>`_)
- Fixed inference of ``Enums`` when they are imported under an alias.
- Closes #5776 (`#5776 <https://github.com/PyCQA/pylint/issues/5776>`_)
+ Closes #5776 (`#5776 <https://github.com/pylint-dev/pylint/issues/5776>`_)
- Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+.
- Closes #5832 (`#5832 <https://github.com/PyCQA/pylint/issues/5832>`_)
+ Closes #5832 (`#5832 <https://github.com/pylint-dev/pylint/issues/5832>`_)
- ``unnecessary-list-index-lookup`` is now more conservative to avoid potential false positives.
- Closes #6896 (`#6896 <https://github.com/PyCQA/pylint/issues/6896>`_)
+ Closes #6896 (`#6896 <https://github.com/pylint-dev/pylint/issues/6896>`_)
- Fix double emitting ``trailing-whitespace`` for multi-line docstrings.
- Closes #6936 (`#6936 <https://github.com/PyCQA/pylint/issues/6936>`_)
+ Closes #6936 (`#6936 <https://github.com/pylint-dev/pylint/issues/6936>`_)
- ``import-error`` now correctly checks for ``contextlib.suppress`` guards on import statements.
- Closes #7270 (`#7270 <https://github.com/PyCQA/pylint/issues/7270>`_)
+ Closes #7270 (`#7270 <https://github.com/pylint-dev/pylint/issues/7270>`_)
- Fix false positive for `no-self-argument`/`no-method-argument` when a staticmethod is applied to a function but uses a different name.
- Closes #7300 (`#7300 <https://github.com/PyCQA/pylint/issues/7300>`_)
+ Closes #7300 (`#7300 <https://github.com/pylint-dev/pylint/issues/7300>`_)
- Fix `undefined-loop-variable` with `break` and `continue` statements in `else` blocks.
- Refs #7311 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_)
+ Refs #7311 (`#7311 <https://github.com/pylint-dev/pylint/issues/7311>`_)
- Improve default TypeVar name regex. Disallow names prefixed with ``T``.
E.g. use ``AnyStrT`` instead of ``TAnyStr``.
- Refs #7322 (`#7322 <https://github.com/PyCQA/pylint/issues/7322>`_`)
+ Refs #7322 (`#7322 <https://github.com/pylint-dev/pylint/issues/7322>`_`)
False Negatives Fixed
@@ -466,32 +466,32 @@ False Negatives Fixed
- Emit ``used-before-assignment`` when relying on a name that is reimported later in a function.
- Closes #4624 (`#4624 <https://github.com/PyCQA/pylint/issues/4624>`_)
+ Closes #4624 (`#4624 <https://github.com/pylint-dev/pylint/issues/4624>`_)
- Emit ``used-before-assignment`` for self-referencing named expressions (``:=``) lacking
prior assignments.
- Closes #5653 (`#5653 <https://github.com/PyCQA/pylint/issues/5653>`_)
+ Closes #5653 (`#5653 <https://github.com/pylint-dev/pylint/issues/5653>`_)
- Emit ``used-before-assignment`` for self-referencing assignments under if conditions.
- Closes #6643 (`#6643 <https://github.com/PyCQA/pylint/issues/6643>`_)
+ Closes #6643 (`#6643 <https://github.com/pylint-dev/pylint/issues/6643>`_)
- Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating
literals, or when using the ``del`` keyword.
- Closes #6648 (`#6648 <https://github.com/PyCQA/pylint/issues/6648>`_)
+ Closes #6648 (`#6648 <https://github.com/pylint-dev/pylint/issues/6648>`_)
- Emit ``used-before-assignment`` when calling nested functions before assignment.
- Closes #6812 (`#6812 <https://github.com/PyCQA/pylint/issues/6812>`_)
+ Closes #6812 (`#6812 <https://github.com/pylint-dev/pylint/issues/6812>`_)
- Emit ``nonlocal-without-binding`` when a nonlocal name has been assigned at a later point in the same scope.
- Closes #6883 (`#6883 <https://github.com/PyCQA/pylint/issues/6883>`_)
+ Closes #6883 (`#6883 <https://github.com/pylint-dev/pylint/issues/6883>`_)
- Emit ``using-constant-test`` when testing the truth value of a variable or call result
holding a generator.
- Closes #6909 (`#6909 <https://github.com/PyCQA/pylint/issues/6909>`_)
+ Closes #6909 (`#6909 <https://github.com/pylint-dev/pylint/issues/6909>`_)
- Rename ``unhashable-dict-key`` to ``unhashable-member`` and emit when creating sets and dicts,
not just when accessing dicts.
- Closes #7034, Closes #7055 (`#7034 <https://github.com/PyCQA/pylint/issues/7034>`_)
+ Closes #7034, Closes #7055 (`#7034 <https://github.com/pylint-dev/pylint/issues/7034>`_)
Other Bug Fixes
@@ -499,30 +499,30 @@ Other Bug Fixes
- Fix a failure to lint packages with ``__init__.py`` contained in directories lacking ``__init__.py``.
- Closes #1667 (`#1667 <https://github.com/PyCQA/pylint/issues/1667>`_)
+ Closes #1667 (`#1667 <https://github.com/pylint-dev/pylint/issues/1667>`_)
- Fixed a syntax-error crash that was not handled properly when the declared encoding of a file
was ``utf-9``.
- Closes #3860 (`#3860 <https://github.com/PyCQA/pylint/issues/3860>`_)
+ Closes #3860 (`#3860 <https://github.com/pylint-dev/pylint/issues/3860>`_)
- Fix a crash in the ``not-callable`` check when there is ambiguity whether an instance is being incorrectly provided to ``__new__()``.
- Closes #7109 (`#7109 <https://github.com/PyCQA/pylint/issues/7109>`_)
+ Closes #7109 (`#7109 <https://github.com/pylint-dev/pylint/issues/7109>`_)
- Fix crash when regex option raises a `re.error` exception.
- Closes #7202 (`#7202 <https://github.com/PyCQA/pylint/issues/7202>`_)
+ Closes #7202 (`#7202 <https://github.com/pylint-dev/pylint/issues/7202>`_)
- Fix `undefined-loop-variable` from walrus in comprehension test.
- Closes #7222 (`#7222 <https://github.com/PyCQA/pylint/issues/7222>`_)
+ Closes #7222 (`#7222 <https://github.com/pylint-dev/pylint/issues/7222>`_)
- Check for `<cwd>` before removing first item from `sys.path` in `modify_sys_path`.
- Closes #7231 (`#7231 <https://github.com/PyCQA/pylint/issues/7231>`_)
+ Closes #7231 (`#7231 <https://github.com/pylint-dev/pylint/issues/7231>`_)
- Fix sys.path pollution in parallel mode.
- Closes #7246 (`#7246 <https://github.com/PyCQA/pylint/issues/7246>`_)
+ Closes #7246 (`#7246 <https://github.com/pylint-dev/pylint/issues/7246>`_)
- Prevent `useless-parent-delegation` for delegating to a builtin
written in C (e.g. `Exception.__init__`) with non-self arguments.
- Closes #7319 (`#7319 <https://github.com/PyCQA/pylint/issues/7319>`_)
+ Closes #7319 (`#7319 <https://github.com/pylint-dev/pylint/issues/7319>`_)
Other Changes
@@ -530,23 +530,23 @@ Other Changes
- ``bad-exception-context`` has been renamed to ``bad-exception-cause`` as it is about the cause and not the context.
- Closes #3694 (`#3694 <https://github.com/PyCQA/pylint/issues/3694>`_)
+ Closes #3694 (`#3694 <https://github.com/pylint-dev/pylint/issues/3694>`_)
- The message for ``literal-comparison`` is now more explicit about the problem and the
solution.
- Closes #5237 (`#5237 <https://github.com/PyCQA/pylint/issues/5237>`_)
+ Closes #5237 (`#5237 <https://github.com/pylint-dev/pylint/issues/5237>`_)
- ``useless-super-delegation`` has been renamed to ``useless-parent-delegation`` in order to be more generic.
- Closes #6953 (`#6953 <https://github.com/PyCQA/pylint/issues/6953>`_)
+ Closes #6953 (`#6953 <https://github.com/pylint-dev/pylint/issues/6953>`_)
- Pylint now uses ``towncrier`` for changelog generation.
- Refs #6974 (`#6974 <https://github.com/PyCQA/pylint/issues/6974>`_)
+ Refs #6974 (`#6974 <https://github.com/pylint-dev/pylint/issues/6974>`_)
- Update ``astroid`` to 2.12.
- Refs #7153 (`#7153 <https://github.com/PyCQA/pylint/issues/7153>`_)
+ Refs #7153 (`#7153 <https://github.com/pylint-dev/pylint/issues/7153>`_)
- Fix crash when a type-annotated `__slots__` with no value is declared.
- Closes #7280 (`#7280 <https://github.com/PyCQA/pylint/issues/7280>`_)
+ Closes #7280 (`#7280 <https://github.com/pylint-dev/pylint/issues/7280>`_)
Internal Changes
@@ -556,17 +556,17 @@ Internal Changes
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 (`#6891 <https://github.com/PyCQA/pylint/issues/6891>`_)
+ Refs #6891 (`#6891 <https://github.com/pylint-dev/pylint/issues/6891>`_)
- ``pylint.testutils.primer`` is now a private API.
- Refs #6905 (`#6905 <https://github.com/PyCQA/pylint/issues/6905>`_)
+ Refs #6905 (`#6905 <https://github.com/pylint-dev/pylint/issues/6905>`_)
- We changed the way we handle the changelog internally by using towncrier.
If you're a contributor you won't have to fix merge conflicts in the
changelog anymore.
- Closes #6974 (`#6974 <https://github.com/PyCQA/pylint/issues/6974>`_)
+ Closes #6974 (`#6974 <https://github.com/pylint-dev/pylint/issues/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 (`#7267 <https://github.com/PyCQA/pylint/issues/7267>`_)
+ Refs #7267 (`#7267 <https://github.com/pylint-dev/pylint/issues/7267>`_)
diff --git a/doc/whatsnew/2/2.16/index.rst b/doc/whatsnew/2/2.16/index.rst
index 605b9b18b..3a9731ce3 100644
--- a/doc/whatsnew/2/2.16/index.rst
+++ b/doc/whatsnew/2/2.16/index.rst
@@ -24,7 +24,7 @@ If you want to benefit from all the new checks load the following plugins::
pylint.extensions.magic_value,
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``
+<https://github.com/pylint-dev/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!
@@ -43,7 +43,7 @@ False Positives Fixed
- Fix false positive for isinstance-second-argument-not-valid-type with union
types.
- Closes #8205 (`#8205 <https://github.com/PyCQA/pylint/issues/8205>`_)
+ Closes #8205 (`#8205 <https://github.com/pylint-dev/pylint/issues/8205>`_)
What's new in Pylint 2.16.3?
@@ -57,7 +57,7 @@ False Positives Fixed
- Fix false positive for ``wrong-spelling-in-comment`` with class names in a
python 2 type comment.
- Closes #8370 (`#8370 <https://github.com/PyCQA/pylint/issues/8370>`_)
+ Closes #8370 (`#8370 <https://github.com/pylint-dev/pylint/issues/8370>`_)
@@ -67,7 +67,7 @@ Other Bug Fixes
- Prevent emitting ``invalid-name`` for the line on which a ``global``
statement is declared.
- Closes #8307 (`#8307 <https://github.com/PyCQA/pylint/issues/8307>`_)
+ Closes #8307 (`#8307 <https://github.com/pylint-dev/pylint/issues/8307>`_)
What's new in Pylint 2.16.2?
@@ -80,7 +80,7 @@ New Features
- Add `--version` option to `pyreverse`.
- Refs #7851 (`#7851 <https://github.com/PyCQA/pylint/issues/7851>`_)
+ Refs #7851 (`#7851 <https://github.com/pylint-dev/pylint/issues/7851>`_)
@@ -90,12 +90,12 @@ False Positives Fixed
- Fix false positive for ``used-before-assignment`` when
``typing.TYPE_CHECKING`` is used with if/elif/else blocks.
- Closes #7574 (`#7574 <https://github.com/PyCQA/pylint/issues/7574>`_)
+ Closes #7574 (`#7574 <https://github.com/pylint-dev/pylint/issues/7574>`_)
- Fix false positive for ``used-before-assignment`` for named expressions
appearing after the first element in a list, tuple, or set.
- Closes #8252 (`#8252 <https://github.com/PyCQA/pylint/issues/8252>`_)
+ Closes #8252 (`#8252 <https://github.com/pylint-dev/pylint/issues/8252>`_)
@@ -105,23 +105,23 @@ Other Bug Fixes
- Fix ``used-before-assignment`` false positive when the walrus operator
is used with a ternary operator in dictionary key/value initialization.
- Closes #8125 (`#8125 <https://github.com/PyCQA/pylint/issues/8125>`_)
+ Closes #8125 (`#8125 <https://github.com/pylint-dev/pylint/issues/8125>`_)
- Fix ``no-name-in-module`` false positive raised when a package defines a
variable with the
same name as one of its submodules.
- Closes #8148 (`#8148 <https://github.com/PyCQA/pylint/issues/8148>`_)
+ Closes #8148 (`#8148 <https://github.com/pylint-dev/pylint/issues/8148>`_)
- Fix ``nested-min-max`` suggestion message to indicate it's possible to splat
iterable objects.
- Closes #8168 (`#8168 <https://github.com/PyCQA/pylint/issues/8168>`_)
+ Closes #8168 (`#8168 <https://github.com/pylint-dev/pylint/issues/8168>`_)
- Fix a crash happening when a class attribute was negated in the start
argument of an enumerate.
- Closes #8207 (`#8207 <https://github.com/PyCQA/pylint/issues/8207>`_)
+ Closes #8207 (`#8207 <https://github.com/pylint-dev/pylint/issues/8207>`_)
What's new in Pylint 2.16.1?
@@ -135,7 +135,7 @@ Other Bug Fixes
- Fix a crash happening for python interpreter < 3.9 following a failed typing
update.
- Closes #8161 (`#8161 <https://github.com/PyCQA/pylint/issues/8161>`_)
+ Closes #8161 (`#8161 <https://github.com/pylint-dev/pylint/issues/8161>`_)
What's new in Pylint 2.16.0?
@@ -156,7 +156,7 @@ Changes requiring user actions
will now have to add ``accept-no-raise-doc=no`` in your configuration to keep
the same behavior.
- Closes #7208 (`#7208 <https://github.com/PyCQA/pylint/issues/7208>`_)
+ Closes #7208 (`#7208 <https://github.com/pylint-dev/pylint/issues/7208>`_)
@@ -167,26 +167,26 @@ New Features
``--output-format=no-header``, it will not include the module name in the
output.
- Closes #5362 (`#5362 <https://github.com/PyCQA/pylint/issues/5362>`_)
+ Closes #5362 (`#5362 <https://github.com/pylint-dev/pylint/issues/5362>`_)
- Added configuration option ``clear-cache-post-run`` to support server-like
usage.
Use this flag if you expect the linted files to be altered between runs.
- Refs #5401 (`#5401 <https://github.com/PyCQA/pylint/issues/5401>`_)
+ Refs #5401 (`#5401 <https://github.com/pylint-dev/pylint/issues/5401>`_)
- Add ``--allow-reexport-from-package`` option to configure the
``useless-import-alias`` check not to emit a warning if a name
is reexported from a package.
- Closes #6006 (`#6006 <https://github.com/PyCQA/pylint/issues/6006>`_)
+ Closes #6006 (`#6006 <https://github.com/pylint-dev/pylint/issues/6006>`_)
- Update ``pyreverse`` to differentiate between aggregations and compositions.
``pyreverse`` checks if it's an Instance or a Call of an object via method
parameters (via type hints)
to decide if it's a composition or an aggregation.
- Refs #6543 (`#6543 <https://github.com/PyCQA/pylint/issues/6543>`_)
+ Refs #6543 (`#6543 <https://github.com/pylint-dev/pylint/issues/6543>`_)
@@ -196,23 +196,23 @@ New Checks
- Adds a ``pointless-exception-statement`` check that emits a warning when an
Exception is created and not assigned, raised or returned.
- Refs #3110 (`#3110 <https://github.com/PyCQA/pylint/issues/3110>`_)
+ Refs #3110 (`#3110 <https://github.com/pylint-dev/pylint/issues/3110>`_)
- Add a ``shadowed-import`` message for aliased imports.
- Closes #4836 (`#4836 <https://github.com/PyCQA/pylint/issues/4836>`_)
+ Closes #4836 (`#4836 <https://github.com/pylint-dev/pylint/issues/4836>`_)
- Add new check called ``unbalanced-dict-unpacking`` to check for unbalanced
dict unpacking
in assignment and for loops.
- Closes #5797 (`#5797 <https://github.com/PyCQA/pylint/issues/5797>`_)
+ Closes #5797 (`#5797 <https://github.com/pylint-dev/pylint/issues/5797>`_)
- Add new checker ``positional-only-arguments-expected`` to check for cases
when
positional-only arguments have been passed as keyword arguments.
- Closes #6489 (`#6489 <https://github.com/PyCQA/pylint/issues/6489>`_)
+ Closes #6489 (`#6489 <https://github.com/pylint-dev/pylint/issues/6489>`_)
- Added ``singledispatch-method`` which informs that ``@singledispatch`` should
decorate functions and not class/instance methods.
@@ -220,42 +220,42 @@ New Checks
``@singledispatchmethod`` should decorate class/instance methods and not
functions.
- Closes #6917 (`#6917 <https://github.com/PyCQA/pylint/issues/6917>`_)
+ Closes #6917 (`#6917 <https://github.com/pylint-dev/pylint/issues/6917>`_)
- Rename ``broad-except`` to ``broad-exception-caught`` and add new checker
``broad-exception-raised``
which will warn if general exceptions ``BaseException`` or ``Exception`` are
raised.
- Closes #7494 (`#7494 <https://github.com/PyCQA/pylint/issues/7494>`_)
+ Closes #7494 (`#7494 <https://github.com/pylint-dev/pylint/issues/7494>`_)
- Added ``nested-min-max`` which flags ``min(1, min(2, 3))`` to simplify to
``min(1, 2, 3)``.
- Closes #7546 (`#7546 <https://github.com/PyCQA/pylint/issues/7546>`_)
+ Closes #7546 (`#7546 <https://github.com/pylint-dev/pylint/issues/7546>`_)
- Extended ``use-dict-literal`` to also warn about call to ``dict()`` when
passing keyword arguments.
- Closes #7690 (`#7690 <https://github.com/PyCQA/pylint/issues/7690>`_)
+ Closes #7690 (`#7690 <https://github.com/pylint-dev/pylint/issues/7690>`_)
- Add ``named-expr-without-context`` check to emit a warning if a named
expression is used outside a context like ``if``, ``for``, ``while``, or
a comprehension.
- Refs #7760 (`#7760 <https://github.com/PyCQA/pylint/issues/7760>`_)
+ Refs #7760 (`#7760 <https://github.com/pylint-dev/pylint/issues/7760>`_)
- Add ``invalid-slice-step`` check to warn about a slice step value of ``0``
for common builtin sequences.
- Refs #7762 (`#7762 <https://github.com/PyCQA/pylint/issues/7762>`_)
+ Refs #7762 (`#7762 <https://github.com/pylint-dev/pylint/issues/7762>`_)
- Add ``consider-refactoring-into-while-condition`` check to recommend
refactoring when
a while loop is defined with a constant condition with an immediate ``if``
statement to check for ``break`` condition as a first statement.
- Closes #8015 (`#8015 <https://github.com/PyCQA/pylint/issues/8015>`_)
+ Closes #8015 (`#8015 <https://github.com/pylint-dev/pylint/issues/8015>`_)
@@ -266,13 +266,13 @@ Extensions
dictionary immediately
after the dictionary was created.
- Closes #2876 (`#2876 <https://github.com/PyCQA/pylint/issues/2876>`_)
+ Closes #2876 (`#2876 <https://github.com/pylint-dev/pylint/issues/2876>`_)
- Added ``bad-dunder-name`` extension check, which flags bad or misspelled
dunder methods.
You can use the ``good-dunder-names`` option to allow specific dunder names.
- Closes #3038 (`#3038 <https://github.com/PyCQA/pylint/issues/3038>`_)
+ Closes #3038 (`#3038 <https://github.com/pylint-dev/pylint/issues/3038>`_)
- Added ``consider-using-augmented-assign`` check for ``CodeStyle`` extension
which flags ``x = x + 1`` to simplify to ``x += 1``.
@@ -280,20 +280,20 @@ Extensions
with ``load-plugins=pylint.extensions.code_style`` and add
``consider-using-augmented-assign`` in the ``enable`` option.
- Closes #3391 (`#3391 <https://github.com/PyCQA/pylint/issues/3391>`_)
+ Closes #3391 (`#3391 <https://github.com/pylint-dev/pylint/issues/3391>`_)
- Add ``magic-number`` plugin checker for comparison with constants instead of
named constants or enums.
You can use it with ``--load-plugins=pylint.extensions.magic_value``.
- Closes #7281 (`#7281 <https://github.com/PyCQA/pylint/issues/7281>`_)
+ Closes #7281 (`#7281 <https://github.com/pylint-dev/pylint/issues/7281>`_)
- Add ``redundant-typehint-argument`` message for `typing` plugin for duplicate
assign typehints.
Enable the plugin to enable the message with:
``--load-plugins=pylint.extensions.typing``.
- Closes #7636 (`#7636 <https://github.com/PyCQA/pylint/issues/7636>`_)
+ Closes #7636 (`#7636 <https://github.com/pylint-dev/pylint/issues/7636>`_)
@@ -303,160 +303,160 @@ False Positives Fixed
- Fix false positive for ``unused-variable`` and ``unused-import`` when a name
is only used in a string literal type annotation.
- Closes #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_)
+ Closes #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_)
- Document a known false positive for ``useless-suppression`` when disabling
``line-too-long`` in a module with only comments and no code.
- Closes #3368 (`#3368 <https://github.com/PyCQA/pylint/issues/3368>`_)
+ Closes #3368 (`#3368 <https://github.com/pylint-dev/pylint/issues/3368>`_)
- ``trailing-whitespaces`` is no longer reported within strings.
- Closes #3822 (`#3822 <https://github.com/PyCQA/pylint/issues/3822>`_)
+ Closes #3822 (`#3822 <https://github.com/pylint-dev/pylint/issues/3822>`_)
- Fix false positive for ``global-variable-not-assigned`` when a global
variable is re-assigned via an ``ImportFrom`` node.
- Closes #4809 (`#4809 <https://github.com/PyCQA/pylint/issues/4809>`_)
+ Closes #4809 (`#4809 <https://github.com/pylint-dev/pylint/issues/4809>`_)
- Fix false positive for ``use-maxsplit-arg`` with custom split method.
- Closes #4857 (`#4857 <https://github.com/PyCQA/pylint/issues/4857>`_)
+ Closes #4857 (`#4857 <https://github.com/pylint-dev/pylint/issues/4857>`_)
- Fix ``logging-fstring-interpolation`` false positive raised when logging and
f-string with ``%s`` formatting.
- Closes #4984 (`#4984 <https://github.com/PyCQA/pylint/issues/4984>`_)
+ Closes #4984 (`#4984 <https://github.com/pylint-dev/pylint/issues/4984>`_)
- Fix false-positive for ``used-before-assignment`` in pattern matching
with a guard.
- Closes #5327 (`#5327 <https://github.com/PyCQA/pylint/issues/5327>`_)
+ Closes #5327 (`#5327 <https://github.com/pylint-dev/pylint/issues/5327>`_)
- Fix ``use-sequence-for-iteration`` when unpacking a set with ``*``.
- Closes #5788 (`#5788 <https://github.com/PyCQA/pylint/issues/5788>`_)
+ Closes #5788 (`#5788 <https://github.com/pylint-dev/pylint/issues/5788>`_)
- Fix ``deprecated-method`` false positive when alias for method is similar to
name of deprecated method.
- Closes #5886 (`#5886 <https://github.com/PyCQA/pylint/issues/5886>`_)
+ Closes #5886 (`#5886 <https://github.com/pylint-dev/pylint/issues/5886>`_)
- Fix false positive ``assigning-non-slot`` when a class attribute is
re-assigned.
- Closes #6001 (`#6001 <https://github.com/PyCQA/pylint/issues/6001>`_)
+ Closes #6001 (`#6001 <https://github.com/pylint-dev/pylint/issues/6001>`_)
- 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 (`#6592 <https://github.com/PyCQA/pylint/issues/6592>`_)
+ Closes #6592 (`#6592 <https://github.com/pylint-dev/pylint/issues/6592>`_)
- Fixes false positive ``abstract-method`` on Protocol classes.
- Closes #7209 (`#7209 <https://github.com/PyCQA/pylint/issues/7209>`_)
+ Closes #7209 (`#7209 <https://github.com/pylint-dev/pylint/issues/7209>`_)
- Pylint now understands the ``kw_only`` keyword argument for ``dataclass``.
Closes #7290, closes #6550, closes #5857 (`#7290
- <https://github.com/PyCQA/pylint/issues/7290>`_)
+ <https://github.com/pylint-dev/pylint/issues/7290>`_)
- 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 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_)
+ Closes #7311 (`#7311 <https://github.com/pylint-dev/pylint/issues/7311>`_)
- Fix ``used-before-assignment`` for functions/classes defined in type checking
guard.
- Closes #7368 (`#7368 <https://github.com/PyCQA/pylint/issues/7368>`_)
+ Closes #7368 (`#7368 <https://github.com/pylint-dev/pylint/issues/7368>`_)
- Fix false positive for ``unhashable-member`` when subclassing ``dict`` and
using the subclass as a dictionary key.
- Closes #7501 (`#7501 <https://github.com/PyCQA/pylint/issues/7501>`_)
+ Closes #7501 (`#7501 <https://github.com/pylint-dev/pylint/issues/7501>`_)
- Fix the message for ``unnecessary-dunder-call`` for ``__aiter__`` and
``__aneext__``. Also
only emit the warning when ``py-version`` >= 3.10.
- Closes #7529 (`#7529 <https://github.com/PyCQA/pylint/issues/7529>`_)
+ Closes #7529 (`#7529 <https://github.com/pylint-dev/pylint/issues/7529>`_)
- Fix ``used-before-assignment`` false positive when else branch calls
``sys.exit`` or similar terminating functions.
- Closes #7563 (`#7563 <https://github.com/PyCQA/pylint/issues/7563>`_)
+ Closes #7563 (`#7563 <https://github.com/pylint-dev/pylint/issues/7563>`_)
- Fix a false positive for ``used-before-assignment`` for imports guarded by
``typing.TYPE_CHECKING`` later used in variable annotations.
- Closes #7609 (`#7609 <https://github.com/PyCQA/pylint/issues/7609>`_)
+ Closes #7609 (`#7609 <https://github.com/pylint-dev/pylint/issues/7609>`_)
- Fix a false positive for ``simplify-boolean-expression`` when multiple values
are inferred for a constant.
- Closes #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_)
+ Closes #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_)
- ``unnecessary-list-index-lookup`` will not be wrongly emitted if
``enumerate`` is called with ``start``.
- Closes #7682 (`#7682 <https://github.com/PyCQA/pylint/issues/7682>`_)
+ Closes #7682 (`#7682 <https://github.com/pylint-dev/pylint/issues/7682>`_)
- Don't warn about ``stop-iteration-return`` when using ``next()`` over
``itertools.cycle``.
- Closes #7765 (`#7765 <https://github.com/PyCQA/pylint/issues/7765>`_)
+ Closes #7765 (`#7765 <https://github.com/pylint-dev/pylint/issues/7765>`_)
- Fixes ``used-before-assignment`` false positive when the walrus operator
is used in a ternary operator.
- Closes #7779 (`#7779 <https://github.com/PyCQA/pylint/issues/7779>`_)
+ Closes #7779 (`#7779 <https://github.com/pylint-dev/pylint/issues/7779>`_)
- Fix ``missing-param-doc`` false positive when function parameter has an
escaped underscore.
- Closes #7827 (`#7827 <https://github.com/PyCQA/pylint/issues/7827>`_)
+ Closes #7827 (`#7827 <https://github.com/pylint-dev/pylint/issues/7827>`_)
- Fixes ``method-cache-max-size-none`` false positive for methods inheriting
from ``Enum``.
- Closes #7857 (`#7857 <https://github.com/PyCQA/pylint/issues/7857>`_)
+ Closes #7857 (`#7857 <https://github.com/pylint-dev/pylint/issues/7857>`_)
- ``multiple-statements`` no longer triggers for function stubs using inlined
``...``.
- Closes #7860 (`#7860 <https://github.com/PyCQA/pylint/issues/7860>`_)
+ Closes #7860 (`#7860 <https://github.com/pylint-dev/pylint/issues/7860>`_)
- Fix a false positive for ``used-before-assignment`` when a name guarded by
``if TYPE_CHECKING:`` is used as a type annotation in a function body and
later re-imported in the same scope.
- Closes #7882 (`#7882 <https://github.com/PyCQA/pylint/issues/7882>`_)
+ Closes #7882 (`#7882 <https://github.com/pylint-dev/pylint/issues/7882>`_)
- Prevent ``used-before-assignment`` when imports guarded by ``if
TYPE_CHECKING``
are guarded again when used.
- Closes #7979 (`#7979 <https://github.com/PyCQA/pylint/issues/7979>`_)
+ Closes #7979 (`#7979 <https://github.com/pylint-dev/pylint/issues/7979>`_)
- Fixes false positive for ``try-except-raise`` with multiple exceptions in one
except statement if exception are in different namespace.
- Closes #8051 (`#8051 <https://github.com/PyCQA/pylint/issues/8051>`_)
+ Closes #8051 (`#8051 <https://github.com/pylint-dev/pylint/issues/8051>`_)
- Fix ``invalid-name`` errors for ``typing_extension.TypeVar``.
- Refs #8089 (`#8089 <https://github.com/PyCQA/pylint/issues/8089>`_)
+ Refs #8089 (`#8089 <https://github.com/pylint-dev/pylint/issues/8089>`_)
- Fix ``no-kwoa`` false positive for context managers.
- Closes #8100 (`#8100 <https://github.com/PyCQA/pylint/issues/8100>`_)
+ Closes #8100 (`#8100 <https://github.com/pylint-dev/pylint/issues/8100>`_)
- Fix a false positive for ``redefined-variable-type`` when ``async`` methods
are present.
- Closes #8120 (`#8120 <https://github.com/PyCQA/pylint/issues/8120>`_)
+ Closes #8120 (`#8120 <https://github.com/pylint-dev/pylint/issues/8120>`_)
@@ -466,31 +466,31 @@ False Negatives Fixed
- Code following a call to ``quit``, ``exit``, ``sys.exit`` or ``os._exit``
will be marked as `unreachable`.
- Refs #519 (`#519 <https://github.com/PyCQA/pylint/issues/519>`_)
+ Refs #519 (`#519 <https://github.com/pylint-dev/pylint/issues/519>`_)
- Emit ``used-before-assignment`` when function arguments are redefined inside
an inner function and accessed there before assignment.
- Closes #2374 (`#2374 <https://github.com/PyCQA/pylint/issues/2374>`_)
+ Closes #2374 (`#2374 <https://github.com/pylint-dev/pylint/issues/2374>`_)
- Fix a false negative for ``unused-import`` when one module used an import in
a type annotation that was also used in another module.
- Closes #4150 (`#4150 <https://github.com/PyCQA/pylint/issues/4150>`_)
+ Closes #4150 (`#4150 <https://github.com/pylint-dev/pylint/issues/4150>`_)
- Flag ``superfluous-parens`` if parentheses are used during string
concatenation.
- Closes #4792 (`#4792 <https://github.com/PyCQA/pylint/issues/4792>`_)
+ Closes #4792 (`#4792 <https://github.com/pylint-dev/pylint/issues/4792>`_)
- Emit ``used-before-assignment`` when relying on names only defined under
conditions always testing false.
- Closes #4913 (`#4913 <https://github.com/PyCQA/pylint/issues/4913>`_)
+ Closes #4913 (`#4913 <https://github.com/pylint-dev/pylint/issues/4913>`_)
- ``consider-using-join`` can now be emitted for non-empty string separators.
- Closes #6639 (`#6639 <https://github.com/PyCQA/pylint/issues/6639>`_)
+ Closes #6639 (`#6639 <https://github.com/pylint-dev/pylint/issues/6639>`_)
- Emit ``used-before-assignment`` for further imports guarded by
``TYPE_CHECKING``
@@ -500,40 +500,40 @@ False Negatives Fixed
``TYPE_CHECKING``
was imported from ``typing`` under an alias.
- Closes #7539 (`#7539 <https://github.com/PyCQA/pylint/issues/7539>`_)
+ Closes #7539 (`#7539 <https://github.com/pylint-dev/pylint/issues/7539>`_)
- Fix a false negative for ``unused-import`` when a constant inside
``typing.Annotated`` was treated as a reference to an import.
- Closes #7547 (`#7547 <https://github.com/PyCQA/pylint/issues/7547>`_)
+ Closes #7547 (`#7547 <https://github.com/pylint-dev/pylint/issues/7547>`_)
- ``consider-using-any-or-all`` message will now be raised in cases when
boolean is initialized, reassigned during loop, and immediately returned.
- Closes #7699 (`#7699 <https://github.com/PyCQA/pylint/issues/7699>`_)
+ Closes #7699 (`#7699 <https://github.com/pylint-dev/pylint/issues/7699>`_)
- Extend ``invalid-slice-index`` to emit an warning for invalid slice indices
used with string and byte sequences, and range objects.
- Refs #7762 (`#7762 <https://github.com/PyCQA/pylint/issues/7762>`_)
+ Refs #7762 (`#7762 <https://github.com/pylint-dev/pylint/issues/7762>`_)
- Fixes ``unnecessary-list-index-lookup`` false negative when ``enumerate`` is
called with ``iterable`` as a kwarg.
- Closes #7770 (`#7770 <https://github.com/PyCQA/pylint/issues/7770>`_)
+ Closes #7770 (`#7770 <https://github.com/pylint-dev/pylint/issues/7770>`_)
- ``no-else-return`` or ``no-else-raise`` will be emitted if ``except`` block
always returns or raises.
- Closes #7788 (`#7788 <https://github.com/PyCQA/pylint/issues/7788>`_)
+ Closes #7788 (`#7788 <https://github.com/pylint-dev/pylint/issues/7788>`_)
- Fix ``dangerous-default-value`` false negative when ``*`` is used.
- Closes #7818 (`#7818 <https://github.com/PyCQA/pylint/issues/7818>`_)
+ Closes #7818 (`#7818 <https://github.com/pylint-dev/pylint/issues/7818>`_)
- ``consider-using-with`` now triggers for ``pathlib.Path.open``.
- Closes #7964 (`#7964 <https://github.com/PyCQA/pylint/issues/7964>`_)
+ Closes #7964 (`#7964 <https://github.com/pylint-dev/pylint/issues/7964>`_)
@@ -542,81 +542,81 @@ Other Bug Fixes
- Fix bug in detecting ``unused-variable`` when iterating on variable.
- Closes #3044 (`#3044 <https://github.com/PyCQA/pylint/issues/3044>`_)
+ Closes #3044 (`#3044 <https://github.com/pylint-dev/pylint/issues/3044>`_)
- 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 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_)
+ Refs #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_)
- Update ``disallowed-name`` check to flag module-level variables.
- Closes #3701 (`#3701 <https://github.com/PyCQA/pylint/issues/3701>`_)
+ Closes #3701 (`#3701 <https://github.com/pylint-dev/pylint/issues/3701>`_)
- Pylint will no longer deadlock if a parallel job is killed but fail
immediately instead.
- Closes #3899 (`#3899 <https://github.com/PyCQA/pylint/issues/3899>`_)
+ Closes #3899 (`#3899 <https://github.com/pylint-dev/pylint/issues/3899>`_)
- Fix ignored files being linted when passed on stdin.
- Closes #4354 (`#4354 <https://github.com/PyCQA/pylint/issues/4354>`_)
+ Closes #4354 (`#4354 <https://github.com/pylint-dev/pylint/issues/4354>`_)
- Fix ``no-member`` false negative when augmented assign is done manually,
without ``+=``.
- Closes #4562 (`#4562 <https://github.com/PyCQA/pylint/issues/4562>`_)
+ Closes #4562 (`#4562 <https://github.com/pylint-dev/pylint/issues/4562>`_)
- Any assertion on a populated tuple will now receive a ``assert-on-tuple``
warning.
- Closes #4655 (`#4655 <https://github.com/PyCQA/pylint/issues/4655>`_)
+ Closes #4655 (`#4655 <https://github.com/pylint-dev/pylint/issues/4655>`_)
- ``missing-return-doc``, ``missing-raises-doc`` and ``missing-yields-doc`` now
respect
the ``no-docstring-rgx`` option.
- Closes #4743 (`#4743 <https://github.com/PyCQA/pylint/issues/4743>`_)
+ Closes #4743 (`#4743 <https://github.com/pylint-dev/pylint/issues/4743>`_)
- Update ``reimported`` help message for clarity.
- Closes #4836 (`#4836 <https://github.com/PyCQA/pylint/issues/4836>`_)
+ Closes #4836 (`#4836 <https://github.com/pylint-dev/pylint/issues/4836>`_)
- ``consider-iterating-dictionary`` will no longer be raised if bitwise
operations are used.
- Closes #5478 (`#5478 <https://github.com/PyCQA/pylint/issues/5478>`_)
+ Closes #5478 (`#5478 <https://github.com/pylint-dev/pylint/issues/5478>`_)
- Using custom braces in ``msg-template`` will now work properly.
- Closes #5636 (`#5636 <https://github.com/PyCQA/pylint/issues/5636>`_)
+ Closes #5636 (`#5636 <https://github.com/pylint-dev/pylint/issues/5636>`_)
- 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 (`#6242 <https://github.com/PyCQA/pylint/issues/6242>`_)
+ Closes #6242, #4053 (`#6242 <https://github.com/pylint-dev/pylint/issues/6242>`_)
- Remove ``__index__`` dunder method call from ``unnecessary-dunder-call``
check.
- Closes #6795 (`#6795 <https://github.com/PyCQA/pylint/issues/6795>`_)
+ Closes #6795 (`#6795 <https://github.com/pylint-dev/pylint/issues/6795>`_)
- Fixed handling of ``--`` as separator between positional arguments and flags.
This was not actually fixed in 2.14.5.
Closes #7003, Refs #7096 (`#7003
- <https://github.com/PyCQA/pylint/issues/7003>`_)
+ <https://github.com/pylint-dev/pylint/issues/7003>`_)
- Don't crash on ``OSError`` in config file discovery.
- Closes #7169 (`#7169 <https://github.com/PyCQA/pylint/issues/7169>`_)
+ Closes #7169 (`#7169 <https://github.com/pylint-dev/pylint/issues/7169>`_)
- Messages sent to reporter are now copied so a reporter cannot modify the
message sent to other reporters.
- Closes #7214 (`#7214 <https://github.com/PyCQA/pylint/issues/7214>`_)
+ Closes #7214 (`#7214 <https://github.com/pylint-dev/pylint/issues/7214>`_)
- Fixed a case where custom plugins specified by command line could silently
fail.
@@ -628,85 +628,85 @@ Other Bug Fixes
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. (`#7264 <https://github.com/PyCQA/pylint/issues/7264>`_)
+ Fixes part of #7264. (`#7264 <https://github.com/pylint-dev/pylint/issues/7264>`_)
- Update ``modified_iterating`` checker to fix a crash with ``for`` loops on
empty list.
- Closes #7380 (`#7380 <https://github.com/PyCQA/pylint/issues/7380>`_)
+ Closes #7380 (`#7380 <https://github.com/pylint-dev/pylint/issues/7380>`_)
- Update wording for ``arguments-differ`` and ``arguments-renamed`` to clarify
overriding object.
- Closes #7390 (`#7390 <https://github.com/PyCQA/pylint/issues/7390>`_)
+ Closes #7390 (`#7390 <https://github.com/pylint-dev/pylint/issues/7390>`_)
- ``disable-next`` is now correctly scoped to only the succeeding line.
- Closes #7401 (`#7401 <https://github.com/PyCQA/pylint/issues/7401>`_)
+ Closes #7401 (`#7401 <https://github.com/pylint-dev/pylint/issues/7401>`_)
- Fixed a crash in the ``unhashable-member`` checker when using a ``lambda`` as
a dict key.
- Closes #7453 (`#7453 <https://github.com/PyCQA/pylint/issues/7453>`_)
+ Closes #7453 (`#7453 <https://github.com/pylint-dev/pylint/issues/7453>`_)
- Add ``mailcap`` to deprecated modules list.
- Closes #7457 (`#7457 <https://github.com/PyCQA/pylint/issues/7457>`_)
+ Closes #7457 (`#7457 <https://github.com/pylint-dev/pylint/issues/7457>`_)
- Fix a crash in the ``modified-iterating-dict`` checker involving instance
attributes.
- Closes #7461 (`#7461 <https://github.com/PyCQA/pylint/issues/7461>`_)
+ Closes #7461 (`#7461 <https://github.com/pylint-dev/pylint/issues/7461>`_)
- ``invalid-class-object`` does not crash anymore when ``__class__`` is
assigned alongside another variable.
- Closes #7467 (`#7467 <https://github.com/PyCQA/pylint/issues/7467>`_)
+ Closes #7467 (`#7467 <https://github.com/pylint-dev/pylint/issues/7467>`_)
- ``--help-msg`` now accepts a comma-separated list of message IDs again.
- Closes #7471 (`#7471 <https://github.com/PyCQA/pylint/issues/7471>`_)
+ Closes #7471 (`#7471 <https://github.com/pylint-dev/pylint/issues/7471>`_)
- Allow specifying non-builtin exceptions in the ``overgeneral-exception``
option
using an exception's qualified name.
- Closes #7495 (`#7495 <https://github.com/PyCQA/pylint/issues/7495>`_)
+ Closes #7495 (`#7495 <https://github.com/pylint-dev/pylint/issues/7495>`_)
- Report ``no-self-argument`` rather than ``no-method-argument`` for methods
with variadic arguments.
- Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_)
+ Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_)
- Fixed an issue where ``syntax-error`` couldn't be raised on files with
invalid encodings.
- Closes #7522 (`#7522 <https://github.com/PyCQA/pylint/issues/7522>`_)
+ Closes #7522 (`#7522 <https://github.com/pylint-dev/pylint/issues/7522>`_)
- Fix false positive for ``redefined-outer-name`` when aliasing ``typing``
e.g. as ``t`` and guarding imports under ``t.TYPE_CHECKING``.
- Closes #7524 (`#7524 <https://github.com/PyCQA/pylint/issues/7524>`_)
+ Closes #7524 (`#7524 <https://github.com/pylint-dev/pylint/issues/7524>`_)
- Fixed a crash of the ``modified_iterating`` checker when iterating on a set
defined as a class attribute.
- Closes #7528 (`#7528 <https://github.com/PyCQA/pylint/issues/7528>`_)
+ Closes #7528 (`#7528 <https://github.com/pylint-dev/pylint/issues/7528>`_)
- Use ``py-version`` to determine if a message should be emitted for messages
defined with ``max-version`` or ``min-version``.
- Closes #7569 (`#7569 <https://github.com/PyCQA/pylint/issues/7569>`_)
+ Closes #7569 (`#7569 <https://github.com/pylint-dev/pylint/issues/7569>`_)
- Improve ``bad-thread-instantiation`` check to warn if ``target`` is not
passed in as a keyword argument
or as a second argument.
- Closes #7570 (`#7570 <https://github.com/PyCQA/pylint/issues/7570>`_)
+ Closes #7570 (`#7570 <https://github.com/pylint-dev/pylint/issues/7570>`_)
- Fixes edge case of custom method named ``next`` raised an astroid error.
- Closes #7610 (`#7610 <https://github.com/PyCQA/pylint/issues/7610>`_)
+ Closes #7610 (`#7610 <https://github.com/pylint-dev/pylint/issues/7610>`_)
- Fixed a multi-processing crash that prevents using any more than 1 thread on
MacOS.
@@ -717,56 +717,56 @@ Other Bug Fixes
when
attempting to serialise the linter object for multi-processing use.
- Closes #7635. (`#7635 <https://github.com/PyCQA/pylint/issues/7635>`_)
+ Closes #7635. (`#7635 <https://github.com/pylint-dev/pylint/issues/7635>`_)
- Fix crash that happened when parsing files with unexpected encoding starting
with 'utf' like ``utf13``.
- Closes #7661 (`#7661 <https://github.com/PyCQA/pylint/issues/7661>`_)
+ Closes #7661 (`#7661 <https://github.com/pylint-dev/pylint/issues/7661>`_)
- Fix a crash when a child class with an ``__init__`` method inherits from a
parent class with an ``__init__`` class attribute.
- Closes #7742 (`#7742 <https://github.com/PyCQA/pylint/issues/7742>`_)
+ Closes #7742 (`#7742 <https://github.com/pylint-dev/pylint/issues/7742>`_)
- Fix ``valid-metaclass-classmethod-first-arg`` default config value from "cls"
to "mcs"
which would cause both a false-positive and false-negative.
- Closes #7782 (`#7782 <https://github.com/PyCQA/pylint/issues/7782>`_)
+ Closes #7782 (`#7782 <https://github.com/pylint-dev/pylint/issues/7782>`_)
- Fixes a crash in the ``unnecessary_list_index_lookup`` check when using
``enumerate`` with ``start`` and a class attribute.
- Closes #7821 (`#7821 <https://github.com/PyCQA/pylint/issues/7821>`_)
+ Closes #7821 (`#7821 <https://github.com/pylint-dev/pylint/issues/7821>`_)
- Fixes a crash in ``stop-iteration-return`` when the ``next`` builtin is
called without arguments.
- Closes #7828 (`#7828 <https://github.com/PyCQA/pylint/issues/7828>`_)
+ Closes #7828 (`#7828 <https://github.com/pylint-dev/pylint/issues/7828>`_)
- When pylint exit due to bad arguments being provided the exit code will now
be the expected ``32``.
- Refs #7931 (`#7931 <https://github.com/PyCQA/pylint/issues/7931>`_)
+ Refs #7931 (`#7931 <https://github.com/pylint-dev/pylint/issues/7931>`_)
- Fixes a ``ModuleNotFound`` exception when running pylint on a Django project
with the ``pylint_django`` plugin enabled.
- Closes #7938 (`#7938 <https://github.com/PyCQA/pylint/issues/7938>`_)
+ Closes #7938 (`#7938 <https://github.com/pylint-dev/pylint/issues/7938>`_)
- Fixed a crash when inferring a value and using its qname on a slice that was
being incorrectly called.
- Closes #8067 (`#8067 <https://github.com/PyCQA/pylint/issues/8067>`_)
+ Closes #8067 (`#8067 <https://github.com/pylint-dev/pylint/issues/8067>`_)
- Use better regex to check for private attributes.
- Refs #8081 (`#8081 <https://github.com/PyCQA/pylint/issues/8081>`_)
+ Refs #8081 (`#8081 <https://github.com/pylint-dev/pylint/issues/8081>`_)
- Fix issue with new typing Union syntax in runtime context for Python 3.10+.
- Closes #8119 (`#8119 <https://github.com/PyCQA/pylint/issues/8119>`_)
+ Closes #8119 (`#8119 <https://github.com/pylint-dev/pylint/issues/8119>`_)
@@ -775,55 +775,55 @@ Other Changes
- Pylint now provides basic support for Python 3.11.
- Closes #5920 (`#5920 <https://github.com/PyCQA/pylint/issues/5920>`_)
+ Closes #5920 (`#5920 <https://github.com/pylint-dev/pylint/issues/5920>`_)
- Update message for ``abstract-method`` to include child class name.
- Closes #7124 (`#7124 <https://github.com/PyCQA/pylint/issues/7124>`_)
+ Closes #7124 (`#7124 <https://github.com/pylint-dev/pylint/issues/7124>`_)
- Update Pyreverse's dot and plantuml printers to detect when class methods are
abstract and show them with italic font.
For the dot printer update the label to use html-like syntax.
- Closes #7346 (`#7346 <https://github.com/PyCQA/pylint/issues/7346>`_)
+ Closes #7346 (`#7346 <https://github.com/pylint-dev/pylint/issues/7346>`_)
- The ``docparams`` extension now considers typing in Numpy style docstrings
as "documentation" for the ``missing-param-doc`` message.
- Refs #7398 (`#7398 <https://github.com/PyCQA/pylint/issues/7398>`_)
+ Refs #7398 (`#7398 <https://github.com/pylint-dev/pylint/issues/7398>`_)
- Relevant ``DeprecationWarnings`` are now raised with ``stacklevel=2``, so
they have the callsite attached in the message.
- Closes #7463 (`#7463 <https://github.com/PyCQA/pylint/issues/7463>`_)
+ Closes #7463 (`#7463 <https://github.com/pylint-dev/pylint/issues/7463>`_)
- Add a ``minimal`` option to ``pylint-config`` and its toml generator.
- Closes #7485 (`#7485 <https://github.com/PyCQA/pylint/issues/7485>`_)
+ Closes #7485 (`#7485 <https://github.com/pylint-dev/pylint/issues/7485>`_)
- Add method name to the error messages of ``no-method-argument`` and
``no-self-argument``.
- Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_)
+ Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_)
- Prevent leaving the pip install cache in the Docker image.
- Refs #7544 (`#7544 <https://github.com/PyCQA/pylint/issues/7544>`_)
+ Refs #7544 (`#7544 <https://github.com/pylint-dev/pylint/issues/7544>`_)
- Add a keyword-only ``compare_constants`` argument to ``safe_infer``.
- Refs #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_)
+ Refs #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_)
- Add ``default_enabled`` option to optional message dict. Provides an option
to disable a checker message by default.
To use a disabled message, the user must enable it explicitly by adding the
message to the ``enable`` option.
- Refs #7629 (`#7629 <https://github.com/PyCQA/pylint/issues/7629>`_)
+ Refs #7629 (`#7629 <https://github.com/pylint-dev/pylint/issues/7629>`_)
- Sort ``--generated-rcfile`` output.
- Refs #7655 (`#7655 <https://github.com/PyCQA/pylint/issues/7655>`_)
+ Refs #7655 (`#7655 <https://github.com/pylint-dev/pylint/issues/7655>`_)
- epylint is now deprecated and will be removed in pylint 3.0.0. All emacs and
flymake related
@@ -831,11 +831,11 @@ Other Changes
repository :
https://github.com/emacsorphanage/pylint.
- Closes #7737 (`#7737 <https://github.com/PyCQA/pylint/issues/7737>`_)
+ Closes #7737 (`#7737 <https://github.com/pylint-dev/pylint/issues/7737>`_)
- Adds test for existing preferred-modules configuration functionality.
- Refs #7957 (`#7957 <https://github.com/PyCQA/pylint/issues/7957>`_)
+ Refs #7957 (`#7957 <https://github.com/pylint-dev/pylint/issues/7957>`_)
@@ -850,4 +850,4 @@ Internal Changes
the path in this way, this is now the last bit of work needed to close Github
issue #7264.
- Closes #7264 (`#7264 <https://github.com/PyCQA/pylint/issues/7264>`_)
+ Closes #7264 (`#7264 <https://github.com/pylint-dev/pylint/issues/7264>`_)
diff --git a/doc/whatsnew/2/2.17/index.rst b/doc/whatsnew/2/2.17/index.rst
index cd14488b7..9c5323b18 100644
--- a/doc/whatsnew/2/2.17/index.rst
+++ b/doc/whatsnew/2/2.17/index.rst
@@ -166,7 +166,7 @@ False Positives Fixed
``attribute-defined-outside-init`` warning when using
``unittest.IsolatedAsyncioTestCase``.
- Refs #8403 (`#8403 <https://github.com/PyCQA/pylint/issues/8403>`_)
+ Refs #8403 (`#8403 <https://github.com/pylint-dev/pylint/issues/8403>`_)
@@ -176,16 +176,16 @@ Other Bug Fixes
- ``--clear-cache-post-run`` now also clears LRU caches for pylint utilities
holding references to AST nodes.
- Closes #8361 (`#8361 <https://github.com/PyCQA/pylint/issues/8361>`_)
+ Closes #8361 (`#8361 <https://github.com/pylint-dev/pylint/issues/8361>`_)
- Fix a crash when ``TYPE_CHECKING`` is used without importing it.
- Closes #8434 (`#8434 <https://github.com/PyCQA/pylint/issues/8434>`_)
+ Closes #8434 (`#8434 <https://github.com/pylint-dev/pylint/issues/8434>`_)
- Fix a regression of ``preferred-modules`` where a partial match was used
instead of the required full match.
- Closes #8453 (`#8453 <https://github.com/PyCQA/pylint/issues/8453>`_)
+ Closes #8453 (`#8453 <https://github.com/pylint-dev/pylint/issues/8453>`_)
@@ -203,7 +203,7 @@ Internal Changes
``is_sys_guard`` is still available, which was part of
``is_node_in_guarded_import_block``.
- Refs #8433 (`#8433 <https://github.com/PyCQA/pylint/issues/8433>`_)
+ Refs #8433 (`#8433 <https://github.com/pylint-dev/pylint/issues/8433>`_)
What's new in Pylint 2.17.0?
@@ -217,42 +217,42 @@ New Features
- `pyreverse` now supports custom color palettes with the `--color-palette`
option.
- Closes #6738 (`#6738 <https://github.com/PyCQA/pylint/issues/6738>`_)
+ Closes #6738 (`#6738 <https://github.com/pylint-dev/pylint/issues/6738>`_)
- Add ``invalid-name`` check for ``TypeAlias`` names.
- Closes #7081. (`#7081 <https://github.com/PyCQA/pylint/issues/7081>`_)
+ Closes #7081. (`#7081 <https://github.com/pylint-dev/pylint/issues/7081>`_)
- Accept values of the form ``<class name>.<attribute name>`` for the
``exclude-protected`` list.
- Closes #7343 (`#7343 <https://github.com/PyCQA/pylint/issues/7343>`_)
+ Closes #7343 (`#7343 <https://github.com/pylint-dev/pylint/issues/7343>`_)
- Add `--version` option to `pyreverse`.
- Refs #7851 (`#7851 <https://github.com/PyCQA/pylint/issues/7851>`_)
+ Refs #7851 (`#7851 <https://github.com/pylint-dev/pylint/issues/7851>`_)
- Adds new functionality with preferred-modules configuration to detect
submodules.
- Refs #7957 (`#7957 <https://github.com/PyCQA/pylint/issues/7957>`_)
+ Refs #7957 (`#7957 <https://github.com/pylint-dev/pylint/issues/7957>`_)
- Support implicit namespace packages (PEP 420).
- Closes #8154 (`#8154 <https://github.com/PyCQA/pylint/issues/8154>`_)
+ Closes #8154 (`#8154 <https://github.com/pylint-dev/pylint/issues/8154>`_)
- Add globbing pattern support for ``--source-roots``.
- Closes #8290 (`#8290 <https://github.com/PyCQA/pylint/issues/8290>`_)
+ Closes #8290 (`#8290 <https://github.com/pylint-dev/pylint/issues/8290>`_)
- Support globbing pattern when defining which file/directory/module to lint.
- Closes #8310 (`#8310 <https://github.com/PyCQA/pylint/issues/8310>`_)
+ Closes #8310 (`#8310 <https://github.com/pylint-dev/pylint/issues/8310>`_)
- pylint now supports ``TryStar`` nodes from Python 3.11 and should be fully
compatible with Python 3.11.
- Closes #8387 (`#8387 <https://github.com/PyCQA/pylint/issues/8387>`_)
+ Closes #8387 (`#8387 <https://github.com/pylint-dev/pylint/issues/8387>`_)
@@ -263,13 +263,13 @@ New Checks
there is a chained comparison where one expression is semantically
incompatible with the other.
- Closes #6559 (`#6559 <https://github.com/PyCQA/pylint/issues/6559>`_)
+ Closes #6559 (`#6559 <https://github.com/pylint-dev/pylint/issues/6559>`_)
- Adds an ``implicit-flag-alias`` check that emits a warning when a class
derived from ``enum.IntFlag`` assigns distinct integer values that share
common bit positions.
- Refs #8102 (`#8102 <https://github.com/PyCQA/pylint/issues/8102>`_)
+ Refs #8102 (`#8102 <https://github.com/pylint-dev/pylint/issues/8102>`_)
@@ -279,27 +279,27 @@ False Positives Fixed
- Fix various false positives for functions that return directly from
structural pattern matching cases.
- Closes #5288 (`#5288 <https://github.com/PyCQA/pylint/issues/5288>`_)
+ Closes #5288 (`#5288 <https://github.com/pylint-dev/pylint/issues/5288>`_)
- Fix false positive for ``used-before-assignment`` when
``typing.TYPE_CHECKING`` is used with if/elif/else blocks.
- Closes #7574 (`#7574 <https://github.com/PyCQA/pylint/issues/7574>`_)
+ Closes #7574 (`#7574 <https://github.com/pylint-dev/pylint/issues/7574>`_)
- Fix false positive for isinstance-second-argument-not-valid-type with union
types.
- Closes #8205 (`#8205 <https://github.com/PyCQA/pylint/issues/8205>`_)
+ Closes #8205 (`#8205 <https://github.com/pylint-dev/pylint/issues/8205>`_)
- Fix false positive for ``used-before-assignment`` for named expressions
appearing after the first element in a list, tuple, or set.
- Closes #8252 (`#8252 <https://github.com/PyCQA/pylint/issues/8252>`_)
+ Closes #8252 (`#8252 <https://github.com/pylint-dev/pylint/issues/8252>`_)
- Fix false positive for ``wrong-spelling-in-comment`` with class names in a
python 2 type comment.
- Closes #8370 (`#8370 <https://github.com/PyCQA/pylint/issues/8370>`_)
+ Closes #8370 (`#8370 <https://github.com/pylint-dev/pylint/issues/8370>`_)
@@ -312,11 +312,11 @@ False Negatives Fixed
raise
correctly.
- Refs #8185 (`#8185 <https://github.com/PyCQA/pylint/issues/8185>`_)
+ Refs #8185 (`#8185 <https://github.com/pylint-dev/pylint/issues/8185>`_)
- Fix false negative for inconsistent-returns with while-loops.
- Closes #8280 (`#8280 <https://github.com/PyCQA/pylint/issues/8280>`_)
+ Closes #8280 (`#8280 <https://github.com/pylint-dev/pylint/issues/8280>`_)
@@ -326,33 +326,33 @@ Other Bug Fixes
- Fix ``used-before-assignment`` false positive when the walrus operator
is used with a ternary operator in dictionary key/value initialization.
- Closes #8125 (`#8125 <https://github.com/PyCQA/pylint/issues/8125>`_)
+ Closes #8125 (`#8125 <https://github.com/pylint-dev/pylint/issues/8125>`_)
- Fix ``no-name-in-module`` false positive raised when a package defines a
variable with the
same name as one of its submodules.
- Closes #8148 (`#8148 <https://github.com/PyCQA/pylint/issues/8148>`_)
+ Closes #8148 (`#8148 <https://github.com/pylint-dev/pylint/issues/8148>`_)
- Fix a crash happening for python interpreter < 3.9 following a failed typing
update.
- Closes #8161 (`#8161 <https://github.com/PyCQA/pylint/issues/8161>`_)
+ Closes #8161 (`#8161 <https://github.com/pylint-dev/pylint/issues/8161>`_)
- Fix ``nested-min-max`` suggestion message to indicate it's possible to splat
iterable objects.
- Closes #8168 (`#8168 <https://github.com/PyCQA/pylint/issues/8168>`_)
+ Closes #8168 (`#8168 <https://github.com/pylint-dev/pylint/issues/8168>`_)
- Fix a crash happening when a class attribute was negated in the start
argument of an enumerate.
- Closes #8207 (`#8207 <https://github.com/PyCQA/pylint/issues/8207>`_)
+ Closes #8207 (`#8207 <https://github.com/pylint-dev/pylint/issues/8207>`_)
- Prevent emitting ``invalid-name`` for the line on which a ``global``
statement is declared.
- Closes #8307 (`#8307 <https://github.com/PyCQA/pylint/issues/8307>`_)
+ Closes #8307 (`#8307 <https://github.com/pylint-dev/pylint/issues/8307>`_)
@@ -361,7 +361,7 @@ Other Changes
- Update explanation for ``global-variable-not-assigned`` and add confidence.
- Closes #5073 (`#5073 <https://github.com/PyCQA/pylint/issues/5073>`_)
+ Closes #5073 (`#5073 <https://github.com/pylint-dev/pylint/issues/5073>`_)
- The governance model and the path to become a maintainer have been documented
as
@@ -369,4 +369,4 @@ Other Changes
pylint is
included is secure.
- Refs #8329 (`#8329 <https://github.com/PyCQA/pylint/issues/8329>`_)
+ Refs #8329 (`#8329 <https://github.com/pylint-dev/pylint/issues/8329>`_)
diff --git a/doc/whatsnew/2/2.3/full.rst b/doc/whatsnew/2/2.3/full.rst
index d55021275..947eedbac 100644
--- a/doc/whatsnew/2/2.3/full.rst
+++ b/doc/whatsnew/2/2.3/full.rst
@@ -13,7 +13,7 @@ Release date: 2019-02-27
Doesn't make that much sense for ``pylint`` itself, which is why we're handling the
exception here, rather than in ``astroid``
- Closes PyCQA/astroid#644
+ Closes pylint-dev/astroid#644
* Added a new command line option ``list-groups`` for listing all the check groups ``pylint`` knows about.
diff --git a/doc/whatsnew/2/2.9/full.rst b/doc/whatsnew/2/2.9/full.rst
index 5518f5464..417943e93 100644
--- a/doc/whatsnew/2/2.9/full.rst
+++ b/doc/whatsnew/2/2.9/full.rst
@@ -304,12 +304,12 @@ Release date: 2021-06-29
* Fix false-positive ``no-member`` with generic base class
- Closes PyCQA/astroid#942
+ Closes pylint-dev/astroid#942
* Fix ``assigning-non-slot`` false-positive with base that inherits from ``typing.Generic``
Closes #4509
- Closes PyCQA/astroid#999
+ Closes pylint-dev/astroid#999
* New checker ``invalid-all-format``. Emitted when ``__all__`` has an invalid format,
i.e. isn't a ``tuple`` or ``list``.
diff --git a/doc/whatsnew/3/3.0/index.rst b/doc/whatsnew/3/3.0/index.rst
new file mode 100644
index 000000000..d58fa3f1a
--- /dev/null
+++ b/doc/whatsnew/3/3.0/index.rst
@@ -0,0 +1,23 @@
+*************************
+ What's New in Pylint 3.0
+*************************
+
+.. toctree::
+ :maxdepth: 2
+
+:Release: 3.0.0
+:Date: TBA
+
+
+Summary -- Release highlights
+=============================
+
+In ``3.0.0``, we're enacting necessary breaking changes and long
+announced deprecations.
+
+There's going to be frequent beta releases,
+before the official releases, everyone is welcome to try the betas
+so we find problems before the actual release.
+
+
+.. towncrier release notes start
diff --git a/doc/whatsnew/3/index.rst b/doc/whatsnew/3/index.rst
new file mode 100644
index 000000000..67e4fd06a
--- /dev/null
+++ b/doc/whatsnew/3/index.rst
@@ -0,0 +1,9 @@
+3.x
+===
+
+This is the full list of change in pylint 3.x minors, by categories.
+
+.. toctree::
+ :maxdepth: 2
+
+ 3.0/index
diff --git a/doc/whatsnew/fragments/1144.false_negative b/doc/whatsnew/fragments/1144.false_negative
new file mode 100644
index 000000000..9b30c197b
--- /dev/null
+++ b/doc/whatsnew/fragments/1144.false_negative
@@ -0,0 +1,3 @@
+Emit ``used-before-assignment`` when calling module-level functions before definition.
+
+Closes #1144
diff --git a/doc/whatsnew/fragments/1954.performance b/doc/whatsnew/fragments/1954.performance
new file mode 100644
index 000000000..aa065f0d1
--- /dev/null
+++ b/doc/whatsnew/fragments/1954.performance
@@ -0,0 +1,4 @@
+- Optimize `is_trailing_comma()`.
+- Cache `class_is_abstract()`.
+
+Refs #1954
diff --git a/doc/whatsnew/fragments/3670.false_positive b/doc/whatsnew/fragments/3670.false_positive
new file mode 100644
index 000000000..562a41de2
--- /dev/null
+++ b/doc/whatsnew/fragments/3670.false_positive
@@ -0,0 +1,3 @@
+Fix `unused-argument` false positive when `__new__` does not use all the arguments of `__init__`.
+
+Closes #3670
diff --git a/doc/whatsnew/fragments/5488.other b/doc/whatsnew/fragments/5488.other
new file mode 100644
index 000000000..0f6ac5b85
--- /dev/null
+++ b/doc/whatsnew/fragments/5488.other
@@ -0,0 +1,3 @@
+Pylint now exposes its type annotations.
+
+Closes #5488 and #2079
diff --git a/doc/whatsnew/fragments/6306.breaking b/doc/whatsnew/fragments/6306.breaking
new file mode 100644
index 000000000..8338251b6
--- /dev/null
+++ b/doc/whatsnew/fragments/6306.breaking
@@ -0,0 +1,3 @@
+Remove support for Python 3.7.
+
+Refs #6306
diff --git a/doc/whatsnew/fragments/6871.user_action b/doc/whatsnew/fragments/6871.user_action
new file mode 100644
index 000000000..7cabc1ca1
--- /dev/null
+++ b/doc/whatsnew/fragments/6871.user_action
@@ -0,0 +1,17 @@
+The compare to empty string checker (``pylint.extensions.emptystring``) and the compare to
+zero checker (``pylint.extensions.compare-to-zero``) have been removed and their checks are
+now part of the implicit booleaness checker:
+
+``compare-to-zero`` was renamed ``use-implicit-booleaness-not-comparison-to-zero`` and
+``compare-to-empty-string`` was renamed ``use-implicit-booleaness-not-comparison-to-string``
+and they now need to be enabled explicitly.
+
+The `pylint.extensions.emptystring`` and ``pylint.extensions.compare-to-zero`` extensions
+no longer exists and needs to be removed from the ``load-plugins`` option.
+
+Messages related to implicit booleaness were made more explicit and actionable.
+
+This permits to make their likeness explicit and will provide better performance as they share most of their
+conditions to be raised.
+
+Closes #6871
diff --git a/doc/whatsnew/fragments/7163.other b/doc/whatsnew/fragments/7163.other
new file mode 100644
index 000000000..93f731aae
--- /dev/null
+++ b/doc/whatsnew/fragments/7163.other
@@ -0,0 +1,3 @@
+Search for ``pyproject.toml`` recursively in parent directories up to a project or file system root.
+
+Refs #7163, Closes #3289
diff --git a/doc/whatsnew/fragments/7506.false_positive b/doc/whatsnew/fragments/7506.false_positive
new file mode 100644
index 000000000..c6424e1f2
--- /dev/null
+++ b/doc/whatsnew/fragments/7506.false_positive
@@ -0,0 +1,3 @@
+Fix ``unused-import`` false positive for usage of ``six.with_metaclass``.
+
+Closes #7506
diff --git a/doc/whatsnew/fragments/7578.bugfix b/doc/whatsnew/fragments/7578.bugfix
new file mode 100644
index 000000000..2b01149ca
--- /dev/null
+++ b/doc/whatsnew/fragments/7578.bugfix
@@ -0,0 +1,3 @@
+The ``ignored-modules`` option will now be correctly taken into account for ``no-name-in-module``.
+
+Closes #7578
diff --git a/doc/whatsnew/fragments/7737.user_action b/doc/whatsnew/fragments/7737.user_action
new file mode 100644
index 000000000..1a992f563
--- /dev/null
+++ b/doc/whatsnew/fragments/7737.user_action
@@ -0,0 +1,3 @@
+epylint was removed. It now lives at: https://github.com/emacsorphanage/pylint.
+
+Refs #7737
diff --git a/doc/whatsnew/fragments/8167.false_positive b/doc/whatsnew/fragments/8167.false_positive
new file mode 100644
index 000000000..e0c341f65
--- /dev/null
+++ b/doc/whatsnew/fragments/8167.false_positive
@@ -0,0 +1,4 @@
+Fix false positive for ``used-before-assignment`` when usage and assignment
+are guarded by the same test in different statements.
+
+Closes #8167
diff --git a/doc/whatsnew/fragments/8181.feature b/doc/whatsnew/fragments/8181.feature
new file mode 100644
index 000000000..cd5b361d1
--- /dev/null
+++ b/doc/whatsnew/fragments/8181.feature
@@ -0,0 +1,5 @@
+Add new option (``--show-stdlib``, ``-L``) to ``pyreverse``.
+This is similar to the behavior of ``--show-builtin`` in that standard library
+modules are now not included by default, and this option will include them.
+
+Closes #8181
diff --git a/doc/whatsnew/fragments/8198.bugfix b/doc/whatsnew/fragments/8198.bugfix
new file mode 100644
index 000000000..61b4028ce
--- /dev/null
+++ b/doc/whatsnew/fragments/8198.bugfix
@@ -0,0 +1,4 @@
+Fix ``used-before-assignment`` false negative when TYPE_CHECKING imports
+are used in multiple scopes.
+
+Closes #8198
diff --git a/doc/whatsnew/fragments/8251.breaking b/doc/whatsnew/fragments/8251.breaking
new file mode 100644
index 000000000..5410c9a98
--- /dev/null
+++ b/doc/whatsnew/fragments/8251.breaking
@@ -0,0 +1,5 @@
+`pyreverse` now uses a new default color palette that is more colorblind friendly.
+The color scheme is taken from `Paul Tol's Notes <https://personal.sron.nl/~pault/>`_.
+If you prefer other colors, you can use the `--color-palette` option to specify custom colors.
+
+Closes #8251
diff --git a/doc/whatsnew/fragments/8361.bugfix b/doc/whatsnew/fragments/8361.bugfix
new file mode 100644
index 000000000..0f2b56707
--- /dev/null
+++ b/doc/whatsnew/fragments/8361.bugfix
@@ -0,0 +1,4 @@
+``--clear-cache-post-run`` now also clears LRU caches for pylint utilities
+holding references to AST nodes.
+
+Closes #8361
diff --git a/doc/whatsnew/fragments/8401.internal b/doc/whatsnew/fragments/8401.internal
new file mode 100644
index 000000000..9f4f92740
--- /dev/null
+++ b/doc/whatsnew/fragments/8401.internal
@@ -0,0 +1,4 @@
+``get_message_definition`` was removed from the base checker API. You can access
+message definitions through the ``MessageStore``.
+
+Refs #8401
diff --git a/doc/whatsnew/fragments/8403.false_positive b/doc/whatsnew/fragments/8403.false_positive
new file mode 100644
index 000000000..bfa34d17d
--- /dev/null
+++ b/doc/whatsnew/fragments/8403.false_positive
@@ -0,0 +1,5 @@
+Adds ``asyncSetUp`` to the default ``defining-attr-methods`` list to silence
+``attribute-defined-outside-init`` warning when using
+``unittest.IsolatedAsyncioTestCase``.
+
+Refs #8403
diff --git a/doc/whatsnew/fragments/8404.breaking b/doc/whatsnew/fragments/8404.breaking
new file mode 100644
index 000000000..eb99510eb
--- /dev/null
+++ b/doc/whatsnew/fragments/8404.breaking
@@ -0,0 +1,7 @@
+Everything related to the ``__implements__`` construct was removed. It was based on PEP245
+that was proposed in 2001 and rejected in 2006.
+
+The capability from pyreverse to take ``__implements__`` into account when generating diagrams
+was also removed.
+
+Refs #8404
diff --git a/doc/whatsnew/fragments/8404.internal b/doc/whatsnew/fragments/8404.internal
new file mode 100644
index 000000000..1a6da408a
--- /dev/null
+++ b/doc/whatsnew/fragments/8404.internal
@@ -0,0 +1,8 @@
+Everything related to the ``__implements__`` construct was removed. It was based on PEP245
+that was proposed in 2001 and rejected in 2006.
+
+All the classes inheriting ``Interface`` in ``pylint.interfaces`` were removed.
+``Checker`` should only inherit ``BaseChecker`` or any of the other checker types
+from ``pylint.checkers``. ``Reporter`` should only inherit ``BaseReporter``.
+
+Refs #8404
diff --git a/doc/whatsnew/fragments/8405.other b/doc/whatsnew/fragments/8405.other
new file mode 100644
index 000000000..423e50611
--- /dev/null
+++ b/doc/whatsnew/fragments/8405.other
@@ -0,0 +1,3 @@
+All code related to the optparse config parsing has been removed.
+
+Refs #8405
diff --git a/doc/whatsnew/fragments/8407.internal b/doc/whatsnew/fragments/8407.internal
new file mode 100644
index 000000000..bb96c2f5d
--- /dev/null
+++ b/doc/whatsnew/fragments/8407.internal
@@ -0,0 +1,5 @@
+``modname`` and ``msg_store`` are now required to be given in ``FileState``.
+``collect_block_lines`` has also been removed. ``Pylinter.current_name``
+cannot be null anymore.
+
+Refs #8407
diff --git a/doc/whatsnew/fragments/8408.internal b/doc/whatsnew/fragments/8408.internal
new file mode 100644
index 000000000..697a7ee50
--- /dev/null
+++ b/doc/whatsnew/fragments/8408.internal
@@ -0,0 +1,3 @@
+'Reporter.set_output' was removed in favor of 'reporter.out = stream'.
+
+Refs #8408
diff --git a/doc/whatsnew/fragments/8409.internal b/doc/whatsnew/fragments/8409.internal
new file mode 100644
index 000000000..415dec9cf
--- /dev/null
+++ b/doc/whatsnew/fragments/8409.internal
@@ -0,0 +1,24 @@
+A number of old utility functions and classes have been removed:
+
+``MapReduceMixin``: To make a checker reduce map data simply implement
+``get_map_data`` and ``reduce_map_data``.
+
+``is_inside_lambda``: Use ``utils.get_node_first_ancestor_of_type(x, nodes.Lambda)``
+
+``check_messages``: Use ``utils.only_required_for_messages``
+
+``is_class_subscriptable_pep585_with_postponed_evaluation_enabled``: Use
+``is_postponed_evaluation_enabled(node)`` and ``is_node_in_type_annotation_context(node)``
+
+``get_python_path``: assumption that there's always an __init__.py is not true since
+python 3.3 and is causing problems, particularly with PEP 420. Use ``discover_package_path``
+and pass source root(s).
+
+``fix_import_path``: Use ``augmented_sys_path`` and pass additional ``sys.path``
+entries as an argument obtained from ``discover_package_path``.
+
+``get_global_option``: Use ``checker.linter.config`` to get all global options.
+
+Related private objects have been removed as well.
+
+Refs #8409
diff --git a/doc/whatsnew/fragments/8410.false_positive b/doc/whatsnew/fragments/8410.false_positive
new file mode 100644
index 000000000..264542a7d
--- /dev/null
+++ b/doc/whatsnew/fragments/8410.false_positive
@@ -0,0 +1,3 @@
+`logging-not-lazy` is not longer emitted for explicitly concatenated string arguments.
+
+Closes #8410
diff --git a/doc/whatsnew/fragments/8411.user_action b/doc/whatsnew/fragments/8411.user_action
new file mode 100644
index 000000000..42f9c502a
--- /dev/null
+++ b/doc/whatsnew/fragments/8411.user_action
@@ -0,0 +1,7 @@
+The 'overgeneral-exceptions' option now only takes fully qualified name
+into account (``builtins.Exception`` not ``Exception``). If you overrode
+this option, you need to use the fully qualified name now.
+
+There's still a warning, but it will be removed in 3.1.0.
+
+Refs #8411
diff --git a/doc/whatsnew/fragments/8412.internal b/doc/whatsnew/fragments/8412.internal
new file mode 100644
index 000000000..ef12ebd18
--- /dev/null
+++ b/doc/whatsnew/fragments/8412.internal
@@ -0,0 +1,3 @@
+``colorize_ansi`` now only accept a ``MessageStyle`` object.
+
+Refs #8412
diff --git a/doc/whatsnew/fragments/8416.breaking b/doc/whatsnew/fragments/8416.breaking
new file mode 100644
index 000000000..7984da1b1
--- /dev/null
+++ b/doc/whatsnew/fragments/8416.breaking
@@ -0,0 +1,3 @@
+``pyreverse``: Support for the ``.vcg`` output format (Visualaization of Compiler Graphs) has been dropped.
+
+Closes #8416
diff --git a/doc/whatsnew/fragments/8424.false_positive b/doc/whatsnew/fragments/8424.false_positive
new file mode 100644
index 000000000..22dc8b844
--- /dev/null
+++ b/doc/whatsnew/fragments/8424.false_positive
@@ -0,0 +1,3 @@
+Fix false positive for isinstance-second-argument-not-valid-type when union types contains None.
+
+Closes #8424
diff --git a/doc/whatsnew/fragments/8433.internal b/doc/whatsnew/fragments/8433.internal
new file mode 100644
index 000000000..4bc20c493
--- /dev/null
+++ b/doc/whatsnew/fragments/8433.internal
@@ -0,0 +1,10 @@
+The following utilities are deprecated in favor of the more robust ``in_type_checking_block``
+and will be removed in pylint 3.0:
+
+ - ``is_node_in_guarded_import_block``
+ - ``is_node_in_typing_guarded_import_block``
+ - ``is_typing_guard``
+
+``is_sys_guard`` is still available, which was part of ``is_node_in_guarded_import_block``.
+
+Refs #8433
diff --git a/doc/whatsnew/fragments/8434.bugfix b/doc/whatsnew/fragments/8434.bugfix
new file mode 100644
index 000000000..b5a8bddcb
--- /dev/null
+++ b/doc/whatsnew/fragments/8434.bugfix
@@ -0,0 +1,3 @@
+Fix a crash when ``TYPE_CHECKING`` is used without importing it.
+
+Closes #8434
diff --git a/doc/whatsnew/fragments/8437.bugfix b/doc/whatsnew/fragments/8437.bugfix
new file mode 100644
index 000000000..c1727f950
--- /dev/null
+++ b/doc/whatsnew/fragments/8437.bugfix
@@ -0,0 +1,4 @@
+Fix a ``used-before-assignment`` false positive when imports
+are made under the ``TYPE_CHECKING`` else if branch.
+
+Closes #8437
diff --git a/doc/whatsnew/fragments/8453.bugfix b/doc/whatsnew/fragments/8453.bugfix
new file mode 100644
index 000000000..6bec2b0b9
--- /dev/null
+++ b/doc/whatsnew/fragments/8453.bugfix
@@ -0,0 +1,3 @@
+Fix a regression of ``preferred-modules`` where a partial match was used instead of the required full match.
+
+Closes #8453
diff --git a/doc/whatsnew/fragments/8462.breaking b/doc/whatsnew/fragments/8462.breaking
new file mode 100644
index 000000000..c794235c0
--- /dev/null
+++ b/doc/whatsnew/fragments/8462.breaking
@@ -0,0 +1,5 @@
+The warning when the now useless old pylint cache directory (pylint.d) was
+found was removed. The cache dir is documented in
+[the FAQ](https://pylint.readthedocs.io/en/latest/faq.html#where-is-the-persistent-data-stored-to-compare-between-successive-runs).
+
+Refs #8462
diff --git a/doc/whatsnew/fragments/8463.internal b/doc/whatsnew/fragments/8463.internal
new file mode 100644
index 000000000..de5df2520
--- /dev/null
+++ b/doc/whatsnew/fragments/8463.internal
@@ -0,0 +1,3 @@
+Following a deprecation period, ``Pylinter.check`` now only work with sequences of strings, not strings.
+
+Refs #8463
diff --git a/doc/whatsnew/fragments/8464.internal b/doc/whatsnew/fragments/8464.internal
new file mode 100644
index 000000000..4b4109c7b
--- /dev/null
+++ b/doc/whatsnew/fragments/8464.internal
@@ -0,0 +1,3 @@
+Following a deprecation period, ``ColorizedTextReporter`` only accepts ``ColorMappingDict``.
+
+Refs #8464
diff --git a/doc/whatsnew/fragments/8465.user_action b/doc/whatsnew/fragments/8465.user_action
new file mode 100644
index 000000000..b5d802a93
--- /dev/null
+++ b/doc/whatsnew/fragments/8465.user_action
@@ -0,0 +1,5 @@
+Following a deprecation period, it's no longer possible to use ``MASTER``
+or ``master`` as configuration section in ``setup.cfg`` or ``tox.ini``. It's bad practice
+to not start sections titles with the tool name. Please use ``pylint.main`` instead.
+
+Refs #8465
diff --git a/doc/whatsnew/fragments/8466.internal b/doc/whatsnew/fragments/8466.internal
new file mode 100644
index 000000000..101a8e4ba
--- /dev/null
+++ b/doc/whatsnew/fragments/8466.internal
@@ -0,0 +1,5 @@
+Following a deprecation period, ``MessageTest``'s ``end_line`` and ``end_col_offset``
+must be accurate in functional tests (for python 3.8 or above on cpython, and for
+python 3.9 or superior on pypy).
+
+Refs #8466
diff --git a/doc/whatsnew/fragments/8472.internal b/doc/whatsnew/fragments/8472.internal
new file mode 100644
index 000000000..6e9c3956a
--- /dev/null
+++ b/doc/whatsnew/fragments/8472.internal
@@ -0,0 +1,4 @@
+Following a deprecation period, the ``do_exit`` argument of the ``Run`` class (and of the ``_Run``
+class in testutils) were removed.
+
+Refs #8472
diff --git a/doc/whatsnew/fragments/8473.internal b/doc/whatsnew/fragments/8473.internal
new file mode 100644
index 000000000..11491dd57
--- /dev/null
+++ b/doc/whatsnew/fragments/8473.internal
@@ -0,0 +1,6 @@
+Following a deprecation period, the ``py_version`` argument of the
+``MessageDefinition.may_be_emitted`` function is now required. The most likely solution
+is to use 'linter.config.py_version' if you need to keep using this
+function, or to use 'MessageDefinition.is_message_enabled' instead.
+
+Refs #8473
diff --git a/doc/whatsnew/fragments/8474.internal b/doc/whatsnew/fragments/8474.internal
new file mode 100644
index 000000000..07120ba34
--- /dev/null
+++ b/doc/whatsnew/fragments/8474.internal
@@ -0,0 +1,5 @@
+Following a deprecation period, the ``OutputLine`` class now requires
+the right number of argument all the time. The functional output can be
+regenerated automatically to achieve that easily.
+
+Refs #8474
diff --git a/doc/whatsnew/fragments/8475.internal b/doc/whatsnew/fragments/8475.internal
new file mode 100644
index 000000000..0451554e9
--- /dev/null
+++ b/doc/whatsnew/fragments/8475.internal
@@ -0,0 +1,5 @@
+Following a deprecation period, ``is_typing_guard``, ``is_node_in_typing_guarded_import_block`` and
+``is_node_in_guarded_import_block``: from ``pylint.utils`` were removed: use a combination of
+``is_sys_guard`` and ``in_type_checking_block`` instead.
+
+Refs #8475
diff --git a/doc/whatsnew/fragments/8476.feature b/doc/whatsnew/fragments/8476.feature
new file mode 100644
index 000000000..56c0be201
--- /dev/null
+++ b/doc/whatsnew/fragments/8476.feature
@@ -0,0 +1,3 @@
+Add Pyreverse option to exclude standalone nodes from diagrams with `--no-standalone`.
+
+Closes #8476
diff --git a/doc/whatsnew/fragments/8477.internal b/doc/whatsnew/fragments/8477.internal
new file mode 100644
index 000000000..d7b043521
--- /dev/null
+++ b/doc/whatsnew/fragments/8477.internal
@@ -0,0 +1,4 @@
+Following a deprecation period, the ``location`` argument of the
+``Message`` class must now be a ``MessageLocationTuple``.
+
+Refs #8477
diff --git a/doc/whatsnew/fragments/8478.internal b/doc/whatsnew/fragments/8478.internal
new file mode 100644
index 000000000..b1b158508
--- /dev/null
+++ b/doc/whatsnew/fragments/8478.internal
@@ -0,0 +1,4 @@
+Following a deprecation period, the ``check_single_file`` function of the
+``Pylinter`` is replaced by ``Pylinter.check_single_file_item``.
+
+Refs #8478
diff --git a/doc/whatsnew/fragments/8485.false_positive b/doc/whatsnew/fragments/8485.false_positive
new file mode 100644
index 000000000..8eac08b95
--- /dev/null
+++ b/doc/whatsnew/fragments/8485.false_positive
@@ -0,0 +1,5 @@
+``invalid-name`` now allows for integers in ``typealias`` names:
+- now valid: ``Good2Name``, ``GoodName2``.
+- still invalid: ``_1BadName``.
+
+Closes #8485
diff --git a/doc/whatsnew/fragments/8487.false_positive b/doc/whatsnew/fragments/8487.false_positive
new file mode 100644
index 000000000..9ff5e3482
--- /dev/null
+++ b/doc/whatsnew/fragments/8487.false_positive
@@ -0,0 +1,3 @@
+No longer consider ``Union`` as type annotation as type alias for naming checks.
+
+Closes #8487
diff --git a/doc/whatsnew/fragments/8496.false_positive b/doc/whatsnew/fragments/8496.false_positive
new file mode 100644
index 000000000..3ea0fca6c
--- /dev/null
+++ b/doc/whatsnew/fragments/8496.false_positive
@@ -0,0 +1,5 @@
+``unnecessary-lambda`` no longer warns on lambdas which use its parameters in
+their body (other than the final arguments), e.g.
+``lambda foo: (bar if foo else baz)(foo)``.
+
+Closes #8496
diff --git a/doc/whatsnew/fragments/8500.false_positive b/doc/whatsnew/fragments/8500.false_positive
new file mode 100644
index 000000000..ced61766a
--- /dev/null
+++ b/doc/whatsnew/fragments/8500.false_positive
@@ -0,0 +1,3 @@
+Fixed `unused-import` so that it observes the `dummy-variables-rgx` option.
+
+Closes #8500
diff --git a/doc/whatsnew/fragments/8504.bugfix b/doc/whatsnew/fragments/8504.bugfix
new file mode 100644
index 000000000..2b54ac7b6
--- /dev/null
+++ b/doc/whatsnew/fragments/8504.bugfix
@@ -0,0 +1,3 @@
+Fix a crash in pyreverse when "/" characters are used in the output filename e.g pyreverse -o png -p name/ path/to/project.
+
+Closes #8504
diff --git a/doc/whatsnew/fragments/8536.false_negative b/doc/whatsnew/fragments/8536.false_negative
new file mode 100644
index 000000000..8b24bc96f
--- /dev/null
+++ b/doc/whatsnew/fragments/8536.false_negative
@@ -0,0 +1,3 @@
+`TypeAlias` variables defined in functions are now checked for `invalid-name` errors.
+
+Closes #8536
diff --git a/doc/whatsnew/fragments/8540.false_positive b/doc/whatsnew/fragments/8540.false_positive
new file mode 100644
index 000000000..543913637
--- /dev/null
+++ b/doc/whatsnew/fragments/8540.false_positive
@@ -0,0 +1,4 @@
+`Union` typed variables without assignment are no longer treated as
+`TypeAlias`.
+
+Closes #8540
diff --git a/doc/whatsnew/fragments/8555.false_positive b/doc/whatsnew/fragments/8555.false_positive
new file mode 100644
index 000000000..157486b39
--- /dev/null
+++ b/doc/whatsnew/fragments/8555.false_positive
@@ -0,0 +1,3 @@
+Fix false positive for ``positional-only-arguments-expected`` when a function contains both a positional-only parameter that has a default value, and ``**kwargs``.
+
+Closes #8555
diff --git a/doc/whatsnew/fragments/8559.false_negative b/doc/whatsnew/fragments/8559.false_negative
new file mode 100644
index 000000000..37c415138
--- /dev/null
+++ b/doc/whatsnew/fragments/8559.false_negative
@@ -0,0 +1,3 @@
+Fix false negative for ``no-value-for-parameter`` when a function, whose signature contains both a positional-only parameter ``name`` and also ``*kwargs``, is called with a keyword-argument for ``name``.
+
+Closes #8559
diff --git a/doc/whatsnew/fragments/8563.bugfix b/doc/whatsnew/fragments/8563.bugfix
new file mode 100644
index 000000000..3c9d38b1c
--- /dev/null
+++ b/doc/whatsnew/fragments/8563.bugfix
@@ -0,0 +1,3 @@
+Improve output of ``consider-using-generator`` message for ``min()` calls with ``default`` keyword.
+
+Closes #8563
diff --git a/doc/whatsnew/fragments/8570.false_positive b/doc/whatsnew/fragments/8570.false_positive
new file mode 100644
index 000000000..fec3a855e
--- /dev/null
+++ b/doc/whatsnew/fragments/8570.false_positive
@@ -0,0 +1,3 @@
+Fix false positive for ``keyword-arg-before-vararg`` when a positional-only parameter with a default value precedes ``*args``.
+
+Closes #8570
diff --git a/doc/whatsnew/fragments/8603.bugfix b/doc/whatsnew/fragments/8603.bugfix
new file mode 100644
index 000000000..1a1025c4b
--- /dev/null
+++ b/doc/whatsnew/fragments/8603.bugfix
@@ -0,0 +1,3 @@
+``pyreverse``: added escaping of vertical bar character in annotation labels produced by DOT printer to ensure it is not treated as field separator of record-based nodes.
+
+Closes #8603
diff --git a/doc/whatsnew/fragments/8613.false_positive b/doc/whatsnew/fragments/8613.false_positive
new file mode 100644
index 000000000..80d28e9c2
--- /dev/null
+++ b/doc/whatsnew/fragments/8613.false_positive
@@ -0,0 +1,3 @@
+Fix a false positive for ``bad-dunder-name`` when there is a user-defined ``__index__`` method.
+
+Closes #8613
diff --git a/doc/whatsnew/fragments/8632.bugfix b/doc/whatsnew/fragments/8632.bugfix
new file mode 100644
index 000000000..c6f9c01bf
--- /dev/null
+++ b/doc/whatsnew/fragments/8632.bugfix
@@ -0,0 +1,4 @@
+Fixed a crash when generating a configuration file: ``tomlkit.exceptions.TOMLKitError: Can't add a table to a dotted key``
+caused by tomlkit ``v0.11.8``.
+
+Closes #8632
diff --git a/doc/whatsnew/index.rst b/doc/whatsnew/index.rst
index 47aae955d..4e9c22fea 100644
--- a/doc/whatsnew/index.rst
+++ b/doc/whatsnew/index.rst
@@ -5,6 +5,7 @@
:titlesonly:
:hidden:
+ 3/index
2/index
1/index
0/index
diff --git a/Dockerfile b/examples/Dockerfile
index 976a56d47..080fa0744 100644
--- a/Dockerfile
+++ b/examples/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.10.0-alpine3.15
+FROM python:3.10.10-alpine3.17
COPY ./ /tmp/build
WORKDIR /tmp/build
diff --git a/examples/pylintrc b/examples/pylintrc
index 16284083e..d496b6b90 100644
--- a/examples/pylintrc
+++ b/examples/pylintrc
@@ -428,13 +428,15 @@ disable=raw-checker-failed,
suppressed-message,
useless-suppression,
deprecated-pragma,
+ use-implicit-booleaness-not-comparison-to-string,
+ use-implicit-booleaness-not-comparison-to-zero,
use-symbolic-message-instead
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
-enable=c-extension-no-member
+enable=
[METHOD_ARGS]
diff --git a/examples/pyproject.toml b/examples/pyproject.toml
index f9a493c89..6aba10140 100644
--- a/examples/pyproject.toml
+++ b/examples/pyproject.toml
@@ -365,13 +365,13 @@ confidence = ["HIGH", "CONTROL_FLOW", "INFERENCE", "INFERENCE_FAILURE", "UNDEFIN
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
-disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-symbolic-message-instead"]
+disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-implicit-booleaness-not-comparison-to-string", "use-implicit-booleaness-not-comparison-to-zero", "use-symbolic-message-instead"]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where it
# should appear only once). See also the "--disable" option for examples.
-enable = ["c-extension-no-member"]
+# enable =
[tool.pylint.method_args]
# List of qualified names (i.e., library.method) which require a timeout
diff --git a/pylint/__init__.py b/pylint/__init__.py
index 2cc7edadb..cc0f609aa 100644
--- a/pylint/__init__.py
+++ b/pylint/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -9,14 +9,12 @@ __all__ = [
"version",
"modify_sys_path",
"run_pylint",
- "run_epylint",
"run_symilar",
"run_pyreverse",
]
import os
import sys
-import warnings
from collections.abc import Sequence
from typing import NoReturn
@@ -48,22 +46,6 @@ def _run_pylint_config(argv: Sequence[str] | None = None) -> None:
_PylintConfigRun(argv or sys.argv[1:])
-def run_epylint(argv: Sequence[str] | None = None) -> NoReturn:
- """Run epylint.
-
- argv can be a list of strings normally supplied as arguments on the command line
- """
- from pylint.epylint import Run as EpylintRun
-
- warnings.warn(
- "'run_epylint' will be removed in pylint 3.0, use "
- "https://github.com/emacsorphanage/pylint instead.",
- DeprecationWarning,
- stacklevel=1,
- )
- EpylintRun(argv)
-
-
def run_pyreverse(argv: Sequence[str] | None = None) -> NoReturn:
"""Run pyreverse.
@@ -96,12 +78,12 @@ def modify_sys_path() -> None:
- Remove the first entry. This will always be either "" or the working directory
- Remove the working directory from the second and third entries
if PYTHONPATH includes a ":" at the beginning or the end.
- https://github.com/PyCQA/pylint/issues/3636
+ https://github.com/pylint-dev/pylint/issues/3636
Don't remove it if PYTHONPATH contains the cwd or '.' as the entry will
only be added once.
- Don't remove the working directory from the rest. It will be included
if pylint is installed in an editable configuration (as the last item).
- https://github.com/PyCQA/pylint/issues/4161
+ https://github.com/pylint-dev/pylint/issues/4161
"""
cwd = os.getcwd()
if sys.path[0] in ("", ".", cwd):
diff --git a/pylint/__main__.py b/pylint/__main__.py
index 7df5805f9..448ac55b6 100644
--- a/pylint/__main__.py
+++ b/pylint/__main__.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import pylint
diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py
index 3566c348f..5a86f05b0 100644
--- a/pylint/__pkginfo__.py
+++ b/pylint/__pkginfo__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""This module exists for compatibility reasons.
@@ -9,14 +9,14 @@ It's updated via tbump, do not modify.
from __future__ import annotations
-__version__ = "2.17.4"
+__version__ = "3.0.0b1"
def get_numversion_from_version(v: str) -> tuple[int, int, int]:
"""Kept for compatibility reason.
- See https://github.com/PyCQA/pylint/issues/4399
- https://github.com/PyCQA/pylint/issues/4420,
+ See https://github.com/pylint-dev/pylint/issues/4399
+ https://github.com/pylint-dev/pylint/issues/4420,
"""
version = v.replace("pylint-", "")
result_version = []
diff --git a/pylint/checkers/__init__.py b/pylint/checkers/__init__.py
index ed641d8e5..0f9985918 100644
--- a/pylint/checkers/__init__.py
+++ b/pylint/checkers/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Utilities methods and classes for checkers.
@@ -42,8 +42,7 @@ messages nor reports. XXX not true, emit a 07 report !
from __future__ import annotations
-import sys
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Literal
from pylint.checkers.base_checker import (
BaseChecker,
@@ -51,14 +50,8 @@ from pylint.checkers.base_checker import (
BaseTokenChecker,
)
from pylint.checkers.deprecated import DeprecatedMixin
-from pylint.checkers.mapreduce_checker import MapReduceMixin
from pylint.utils import LinterStats, diff_string, register_plugins
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
if TYPE_CHECKING:
from pylint.lint import PyLinter
@@ -141,7 +134,6 @@ __all__ = [
"BaseTokenChecker",
"BaseRawFileChecker",
"initialize",
- "MapReduceMixin",
"DeprecatedMixin",
"register_plugins",
]
diff --git a/pylint/checkers/async.py b/pylint/checkers/async.py
index b06ec60c8..a8ee77302 100644
--- a/pylint/checkers/async.py
+++ b/pylint/checkers/async.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker for anything related to the async protocol (PEP 492)."""
diff --git a/pylint/checkers/bad_chained_comparison.py b/pylint/checkers/bad_chained_comparison.py
index 8c3aeb9cc..2e1912160 100644
--- a/pylint/checkers/bad_chained_comparison.py
+++ b/pylint/checkers/bad_chained_comparison.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/checkers/base/__init__.py b/pylint/checkers/base/__init__.py
index f427cbf21..c9067b405 100644
--- a/pylint/checkers/base/__init__.py
+++ b/pylint/checkers/base/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=duplicate-code # This is similar to the __init__ of .name_checker
diff --git a/pylint/checkers/base/basic_checker.py b/pylint/checkers/base/basic_checker.py
index 062e67a97..18de86142 100644
--- a/pylint/checkers/base/basic_checker.py
+++ b/pylint/checkers/base/basic_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Basic checker for Python code."""
@@ -8,9 +8,8 @@ from __future__ import annotations
import collections
import itertools
-import sys
from collections.abc import Iterator
-from typing import TYPE_CHECKING, cast
+from typing import TYPE_CHECKING, Literal, cast
import astroid
from astroid import nodes, objects, util
@@ -24,11 +23,6 @@ from pylint.utils import LinterStats
if TYPE_CHECKING:
from pylint.lint.pylinter import PyLinter
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
class _BasicChecker(BaseChecker):
"""Permits separating multiple checks with the same checker name into
@@ -329,7 +323,7 @@ class BasicChecker(_BasicChecker):
nodes.Subscript,
)
inferred = None
- emit = isinstance(test, (nodes.Const,) + structs + const_nodes)
+ emit = isinstance(test, (nodes.Const, *structs, *const_nodes))
maybe_generator_call = None
if not isinstance(test, except_nodes):
inferred = utils.safe_infer(test)
@@ -367,9 +361,9 @@ class BasicChecker(_BasicChecker):
try:
# Just forcing the generator to infer all elements.
# astroid.exceptions.InferenceError are false positives
- # see https://github.com/PyCQA/pylint/pull/8185
+ # see https://github.com/pylint-dev/pylint/pull/8185
if isinstance(inferred, nodes.FunctionDef):
- call_inferred = list(inferred.infer_call_result())
+ call_inferred = list(inferred.infer_call_result(node))
elif isinstance(inferred, nodes.Lambda):
call_inferred = list(inferred.infer_call_result(node))
except astroid.InferenceError:
@@ -462,7 +456,7 @@ class BasicChecker(_BasicChecker):
# Heuristic: only run inference for names that begin with an uppercase char
# This reduces W0133's coverage, but retains acceptable runtime performance
- # For more details, see: https://github.com/PyCQA/pylint/issues/8073
+ # For more details, see: https://github.com/pylint-dev/pylint/issues/8073
inferred = utils.safe_infer(expr) if name[:1].isupper() else None
if isinstance(inferred, objects.ExceptionInstance):
self.add_message(
diff --git a/pylint/checkers/base/basic_error_checker.py b/pylint/checkers/base/basic_error_checker.py
index 25038247c..ccf9773a7 100644
--- a/pylint/checkers/base/basic_error_checker.py
+++ b/pylint/checkers/base/basic_error_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Basic Error checker from the basic checker."""
diff --git a/pylint/checkers/base/comparison_checker.py b/pylint/checkers/base/comparison_checker.py
index ffbd27374..14d40c7d6 100644
--- a/pylint/checkers/base/comparison_checker.py
+++ b/pylint/checkers/base/comparison_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Comparison checker from the basic checker."""
diff --git a/pylint/checkers/base/docstring_checker.py b/pylint/checkers/base/docstring_checker.py
index 791b085b5..91b3e7d4a 100644
--- a/pylint/checkers/base/docstring_checker.py
+++ b/pylint/checkers/base/docstring_checker.py
@@ -1,13 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Docstring checker from the basic checker."""
from __future__ import annotations
import re
-import sys
+from typing import Literal
import astroid
from astroid import nodes
@@ -21,11 +21,6 @@ from pylint.checkers.utils import (
is_property_setter,
)
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
# do not require a doc string on private/system methods
NO_REQUIRED_DOC_RGX = re.compile("^_")
diff --git a/pylint/checkers/base/name_checker/__init__.py b/pylint/checkers/base/name_checker/__init__.py
index 3d6818b7a..dec4335f5 100644
--- a/pylint/checkers/base/name_checker/__init__.py
+++ b/pylint/checkers/base/name_checker/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
__all__ = [
"NameChecker",
diff --git a/pylint/checkers/base/name_checker/checker.py b/pylint/checkers/base/name_checker/checker.py
index 58f7198ef..56ae925fb 100644
--- a/pylint/checkers/base/name_checker/checker.py
+++ b/pylint/checkers/base/name_checker/checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Basic checker for Python code."""
@@ -476,7 +476,12 @@ class NameChecker(_BasicChecker):
# global introduced variable aren't in the function locals
if node.name in frame and node.name not in frame.argnames():
if not _redefines_import(node):
- self._check_name("variable", node.name, node)
+ if isinstance(
+ assign_type, nodes.AnnAssign
+ ) and self._assigns_typealias(assign_type.annotation):
+ self._check_name("typealias", node.name, node)
+ else:
+ self._check_name("variable", node.name, node)
# Check names defined in class scopes
elif isinstance(frame, nodes.ClassDef):
diff --git a/pylint/checkers/base/name_checker/naming_style.py b/pylint/checkers/base/name_checker/naming_style.py
index 8ccec4289..6410f9181 100644
--- a/pylint/checkers/base/name_checker/naming_style.py
+++ b/pylint/checkers/base/name_checker/naming_style.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/checkers/base/pass_checker.py b/pylint/checkers/base/pass_checker.py
index 120d4c5a0..a9351ba75 100644
--- a/pylint/checkers/base/pass_checker.py
+++ b/pylint/checkers/base/pass_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from astroid import nodes
diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py
index dd7a0222f..9785f9c4a 100644
--- a/pylint/checkers/base_checker.py
+++ b/pylint/checkers/base_checker.py
@@ -1,12 +1,11 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import abc
import functools
-import warnings
from collections.abc import Iterable, Sequence
from inspect import cleandoc
from tokenize import TokenInfo
@@ -17,7 +16,7 @@ from astroid import nodes
from pylint.config.arguments_provider import _ArgumentsProvider
from pylint.constants import _MSG_ORDER, MAIN_CHECKER_NAME, WarningScope
from pylint.exceptions import InvalidMessageError
-from pylint.interfaces import Confidence, IRawChecker, ITokenChecker, implements
+from pylint.interfaces import Confidence
from pylint.message.message_definition import MessageDefinition
from pylint.typing import (
ExtraMessageOptions,
@@ -47,18 +46,9 @@ class BaseChecker(_ArgumentsProvider):
def __init__(self, linter: PyLinter) -> None:
"""Checker instances should have the linter as argument."""
- if getattr(self, "__implements__", None):
- warnings.warn(
- "Using the __implements__ inheritance pattern for BaseChecker is no "
- "longer supported. Child classes should only inherit BaseChecker or any "
- "of the other checker types from pylint.checkers.",
- DeprecationWarning,
- stacklevel=2,
- )
if self.name is not None:
self.name = self.name.lower()
self.linter = linter
-
_ArgumentsProvider.__init__(self, linter)
def __gt__(self, other: Any) -> bool:
@@ -96,11 +86,9 @@ class BaseChecker(_ArgumentsProvider):
See: MessageHandlerMixIn.get_full_documentation()
"""
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- return self.get_full_documentation(
- msgs=self.msgs, options=self.options_and_values(), reports=self.reports
- )
+ return self.get_full_documentation(
+ msgs=self.msgs, options=self._options_and_values(), reports=self.reports
+ )
def get_full_documentation(
self,
@@ -193,21 +181,10 @@ class BaseChecker(_ArgumentsProvider):
def create_message_definition_from_tuple(
self, msgid: str, msg_tuple: MessageDefinitionTuple
) -> MessageDefinition:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- if isinstance(self, (BaseTokenChecker, BaseRawFileChecker)):
- default_scope = WarningScope.LINE
- # TODO: 3.0: Remove deprecated if-statement
- elif implements(self, (IRawChecker, ITokenChecker)):
- warnings.warn( # pragma: no cover
- "Checkers should subclass BaseTokenChecker or BaseRawFileChecker "
- "instead of using the __implements__ mechanism. Use of __implements__ "
- "will no longer be supported in pylint 3.0",
- DeprecationWarning,
- )
- default_scope = WarningScope.LINE # pragma: no cover
- else:
- default_scope = WarningScope.NODE
+ if isinstance(self, (BaseTokenChecker, BaseRawFileChecker)):
+ default_scope = WarningScope.LINE
+ else:
+ default_scope = WarningScope.NODE
options: ExtraMessageOptions = {}
if len(msg_tuple) == 4:
(msg, symbol, descr, options) = msg_tuple # type: ignore[misc]
@@ -234,20 +211,6 @@ class BaseChecker(_ArgumentsProvider):
for msgid, msg_tuple in sorted(self.msgs.items())
]
- def get_message_definition(self, msgid: str) -> MessageDefinition:
- # TODO: 3.0: Remove deprecated method
- warnings.warn(
- "'get_message_definition' is deprecated and will be removed in 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- for message_definition in self.messages:
- if message_definition.msgid == msgid:
- return message_definition
- error_msg = f"MessageDefinition for '{msgid}' does not exists. "
- error_msg += f"Choose from {[m.msgid for m in self.messages]}."
- raise InvalidMessageError(error_msg)
-
def open(self) -> None:
"""Called before visiting project (i.e. set of modules)."""
diff --git a/pylint/checkers/classes/__init__.py b/pylint/checkers/classes/__init__.py
index e51194439..422fae2ee 100644
--- a/pylint/checkers/classes/__init__.py
+++ b/pylint/checkers/classes/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/checkers/classes/class_checker.py b/pylint/checkers/classes/class_checker.py
index e09df1706..77a795bcb 100644
--- a/pylint/checkers/classes/class_checker.py
+++ b/pylint/checkers/classes/class_checker.py
@@ -1,15 +1,15 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Classes checker for Python code."""
from __future__ import annotations
import collections
-import sys
from collections import defaultdict
from collections.abc import Callable, Sequence
+from functools import cached_property
from itertools import chain, zip_longest
from re import Pattern
from typing import TYPE_CHECKING, Any, Union
@@ -47,11 +47,6 @@ if TYPE_CHECKING:
from pylint.lint.pylinter import PyLinter
-if sys.version_info >= (3, 8):
- from functools import cached_property
-else:
- from astroid.decorators import cachedproperty as cached_property
-
_AccessNodes = Union[nodes.Attribute, nodes.AssignAttr]
INVALID_BASE_CLASSES = {"bool", "range", "slice", "memoryview"}
diff --git a/pylint/checkers/classes/special_methods_checker.py b/pylint/checkers/classes/special_methods_checker.py
index 9de5e619f..025f28562 100644
--- a/pylint/checkers/classes/special_methods_checker.py
+++ b/pylint/checkers/classes/special_methods_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Special methods checker and helper function's module."""
diff --git a/pylint/checkers/deprecated.py b/pylint/checkers/deprecated.py
index f6a82b1da..821a9836c 100644
--- a/pylint/checkers/deprecated.py
+++ b/pylint/checkers/deprecated.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker mixin for deprecated functionality."""
diff --git a/pylint/checkers/design_analysis.py b/pylint/checkers/design_analysis.py
index 11ff7a5a1..701615d89 100644
--- a/pylint/checkers/design_analysis.py
+++ b/pylint/checkers/design_analysis.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for signs of poor design."""
diff --git a/pylint/checkers/dunder_methods.py b/pylint/checkers/dunder_methods.py
index b66844901..535dbb168 100644
--- a/pylint/checkers/dunder_methods.py
+++ b/pylint/checkers/dunder_methods.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -23,7 +23,7 @@ class DunderCallChecker(BaseChecker):
Docs: https://docs.python.org/3/reference/datamodel.html#basic-customization
We exclude names in list pylint.constants.EXTRA_DUNDER_METHODS such as
- __index__ (see https://github.com/PyCQA/pylint/issues/6795)
+ __index__ (see https://github.com/pylint-dev/pylint/issues/6795)
since these either have no alternative method of being called or
have a genuine use case for being called manually.
diff --git a/pylint/checkers/ellipsis_checker.py b/pylint/checkers/ellipsis_checker.py
index 52b15c702..4e7e3bd35 100644
--- a/pylint/checkers/ellipsis_checker.py
+++ b/pylint/checkers/ellipsis_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Ellipsis checker for Python code."""
diff --git a/pylint/checkers/exceptions.py b/pylint/checkers/exceptions.py
index c2bd246d7..5757b8d55 100644
--- a/pylint/checkers/exceptions.py
+++ b/pylint/checkers/exceptions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checks for various exception related errors."""
@@ -210,16 +210,17 @@ class ExceptionRaiseRefVisitor(BaseVisitor):
"notimplemented-raised", node=self._node, confidence=HIGH
)
return
-
try:
- exceptions = list(_annotated_unpack_infer(node))
+ exceptions = [
+ c
+ for _, c in _annotated_unpack_infer(node)
+ if isinstance(c, nodes.ClassDef)
+ ]
except astroid.InferenceError:
return
- for _, exception in exceptions:
- if isinstance(
- exception, nodes.ClassDef
- ) and self._checker._is_overgeneral_exception(exception):
+ for exception in exceptions:
+ if self._checker._is_overgeneral_exception(exception):
self._checker.add_message(
"broad-exception-raised",
args=exception.name,
@@ -306,13 +307,13 @@ class ExceptionsChecker(checkers.BaseChecker):
def open(self) -> None:
self._builtin_exceptions = _builtin_exceptions()
+ # TODO 3.1: Remove this check and put it elsewhere
for exc_name in self.linter.config.overgeneral_exceptions:
if "." not in exc_name:
warnings.warn_explicit(
- "Specifying exception names in the overgeneral-exceptions option"
- " without module name is deprecated and support for it"
- " will be removed in pylint 3.0."
- f" Use fully qualified name (maybe 'builtins.{exc_name}' ?) instead.",
+ f"'{exc_name}' is not a proper value for the 'overgeneral-exceptions' option. "
+ f"Use fully qualified name (maybe 'builtins.{exc_name}' ?) instead. "
+ "This will cease to be checked at runtime in 3.1.0.",
category=UserWarning,
filename="pylint: Command line or configuration file",
lineno=1,
@@ -646,13 +647,7 @@ class ExceptionsChecker(checkers.BaseChecker):
exceptions_classes += [exc for _, exc in exceptions]
def _is_overgeneral_exception(self, exception: nodes.ClassDef) -> bool:
- return (
- exception.qname() in self.linter.config.overgeneral_exceptions
- # TODO: 3.0: not a qualified name, deprecated
- or "." not in exception.name
- and exception.name in self.linter.config.overgeneral_exceptions
- and exception.root().name == utils.EXCEPTIONS_MODULE
- )
+ return exception.qname() in self.linter.config.overgeneral_exceptions
def register(linter: PyLinter) -> None:
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py
index 562c48f5d..3e3cd3227 100644
--- a/pylint/checkers/format.py
+++ b/pylint/checkers/format.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Python code format's checker.
@@ -13,11 +13,10 @@ Some parts of the process_token method is based from The Tab Nanny std module.
from __future__ import annotations
-import sys
import tokenize
from functools import reduce
from re import Match
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Literal
from astroid import nodes
@@ -31,10 +30,6 @@ from pylint.utils.pragma_parser import OPTION_PO, PragmaParserError, parse_pragm
if TYPE_CHECKING:
from pylint.lint import PyLinter
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
_KEYWORD_TOKENS = {
"assert",
@@ -346,7 +341,7 @@ class FormatChecker(BaseTokenChecker, BaseRawFileChecker):
if found_and_or:
return
if keyword_token == "in":
- # This special case was added in https://github.com/PyCQA/pylint/pull/4948
+ # This special case was added in https://github.com/pylint-dev/pylint/pull/4948
# but it could be removed in the future. Avoid churn for now.
return
self.add_message(
@@ -667,8 +662,8 @@ class FormatChecker(BaseTokenChecker, BaseRawFileChecker):
self.add_message("missing-final-newline", line=lineno + offset)
continue
# We don't test for trailing whitespaces in strings
- # See https://github.com/PyCQA/pylint/issues/6936
- # and https://github.com/PyCQA/pylint/issues/3822
+ # See https://github.com/pylint-dev/pylint/issues/6936
+ # and https://github.com/pylint-dev/pylint/issues/3822
if tokens.type(line_start) != tokenize.STRING:
self.check_trailing_whitespace_ending(line, lineno + offset)
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py
index ef7fe50cc..42649f3d9 100644
--- a/pylint/checkers/imports.py
+++ b/pylint/checkers/imports.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Imports checkers for Python code."""
@@ -12,6 +12,7 @@ import os
import sys
from collections import defaultdict
from collections.abc import ItemsView, Sequence
+from functools import cached_property
from typing import TYPE_CHECKING, Any, Dict, List, Union
import astroid
@@ -23,6 +24,7 @@ from pylint.checkers.utils import (
get_import_name,
in_type_checking_block,
is_from_fallback_block,
+ is_module_ignored,
is_sys_guard,
node_ignores_exception,
)
@@ -37,11 +39,6 @@ from pylint.utils.linterstats import LinterStats
if TYPE_CHECKING:
from pylint.lint import PyLinter
-if sys.version_info >= (3, 8):
- from functools import cached_property
-else:
- from astroid.decorators import cachedproperty as cached_property
-
# The dictionary with Any should actually be a _ImportTree again
# but mypy doesn't support recursive types yet
@@ -84,18 +81,6 @@ DEPRECATED_MODULES = {
}
-def _qualified_names(modname: str | None) -> list[str]:
- """Split the names of the given module into subparts.
-
- For example,
- _qualified_names('pylint.checkers.ImportsChecker')
- returns
- ['pylint', 'pylint.checkers', 'pylint.checkers.ImportsChecker']
- """
- names = modname.split(".") if modname is not None else ""
- return [".".join(names[0 : i + 1]) for i in range(len(names))]
-
-
def _get_first_import(
node: ImportNode,
context: nodes.LocalsDictNodeNG,
@@ -153,12 +138,11 @@ def _get_first_import(
def _ignore_import_failure(
node: ImportNode,
- modname: str | None,
+ modname: str,
ignored_modules: Sequence[str],
) -> bool:
- for submodule in _qualified_names(modname):
- if submodule in ignored_modules:
- return True
+ if is_module_ignored(modname, ignored_modules):
+ return True
# Ignore import failure if part of guarded import block
# I.e. `sys.version_info` or `typing.TYPE_CHECKING`
@@ -852,7 +836,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker):
return std_imports, external_imports, local_imports
def _get_imported_module(
- self, importnode: ImportNode, modname: str | None
+ self, importnode: ImportNode, modname: str
) -> nodes.Module | None:
try:
return importnode.do_import_module(modname)
diff --git a/pylint/checkers/lambda_expressions.py b/pylint/checkers/lambda_expressions.py
index 69c5b738e..18c03060d 100644
--- a/pylint/checkers/lambda_expressions.py
+++ b/pylint/checkers/lambda_expressions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/checkers/logging.py b/pylint/checkers/logging.py
index 3064dc926..461047bdf 100644
--- a/pylint/checkers/logging.py
+++ b/pylint/checkers/logging.py
@@ -1,14 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker for use of Python logging."""
from __future__ import annotations
import string
-import sys
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Literal
import astroid
from astroid import bases, nodes
@@ -19,11 +18,6 @@ from pylint.checkers import utils
from pylint.checkers.utils import infer_all
from pylint.typing import MessageDefinitionTuple
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
if TYPE_CHECKING:
from pylint.lint import PyLinter
diff --git a/pylint/checkers/mapreduce_checker.py b/pylint/checkers/mapreduce_checker.py
deleted file mode 100644
index 96e86d7c0..000000000
--- a/pylint/checkers/mapreduce_checker.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-from __future__ import annotations
-
-import abc
-import warnings
-from typing import TYPE_CHECKING, Any
-
-if TYPE_CHECKING:
- from pylint.lint import PyLinter
-
-
-class MapReduceMixin(metaclass=abc.ABCMeta):
- """A mixin design to allow multi-process/threaded runs of a Checker."""
-
- def __init__(self) -> None:
- warnings.warn(
- "MapReduceMixin has been deprecated and will be removed in pylint 3.0. "
- "To make a checker reduce map data simply implement get_map_data and reduce_map_data.",
- DeprecationWarning,
- stacklevel=2,
- )
-
- @abc.abstractmethod
- def get_map_data(self) -> Any:
- """Returns merge-able/reducible data that will be examined."""
-
- @abc.abstractmethod
- def reduce_map_data(self, linter: PyLinter, data: list[Any]) -> None:
- """For a given Checker, receives data for all mapped runs."""
diff --git a/pylint/checkers/method_args.py b/pylint/checkers/method_args.py
index 8862328e3..59083fa25 100644
--- a/pylint/checkers/method_args.py
+++ b/pylint/checkers/method_args.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Variables checkers for Python code."""
diff --git a/pylint/checkers/misc.py b/pylint/checkers/misc.py
index 8f6495735..f81dc43e7 100644
--- a/pylint/checkers/misc.py
+++ b/pylint/checkers/misc.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check source code is ascii only or has an encoding declaration (PEP 263)."""
@@ -29,6 +29,7 @@ class ByIdManagedMessagesChecker(BaseRawFileChecker):
"%s",
"use-symbolic-message-instead",
"Used when a message is enabled or disabled by id.",
+ {"default_enabled": False},
)
}
options = ()
diff --git a/pylint/checkers/modified_iterating_checker.py b/pylint/checkers/modified_iterating_checker.py
index bdc8fff7f..9d89f7255 100644
--- a/pylint/checkers/modified_iterating_checker.py
+++ b/pylint/checkers/modified_iterating_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/checkers/nested_min_max.py b/pylint/checkers/nested_min_max.py
index e9aa409f0..219382ff5 100644
--- a/pylint/checkers/nested_min_max.py
+++ b/pylint/checkers/nested_min_max.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for use of nested min/max functions."""
@@ -10,6 +10,7 @@ import copy
from typing import TYPE_CHECKING
from astroid import nodes, objects
+from astroid.const import Context
from pylint.checkers import BaseChecker
from pylint.checkers.utils import only_required_for_messages, safe_infer
@@ -96,7 +97,20 @@ class NestedMinMaxChecker(BaseChecker):
if isinstance(
inferred, (nodes.List, nodes.Tuple, nodes.Set, *DICT_TYPES)
):
- splat_node = nodes.Starred(lineno=inferred.lineno)
+ splat_node = nodes.Starred(
+ ctx=Context.Load,
+ lineno=inferred.lineno,
+ col_offset=0,
+ parent=nodes.NodeNG(
+ lineno=None,
+ col_offset=None,
+ end_lineno=None,
+ end_col_offset=None,
+ parent=None,
+ ),
+ end_lineno=0,
+ end_col_offset=0,
+ )
splat_node.value = arg
fixed_node.args = (
fixed_node.args[:idx]
diff --git a/pylint/checkers/newstyle.py b/pylint/checkers/newstyle.py
index 0aed97183..392faeaea 100644
--- a/pylint/checkers/newstyle.py
+++ b/pylint/checkers/newstyle.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for new / old style related problems."""
diff --git a/pylint/checkers/non_ascii_names.py b/pylint/checkers/non_ascii_names.py
index 455e575ad..825db1b11 100644
--- a/pylint/checkers/non_ascii_names.py
+++ b/pylint/checkers/non_ascii_names.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""All alphanumeric unicode character are allowed in Python but due
to similarities in how they look they can be confused.
diff --git a/pylint/checkers/raw_metrics.py b/pylint/checkers/raw_metrics.py
index 3469dc15e..ef4535345 100644
--- a/pylint/checkers/raw_metrics.py
+++ b/pylint/checkers/raw_metrics.py
@@ -1,22 +1,16 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-import sys
import tokenize
-from typing import TYPE_CHECKING, Any, cast
+from typing import TYPE_CHECKING, Any, Literal, cast
from pylint.checkers import BaseTokenChecker
from pylint.reporters.ureports.nodes import Paragraph, Section, Table, Text
from pylint.utils import LinterStats, diff_string
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
if TYPE_CHECKING:
from pylint.lint import PyLinter
diff --git a/pylint/checkers/refactoring/__init__.py b/pylint/checkers/refactoring/__init__.py
index d215dcee2..785ce3f96 100644
--- a/pylint/checkers/refactoring/__init__.py
+++ b/pylint/checkers/refactoring/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Looks for code which can be refactored."""
diff --git a/pylint/checkers/refactoring/implicit_booleaness_checker.py b/pylint/checkers/refactoring/implicit_booleaness_checker.py
index 73503f8e6..5b91990b0 100644
--- a/pylint/checkers/refactoring/implicit_booleaness_checker.py
+++ b/pylint/checkers/refactoring/implicit_booleaness_checker.py
@@ -1,9 +1,11 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
+import itertools
+
import astroid
from astroid import bases, nodes, util
@@ -12,6 +14,14 @@ from pylint.checkers import utils
from pylint.interfaces import HIGH, INFERENCE
+def _is_constant_zero(node: str | nodes.NodeNG) -> bool:
+ # We have to check that node.value is not False because node.value == 0 is True
+ # when node.value is False
+ return (
+ isinstance(node, astroid.Const) and node.value == 0 and node.value is not False
+ )
+
+
class ImplicitBooleanessChecker(checkers.BaseChecker):
"""Checks for incorrect usage of comparisons or len() inside conditions.
@@ -56,23 +66,47 @@ class ImplicitBooleanessChecker(checkers.BaseChecker):
"C1802": (
"Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty",
"use-implicit-booleaness-not-len",
- "Used when Pylint detects that len(sequence) is being used "
- "without explicit comparison inside a condition to determine if a sequence is empty. "
- "Instead of coercing the length to a boolean, either "
- "rely on the fact that empty sequences are false or "
- "compare the length against a scalar.",
+ "Empty sequences are considered false in a boolean context. You can either"
+ " remove the call to 'len' (``if not x``) or compare the length against a"
+ "scalar (``if len(x) > 1``).",
{"old_names": [("C1801", "len-as-condition")]},
),
"C1803": (
- "'%s' can be simplified to '%s' as an empty %s is falsey",
+ '"%s" can be simplified to "%s", if it is strictly a sequence, as an empty %s is falsey',
"use-implicit-booleaness-not-comparison",
- "Used when Pylint detects that collection literal comparison is being "
- "used to check for emptiness; Use implicit booleaness instead "
- "of a collection classes; empty collections are considered as false",
+ "Empty sequences are considered false in a boolean context. Following this"
+ " check blindly in weakly typed code base can create hard to debug issues."
+ " If the value can be something else that is falsey but not a sequence (for"
+ " example ``None``, an empty string, or ``0``) the code will not be "
+ "equivalent.",
+ ),
+ "C1804": (
+ '"%s" can be simplified to "%s", if it is striclty a string, as an empty string is falsey',
+ "use-implicit-booleaness-not-comparison-to-string",
+ "Empty string are considered false in a boolean context. Following this"
+ " check blindly in weakly typed code base can create hard to debug issues."
+ " If the value can be something else that is falsey but not a string (for"
+ " example ``None``, an empty sequence, or ``0``) the code will not be "
+ "equivalent.",
+ {
+ "default_enabled": False,
+ "old_names": [("C1901", "compare-to-empty-string")],
+ },
+ ),
+ "C1805": (
+ '"%s" can be simplified to "%s", if it is strictly an int, as 0 is falsey',
+ "use-implicit-booleaness-not-comparison-to-zero",
+ "0 is considered false in a boolean context. Following this"
+ " check blindly in weakly typed code base can create hard to debug issues."
+ " If the value can be something else that is falsey but not an int (for"
+ " example ``None``, an empty string, or an empty sequence) the code will not be "
+ "equivalent.",
+ {"default_enabled": False, "old_names": [("C2001", "compare-to-zero")]},
),
}
options = ()
+ _operators = {"!=", "==", "is not", "is"}
@utils.only_required_for_messages("use-implicit-booleaness-not-len")
def visit_call(self, node: nodes.Call) -> None:
@@ -146,9 +180,83 @@ class ImplicitBooleanessChecker(checkers.BaseChecker):
"use-implicit-booleaness-not-len", node=node, confidence=HIGH
)
- @utils.only_required_for_messages("use-implicit-booleaness-not-comparison")
+ @utils.only_required_for_messages(
+ "use-implicit-booleaness-not-comparison",
+ "use-implicit-booleaness-not-comparison-to-string",
+ "use-implicit-booleaness-not-comparison-to-zero",
+ )
def visit_compare(self, node: nodes.Compare) -> None:
- self._check_use_implicit_booleaness_not_comparison(node)
+ if self.linter.is_message_enabled("use-implicit-booleaness-not-comparison"):
+ self._check_use_implicit_booleaness_not_comparison(node)
+ if self.linter.is_message_enabled(
+ "use-implicit-booleaness-not-comparison-to-zero"
+ ) or self.linter.is_message_enabled(
+ "use-implicit-booleaness-not-comparison-to-str"
+ ):
+ self._check_compare_to_str_or_zero(node)
+
+ def _check_compare_to_str_or_zero(self, node: nodes.Compare) -> None:
+ # note: astroid.Compare has the left most operand in node.left
+ # while the rest are a list of tuples in node.ops
+ # the format of the tuple is ('compare operator sign', node)
+ # here we squash everything into `ops` to make it easier for processing later
+ ops: list[tuple[str, nodes.NodeNG]] = [("", node.left), *node.ops]
+ iter_ops = iter(ops)
+ all_ops = list(itertools.chain(*iter_ops))
+ for ops_idx in range(len(all_ops) - 2):
+ op_2 = all_ops[ops_idx + 1]
+ if op_2 not in self._operators:
+ continue
+ op_1 = all_ops[ops_idx]
+ op_3 = all_ops[ops_idx + 2]
+ error_detected = False
+ if self.linter.is_message_enabled(
+ "use-implicit-booleaness-not-comparison-to-zero"
+ ):
+ # 0 ?? X
+ if _is_constant_zero(op_1):
+ error_detected = True
+ op = op_3
+ # X ?? 0
+ elif _is_constant_zero(op_3):
+ error_detected = True
+ op = op_1
+ if error_detected:
+ original = f"{op_1.as_string()} {op_2} {op_3.as_string()}"
+ suggestion = (
+ op.as_string()
+ if op_2 in {"!=", "is not"}
+ else f"not {op.as_string()}"
+ )
+ self.add_message(
+ "use-implicit-booleaness-not-comparison-to-zero",
+ args=(original, suggestion),
+ node=node,
+ confidence=HIGH,
+ )
+ error_detected = False
+ if self.linter.is_message_enabled(
+ "use-implicit-booleaness-not-comparison-to-str"
+ ):
+ node_name = ""
+ # x ?? ""
+ if utils.is_empty_str_literal(op_1):
+ error_detected = True
+ node_name = op_3.as_string()
+ # '' ?? X
+ elif utils.is_empty_str_literal(op_3):
+ error_detected = True
+ node_name = op_1.as_string()
+ if error_detected:
+ suggestion = (
+ f"not {node_name}" if op_2 in {"==", "is"} else node_name
+ )
+ self.add_message(
+ "use-implicit-booleaness-not-comparison-to-string",
+ args=(node.as_string(), suggestion),
+ node=node,
+ confidence=HIGH,
+ )
def _check_use_implicit_booleaness_not_comparison(
self, node: nodes.Compare
diff --git a/pylint/checkers/refactoring/not_checker.py b/pylint/checkers/refactoring/not_checker.py
index e356a70e1..555e21099 100644
--- a/pylint/checkers/refactoring/not_checker.py
+++ b/pylint/checkers/refactoring/not_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import astroid
from astroid import nodes
diff --git a/pylint/checkers/refactoring/recommendation_checker.py b/pylint/checkers/refactoring/recommendation_checker.py
index 3a6d1033c..db2e2f604 100644
--- a/pylint/checkers/refactoring/recommendation_checker.py
+++ b/pylint/checkers/refactoring/recommendation_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -54,10 +54,10 @@ class RecommendationChecker(checkers.BaseChecker):
"are more efficient than ``sets``.",
),
"C0209": (
- "Formatting a regular string which could be a f-string",
+ "Formatting a regular string which could be an f-string",
"consider-using-f-string",
"Used when we detect a string that is being formatted with format() or % "
- "which could potentially be a f-string. The use of f-strings is preferred. "
+ "which could potentially be an f-string. The use of f-strings is preferred. "
"Requires Python 3.6 and ``py-version >= 3.6``.",
),
}
diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py
index ec4d3d71e..5d0a2dd7a 100644
--- a/pylint/checkers/refactoring/refactoring_checker.py
+++ b/pylint/checkers/refactoring/refactoring_checker.py
@@ -1,16 +1,15 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import collections
import copy
import itertools
-import sys
import tokenize
from collections.abc import Iterator
-from functools import reduce
+from functools import cached_property, reduce
from re import Pattern
from typing import TYPE_CHECKING, Any, NamedTuple, Union, cast
@@ -27,10 +26,6 @@ from pylint.interfaces import HIGH, INFERENCE, Confidence
if TYPE_CHECKING:
from pylint.lint import PyLinter
-if sys.version_info >= (3, 8):
- from functools import cached_property
-else:
- from astroid.decorators import cachedproperty as cached_property
NodesWithNestedBlocks = Union[
nodes.TryExcept, nodes.TryFinally, nodes.While, nodes.For, nodes.If
@@ -98,7 +93,7 @@ def _is_trailing_comma(tokens: list[tokenize.TokenInfo], index: int) -> bool:
if token.exact_type != tokenize.COMMA:
return False
# Must have remaining tokens on the same line such as NEWLINE
- left_tokens = list(itertools.islice(tokens, index + 1, None))
+ left_tokens = itertools.islice(tokens, index + 1, None)
more_tokens_on_line = False
for remaining_token in left_tokens:
@@ -644,9 +639,10 @@ class RefactoringChecker(checkers.BaseTokenChecker):
# token[2] is the actual position and also is
# reported by IronPython.
self._elifs.extend([token[2], tokens[index + 1][2]])
- elif _is_trailing_comma(tokens, index):
- if self.linter.is_message_enabled("trailing-comma-tuple"):
- self.add_message("trailing-comma-tuple", line=token.start[0])
+ elif self.linter.is_message_enabled(
+ "trailing-comma-tuple"
+ ) and _is_trailing_comma(tokens, index):
+ self.add_message("trailing-comma-tuple", line=token.start[0])
@utils.only_required_for_messages("consider-using-with")
def leave_module(self, _: nodes.Module) -> None:
@@ -1060,8 +1056,8 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _check_consider_using_generator(self, node: nodes.Call) -> None:
# 'any', 'all', definitely should use generator, while 'list', 'tuple',
# 'sum', 'max', and 'min' need to be considered first
- # See https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109
- # https://github.com/PyCQA/pylint/pull/6595#issuecomment-1125704244
+ # See https://github.com/pylint-dev/pylint/pull/3309#discussion_r576683109
+ # https://github.com/pylint-dev/pylint/pull/6595#issuecomment-1125704244
# and https://peps.python.org/pep-0289/
checked_call = ["any", "all", "sum", "max", "min", "list", "tuple"]
if (
@@ -1175,7 +1171,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
if len(node.args) == 0:
# handle case when builtin.next is called without args.
- # see https://github.com/PyCQA/pylint/issues/7828
+ # see https://github.com/pylint-dev/pylint/issues/7828
return
inferred = utils.safe_infer(node.func)
diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py
index 2cfba16bf..2b08204f2 100644
--- a/pylint/checkers/similar.py
+++ b/pylint/checkers/similar.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""A similarities / code duplication command line tool and pylint checker.
@@ -848,15 +848,17 @@ class SimilarChecker(BaseRawFileChecker, Similar):
stream must implement the readlines method
"""
if self.linter.current_name is None:
+ # TODO: 3.0 Fix current_name
warnings.warn(
(
"In pylint 3.0 the current_name attribute of the linter object should be a string. "
"If unknown it should be initialized as an empty string."
),
DeprecationWarning,
+ stacklevel=2,
)
with node.stream() as stream:
- self.append_stream(self.linter.current_name, stream, node.file_encoding) # type: ignore[arg-type]
+ self.append_stream(self.linter.current_name, stream, node.file_encoding)
def close(self) -> None:
"""Compute and display similarities on closing (i.e. end of parsing)."""
diff --git a/pylint/checkers/spelling.py b/pylint/checkers/spelling.py
index 3fbd017f8..91161c60d 100644
--- a/pylint/checkers/spelling.py
+++ b/pylint/checkers/spelling.py
@@ -1,27 +1,21 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker for spelling errors in comments and docstrings."""
from __future__ import annotations
import re
-import sys
import tokenize
from re import Pattern
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING, Any, Literal
from astroid import nodes
from pylint.checkers import BaseTokenChecker
from pylint.checkers.utils import only_required_for_messages
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
if TYPE_CHECKING:
from pylint.lint import PyLinter
diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py
index 96b273c74..edc79867f 100644
--- a/pylint/checkers/stdlib.py
+++ b/pylint/checkers/stdlib.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checkers for various standard library functions."""
@@ -25,7 +25,7 @@ if TYPE_CHECKING:
DeprecationDict = Dict[Tuple[int, int, int], Set[str]]
OPEN_FILES_MODE = ("open", "file")
-OPEN_FILES_FUNCS = OPEN_FILES_MODE + ("read_text", "write_text")
+OPEN_FILES_FUNCS = (*OPEN_FILES_MODE, "read_text", "write_text")
UNITTEST_CASE = "unittest.case"
THREADING_THREAD = "threading.Thread"
COPY_COPY = "copy.copy"
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py
index 380d87fb0..2cc780da5 100644
--- a/pylint/checkers/strings.py
+++ b/pylint/checkers/strings.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker for string formatting operations."""
@@ -8,11 +8,10 @@ from __future__ import annotations
import collections
import re
-import sys
import tokenize
from collections import Counter
from collections.abc import Iterable, Sequence
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Literal
import astroid
from astroid import bases, nodes, util
@@ -26,11 +25,6 @@ from pylint.typing import MessageDefinitionTuple
if TYPE_CHECKING:
from pylint.lint import PyLinter
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
_AST_NODE_STR_TYPES = ("__builtin__.unicode", "__builtin__.str", "builtins.str")
# Prefixes for both strings and bytes literals per
@@ -816,7 +810,7 @@ class StringConstantChecker(BaseTokenChecker, BaseRawFileChecker):
token_index = (elt.lineno, elt.col_offset)
if token_index not in self.string_tokens:
# This may happen with Latin1 encoding
- # cf. https://github.com/PyCQA/pylint/issues/2610
+ # cf. https://github.com/pylint-dev/pylint/issues/2610
continue
matching_token, next_token = self.string_tokens[token_index]
# We detect string concatenation: the AST Const is the
diff --git a/pylint/checkers/threading_checker.py b/pylint/checkers/threading_checker.py
index df0dfe7cf..b289d6707 100644
--- a/pylint/checkers/threading_checker.py
+++ b/pylint/checkers/threading_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py
index 1a628f231..97a7460a8 100644
--- a/pylint/checkers/typecheck.py
+++ b/pylint/checkers/typecheck.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Try to find more bugs in the code using astroid inference capabilities."""
@@ -14,9 +14,9 @@ import shlex
import sys
import types
from collections.abc import Callable, Iterable, Iterator, Sequence
-from functools import singledispatch
+from functools import cached_property, singledispatch
from re import Pattern
-from typing import TYPE_CHECKING, Any, TypeVar, Union
+from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union
import astroid
import astroid.exceptions
@@ -53,13 +53,6 @@ from pylint.constants import PY310_PLUS
from pylint.interfaces import HIGH, INFERENCE
from pylint.typing import MessageDefinitionTuple
-if sys.version_info >= (3, 8):
- from functools import cached_property
- from typing import Literal
-else:
- from astroid.decorators import cachedproperty as cached_property
- from typing_extensions import Literal
-
if TYPE_CHECKING:
from pylint.lint import PyLinter
@@ -125,7 +118,7 @@ def _is_owner_ignored(
matches any name from the *ignored_classes* or if its qualified
name can be found in *ignored_classes*.
"""
- if is_module_ignored(owner.root(), ignored_modules):
+ if is_module_ignored(owner.root().qname(), ignored_modules):
return True
# Match against ignored classes.
@@ -158,7 +151,7 @@ def _(node: nodes.ClassDef | bases.Instance) -> Iterable[str]:
def _string_distance(seq1: str, seq2: str) -> int:
seq2_length = len(seq2)
- row = list(range(1, seq2_length + 1)) + [0]
+ row = [*list(range(1, seq2_length + 1)), 0]
for seq1_index, seq1_char in enumerate(seq1):
last_row = row
row = [0] * seq2_length + [seq1_index + 1]
@@ -733,7 +726,9 @@ def _no_context_variadic(
else:
inferred_statement = inferred.statement(future=True)
- if not length and isinstance(inferred_statement, nodes.Lambda):
+ if not length and isinstance(
+ inferred_statement, (nodes.Lambda, nodes.FunctionDef)
+ ):
is_in_starred_context = _has_parent_of_type(node, variadic_type, statement)
used_as_starred_argument = any(
variadic.value == name or variadic.value.parent_of(name)
@@ -1569,6 +1564,11 @@ accessed. Python regular expressions are accepted.",
node=node,
args=(keyword, callable_name),
)
+ elif (
+ keyword in [arg.name for arg in called.args.posonlyargs]
+ and called.args.kwarg
+ ):
+ pass
else:
parameters[i] = (parameters[i][0], True)
elif keyword in kwparams:
@@ -1654,7 +1654,7 @@ accessed. Python regular expressions are accepted.",
if not isinstance(inferred, nodes.FunctionDef):
return False
- for return_value in inferred.infer_call_result():
+ for return_value in inferred.infer_call_result(caller=None):
# infer_call_result() returns nodes.Const.None for None return values
# so this also catches non-returning decorators
if not isinstance(return_value, nodes.FunctionDef):
@@ -1685,9 +1685,9 @@ accessed. Python regular expressions are accepted.",
# Determine what method on the parent this index will use
# The parent of this node will be a Subscript, and the parent of that
# node determines if the Subscript is a get, set, or delete operation.
- if subscript.ctx is astroid.Store:
+ if subscript.ctx is astroid.Context.Store:
methodname = "__setitem__"
- elif subscript.ctx is astroid.Del:
+ elif subscript.ctx is astroid.Context.Del:
methodname = "__delitem__"
else:
methodname = "__getitem__"
@@ -2015,7 +2015,7 @@ accessed. Python regular expressions are accepted.",
# TODO: This check was disabled (by adding the leading underscore)
# due to false positives several years ago - can we re-enable it?
- # https://github.com/PyCQA/pylint/issues/6359
+ # https://github.com/pylint-dev/pylint/issues/6359
@only_required_for_messages("unsupported-binary-operation")
def _visit_binop(self, node: nodes.BinOp) -> None:
"""Detect TypeErrors for binary arithmetic operands."""
@@ -2023,7 +2023,7 @@ accessed. Python regular expressions are accepted.",
# TODO: This check was disabled (by adding the leading underscore)
# due to false positives several years ago - can we re-enable it?
- # https://github.com/PyCQA/pylint/issues/6359
+ # https://github.com/pylint-dev/pylint/issues/6359
@only_required_for_messages("unsupported-binary-operation")
def _visit_augassign(self, node: nodes.AugAssign) -> None:
"""Detect TypeErrors for augmented binary arithmetic operands."""
@@ -2109,13 +2109,13 @@ accessed. Python regular expressions are accepted.",
confidence=INFERENCE,
)
- if node.ctx == astroid.Load:
+ if node.ctx == astroid.Context.Load:
supported_protocol = supports_getitem
msg = "unsubscriptable-object"
- elif node.ctx == astroid.Store:
+ elif node.ctx == astroid.Context.Store:
supported_protocol = supports_setitem
msg = "unsupported-assignment-operation"
- elif node.ctx == astroid.Del:
+ elif node.ctx == astroid.Context.Del:
supported_protocol = supports_delitem
msg = "unsupported-delete-operation"
diff --git a/pylint/checkers/unicode.py b/pylint/checkers/unicode.py
index c7e011b6f..ab8410c3e 100644
--- a/pylint/checkers/unicode.py
+++ b/pylint/checkers/unicode.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unicode and some other ASCII characters can be used to create programs that run
much different compared to what a human reader would expect from them.
diff --git a/pylint/checkers/unsupported_version.py b/pylint/checkers/unsupported_version.py
index 0c4a7c5bb..64f2630d8 100644
--- a/pylint/checkers/unsupported_version.py
+++ b/pylint/checkers/unsupported_version.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker for features used that are not supported by all python versions
indicated by the py-version setting.
@@ -34,7 +34,7 @@ class UnsupportedVersionChecker(BaseChecker):
"F-strings are not supported by all versions included in the py-version setting",
"using-f-string-in-unsupported-version",
"Used when the py-version set by the user is lower than 3.6 and pylint encounters "
- "a f-string.",
+ "an f-string.",
),
"W2602": (
"typing.final is not supported by all versions included in the py-version setting",
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index 771b21fff..6b66ad620 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Some functions that may be useful for various checkers."""
@@ -12,8 +12,6 @@ import itertools
import numbers
import re
import string
-import warnings
-from collections import deque
from collections.abc import Iterable, Iterator
from functools import lru_cache, partial
from re import Match
@@ -249,17 +247,6 @@ class InferredTypeError(Exception):
pass
-def is_inside_lambda(node: nodes.NodeNG) -> bool:
- """Return whether the given node is inside a lambda."""
- warnings.warn(
- "utils.is_inside_lambda will be removed in favour of calling "
- "utils.get_node_first_ancestor_of_type(x, nodes.Lambda) in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- return any(isinstance(parent, nodes.Lambda) for parent in node.node_ancestors())
-
-
def get_all_elements(
node: nodes.NodeNG,
) -> Iterable[nodes.NodeNG]:
@@ -369,9 +356,10 @@ def is_defined_before(var_node: nodes.Name) -> bool:
if defnode is None:
continue
defnode_scope = defnode.scope()
- if isinstance(defnode_scope, COMP_NODE_TYPES + (nodes.Lambda,)):
+ if isinstance(
+ defnode_scope, (*COMP_NODE_TYPES, nodes.Lambda, nodes.FunctionDef)
+ ):
# Avoid the case where var_node_scope is a nested function
- # FunctionDef is a Lambda until https://github.com/PyCQA/astroid/issues/291
if isinstance(defnode_scope, nodes.FunctionDef):
var_node_scope = var_node.scope()
if var_node_scope is not defnode_scope and isinstance(
@@ -505,25 +493,6 @@ def only_required_for_messages(
return store_messages
-def check_messages(
- *messages: str,
-) -> Callable[
- [AstCallbackMethod[_CheckerT, _NodeT]], AstCallbackMethod[_CheckerT, _NodeT]
-]:
- """Kept for backwards compatibility, deprecated.
-
- Use only_required_for_messages instead, which conveys the intent of the decorator much clearer.
- """
- warnings.warn(
- "utils.check_messages will be removed in favour of calling "
- "utils.only_required_for_messages in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
-
- return only_required_for_messages(*messages)
-
-
class IncompleteFormatString(Exception):
"""A format string ended in the middle of a format specifier."""
@@ -1162,6 +1131,7 @@ def node_ignores_exception(
return any(get_contextlib_suppressors(node, exception))
+@lru_cache(maxsize=1024)
def class_is_abstract(node: nodes.ClassDef) -> bool:
"""Return true if the given class node should be considered as an abstract
class.
@@ -1572,27 +1542,6 @@ def is_postponed_evaluation_enabled(node: nodes.NodeNG) -> bool:
return "annotations" in module.future_imports
-def is_class_subscriptable_pep585_with_postponed_evaluation_enabled(
- value: nodes.ClassDef, node: nodes.NodeNG
-) -> bool:
- """Check if class is subscriptable with PEP 585 and
- postponed evaluation enabled.
- """
- warnings.warn(
- "'is_class_subscriptable_pep585_with_postponed_evaluation_enabled' has been "
- "deprecated and will be removed in pylint 3.0. "
- "Use 'is_postponed_evaluation_enabled(node) and "
- "is_node_in_type_annotation_context(node)' instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- return (
- is_postponed_evaluation_enabled(node)
- and value.qname() in SUBSCRIPTABLE_CLASSES_PEP585
- and is_node_in_type_annotation_context(node)
- )
-
-
def is_node_in_type_annotation_context(node: nodes.NodeNG) -> bool:
"""Check if node is in type annotation context.
@@ -1843,48 +1792,6 @@ def is_sys_guard(node: nodes.If) -> bool:
return False
-def is_typing_guard(node: nodes.If) -> bool:
- """Return True if IF stmt is a typing guard.
-
- >>> from typing import TYPE_CHECKING
- >>> if TYPE_CHECKING:
- >>> from xyz import a
- """
- warnings.warn(
- "This method will be removed in pylint 3.0; use in_type_checking_block() instead.",
- DeprecationWarning,
- stacklevel=2,
- ) # pragma: no cover
- return isinstance(
- node.test, (nodes.Name, nodes.Attribute)
- ) and node.test.as_string().endswith("TYPE_CHECKING")
-
-
-def is_node_in_typing_guarded_import_block(node: nodes.NodeNG) -> bool:
- """Return True if node is part for guarded `typing.TYPE_CHECKING` if block."""
- warnings.warn(
- "This method will be removed in pylint 3.0; use in_type_checking_block() instead.",
- DeprecationWarning,
- stacklevel=2,
- ) # pragma: no cover
- return isinstance(node.parent, nodes.If) and is_typing_guard(node.parent)
-
-
-def is_node_in_guarded_import_block(node: nodes.NodeNG) -> bool:
- """Return True if node is part for guarded if block.
-
- I.e. `sys.version_info` or `typing.TYPE_CHECKING`
- """
- warnings.warn(
- "This method will be removed in pylint 3.0; use in_type_checking_block() instead.",
- DeprecationWarning,
- stacklevel=2,
- ) # pragma: no cover
- return isinstance(node.parent, nodes.If) and (
- is_sys_guard(node.parent) or is_typing_guard(node.parent)
- )
-
-
def is_reassigned_after_current(node: nodes.NodeNG, varname: str) -> bool:
"""Check if the given variable name is reassigned in the same scope after the
current node.
@@ -2035,7 +1942,7 @@ def is_typing_member(node: nodes.NodeNG, names_to_check: tuple[str, ...]) -> boo
return False
-@lru_cache()
+@lru_cache
def in_for_else_branch(parent: nodes.NodeNG, stmt: nodes.Statement) -> bool:
"""Returns True if stmt is inside the else branch for a parent For stmt."""
return isinstance(parent, nodes.For) and any(
@@ -2144,37 +2051,30 @@ def is_augmented_assign(node: nodes.Assign) -> tuple[bool, str]:
return False, ""
+def _qualified_name_parts(qualified_module_name: str) -> list[str]:
+ """Split the names of the given module into subparts.
+
+ For example,
+ _qualified_name_parts('pylint.checkers.ImportsChecker')
+ returns
+ ['pylint', 'pylint.checkers', 'pylint.checkers.ImportsChecker']
+ """
+ names = qualified_module_name.split(".")
+ return [".".join(names[0 : i + 1]) for i in range(len(names))]
+
+
def is_module_ignored(
- module: nodes.Module,
- ignored_modules: Iterable[str],
+ qualified_module_name: str, ignored_modules: Iterable[str]
) -> bool:
ignored_modules = set(ignored_modules)
- module_name = module.name
- module_qname = module.qname()
-
- for ignore in ignored_modules:
- # Try to match the module name / fully qualified name directly
- if module_qname in ignored_modules or module_name in ignored_modules:
- return True
-
- # Try to see if the ignores pattern match against the module name.
- if fnmatch.fnmatch(module_qname, ignore):
+ for current_module in _qualified_name_parts(qualified_module_name):
+ # Try to match the module name directly
+ if current_module in ignored_modules:
return True
-
- # Otherwise, we might have a root module name being ignored,
- # and the qualified owner has more levels of depth.
- parts = deque(module_name.split("."))
- current_module = ""
-
- while parts:
- part = parts.popleft()
- if not current_module:
- current_module = part
- else:
- current_module += f".{part}"
- if current_module in ignored_modules:
+ for ignore in ignored_modules:
+ # Try to see if the ignores pattern match against the module name.
+ if fnmatch.fnmatch(current_module, ignore):
return True
-
return False
@@ -2214,53 +2114,6 @@ def is_class_attr(name: str, klass: nodes.ClassDef) -> bool:
return False
-def is_defined(name: str, node: nodes.NodeNG) -> bool:
- """Searches for a tree node that defines the given variable name."""
- is_defined_so_far = False
-
- if isinstance(node, nodes.NamedExpr):
- is_defined_so_far = node.target.name == name
-
- if isinstance(node, (nodes.Import, nodes.ImportFrom)):
- is_defined_so_far = any(node_name[0] == name for node_name in node.names)
-
- if isinstance(node, nodes.With):
- is_defined_so_far = any(
- isinstance(item[1], nodes.AssignName) and item[1].name == name
- for item in node.items
- )
-
- if isinstance(node, (nodes.ClassDef, nodes.FunctionDef)):
- is_defined_so_far = node.name == name
-
- if isinstance(node, nodes.AnnAssign):
- is_defined_so_far = (
- node.value
- and isinstance(node.target, nodes.AssignName)
- and node.target.name == name
- )
-
- if isinstance(node, nodes.Assign):
- is_defined_so_far = any(
- any(
- (
- (
- isinstance(elt, nodes.Starred)
- and isinstance(elt.value, nodes.AssignName)
- and elt.value.name == name
- )
- or (isinstance(elt, nodes.AssignName) and elt.name == name)
- )
- for elt in get_all_elements(target)
- )
- for target in node.targets
- )
-
- return is_defined_so_far or any(
- is_defined(name, child) for child in node.get_children()
- )
-
-
def get_inverse_comparator(op: str) -> str:
"""Returns the inverse comparator given a comparator.
@@ -2317,12 +2170,30 @@ def not_condition_as_string(
return msg
+@lru_cache(maxsize=1000)
+def overridden_method(
+ klass: nodes.LocalsDictNodeNG, name: str | None
+) -> nodes.FunctionDef | None:
+ """Get overridden method if any."""
+ try:
+ parent = next(klass.local_attr_ancestors(name))
+ except (StopIteration, KeyError):
+ return None
+ try:
+ meth_node = parent[name]
+ except KeyError: # pragma: no cover
+ # We have found an ancestor defining <name> but it's not in the local
+ # dictionary. This may happen with astroid built from living objects.
+ return None
+ if isinstance(meth_node, nodes.FunctionDef):
+ return meth_node
+ return None # pragma: no cover
+
+
def clear_lru_caches() -> None:
"""Clear caches holding references to AST nodes."""
- # pylint: disable-next=import-outside-toplevel
- from pylint.checkers.variables import overridden_method
-
caches_holding_node_references: list[_lru_cache_wrapper[Any]] = [
+ class_is_abstract,
in_for_else_branch,
infer_all,
is_overload_stub,
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index 8cd1ed83c..2504c0c84 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Variables checkers for Python code."""
@@ -11,11 +11,10 @@ import copy
import itertools
import os
import re
-import sys
from collections import defaultdict
from collections.abc import Generator, Iterable, Iterator
from enum import Enum
-from functools import lru_cache
+from functools import cached_property
from typing import TYPE_CHECKING, Any, NamedTuple
import astroid
@@ -26,18 +25,15 @@ from astroid.typing import InferenceResult
from pylint.checkers import BaseChecker, utils
from pylint.checkers.utils import (
in_type_checking_block,
+ is_module_ignored,
is_postponed_evaluation_enabled,
is_sys_guard,
+ overridden_method,
)
from pylint.constants import PY39_PLUS, TYPING_NEVER, TYPING_NORETURN
from pylint.interfaces import CONTROL_FLOW, HIGH, INFERENCE, INFERENCE_FAILURE
from pylint.typing import MessageDefinitionTuple
-if sys.version_info >= (3, 8):
- from functools import cached_property
-else:
- from astroid.decorators import cachedproperty as cached_property
-
if TYPE_CHECKING:
from pylint.lint import PyLinter
@@ -151,26 +147,6 @@ def _is_from_future_import(stmt: nodes.ImportFrom, name: str) -> bool | None:
return None
-@lru_cache(maxsize=1000)
-def overridden_method(
- klass: nodes.LocalsDictNodeNG, name: str | None
-) -> nodes.FunctionDef | None:
- """Get overridden method if any."""
- try:
- parent = next(klass.local_attr_ancestors(name))
- except (StopIteration, KeyError):
- return None
- try:
- meth_node = parent[name]
- except KeyError:
- # We have found an ancestor defining <name> but it's not in the local
- # dictionary. This may happen with astroid built from living objects.
- return None
- if isinstance(meth_node, nodes.FunctionDef):
- return meth_node
- return None
-
-
def _get_unpacking_extra_info(node: nodes.Assign, inferred: InferenceResult) -> str:
"""Return extra information to add to the message for unpacking-non-sequence
and unbalanced-tuple/dict-unpacking errors.
@@ -242,17 +218,11 @@ def _detect_global_scope(
return node.lineno < defframe.lineno # type: ignore[no-any-return]
if not isinstance(node.parent, (nodes.FunctionDef, nodes.Arguments)):
return False
- elif any(
- not isinstance(f, (nodes.ClassDef, nodes.Module)) for f in (frame, defframe)
- ):
- # Not interested in other frames, since they are already
- # not in a global scope.
- return False
break_scopes = []
- for current_scope in (scope, def_scope):
+ for current_scope in (scope or frame, def_scope):
# Look for parent scopes. If there is anything different
- # than a module or a class scope, then they frames don't
+ # than a module or a class scope, then the frames don't
# share a global scope.
parent_scope = current_scope
while parent_scope:
@@ -263,7 +233,7 @@ def _detect_global_scope(
parent_scope = parent_scope.parent.scope()
else:
break
- if break_scopes and len(set(break_scopes)) != 1:
+ if len(set(break_scopes)) > 1:
# Store different scopes than expected.
# If the stored scopes are, in fact, the very same, then it means
# that the two frames (frame and defframe) share the same scope,
@@ -564,7 +534,6 @@ class NamesConsumer:
copy.copy(node.locals), {}, collections.defaultdict(list), scope_type
)
self.node = node
- self._if_nodes_deemed_uncertain: set[nodes.If] = set()
def __repr__(self) -> str:
_to_consumes = [f"{k}->{v}" for k, v in self._atomic.to_consume.items()]
@@ -715,26 +684,28 @@ scope_type : {self._atomic.scope_type}
return found_nodes
@staticmethod
- def _exhaustively_define_name_raise_or_return(
- name: str, node: nodes.NodeNG
- ) -> bool:
- """Return True if there is a collectively exhaustive set of paths under
- this `if_node` that define `name`, raise, or return.
+ def _inferred_to_define_name_raise_or_return(name: str, node: nodes.NodeNG) -> bool:
+ """Return True if there is a path under this `if_node`
+ that is inferred to define `name`, raise, or return.
"""
# Handle try and with
if isinstance(node, (nodes.TryExcept, nodes.TryFinally)):
# Allow either a path through try/else/finally OR a path through ALL except handlers
- return (
- NamesConsumer._defines_name_raises_or_returns_recursive(name, node)
- or isinstance(node, nodes.TryExcept)
- and all(
- NamesConsumer._defines_name_raises_or_returns_recursive(
- name, handler
- )
- for handler in node.handlers
+ try_except_node = node
+ if isinstance(node, nodes.TryFinally):
+ try_except_node = next(
+ (child for child in node.nodes_of_class(nodes.TryExcept)),
+ None,
)
+ handlers = try_except_node.handlers if try_except_node else []
+ return NamesConsumer._defines_name_raises_or_returns_recursive(
+ name, node
+ ) or all(
+ NamesConsumer._defines_name_raises_or_returns_recursive(name, handler)
+ for handler in handlers
)
- if isinstance(node, nodes.With):
+
+ if isinstance(node, (nodes.With, nodes.For, nodes.While)):
return NamesConsumer._defines_name_raises_or_returns_recursive(name, node)
if not isinstance(node, nodes.If):
@@ -748,13 +719,29 @@ scope_type : {self._atomic.scope_type}
if NamesConsumer._defines_name_raises_or_returns(name, node):
return True
- # If there is no else, then there is no collectively exhaustive set of paths
- if not node.orelse:
- return False
+ test = node.test.value if isinstance(node.test, nodes.NamedExpr) else node.test
+ all_inferred = utils.infer_all(test)
+ only_search_if = False
+ only_search_else = True
+ for inferred in all_inferred:
+ if not isinstance(inferred, nodes.Const):
+ only_search_else = False
+ continue
+ val = inferred.value
+ only_search_if = only_search_if or (val != NotImplemented and val)
+ only_search_else = only_search_else and not val
+
+ # Only search else branch when test condition is inferred to be false
+ if all_inferred and only_search_else:
+ return NamesConsumer._branch_handles_name(name, node.orelse)
+ # Only search if branch when test condition is inferred to be true
+ if all_inferred and only_search_if:
+ return NamesConsumer._branch_handles_name(name, node.body)
+ # Search both if and else branches
return NamesConsumer._branch_handles_name(
name, node.body
- ) and NamesConsumer._branch_handles_name(name, node.orelse)
+ ) or NamesConsumer._branch_handles_name(name, node.orelse)
@staticmethod
def _branch_handles_name(name: str, body: Iterable[nodes.NodeNG]) -> bool:
@@ -762,9 +749,16 @@ scope_type : {self._atomic.scope_type}
NamesConsumer._defines_name_raises_or_returns(name, if_body_stmt)
or isinstance(
if_body_stmt,
- (nodes.If, nodes.TryExcept, nodes.TryFinally, nodes.With),
+ (
+ nodes.If,
+ nodes.TryExcept,
+ nodes.TryFinally,
+ nodes.With,
+ nodes.For,
+ nodes.While,
+ ),
)
- and NamesConsumer._exhaustively_define_name_raise_or_return(
+ and NamesConsumer._inferred_to_define_name_raise_or_return(
name, if_body_stmt
)
for if_body_stmt in body
@@ -776,57 +770,80 @@ scope_type : {self._atomic.scope_type}
"""Identify nodes of uncertain execution because they are defined under
tests that evaluate false.
- Don't identify a node if there is a collectively exhaustive set of paths
- that define the name, raise, or return (e.g. every if/else branch).
+ Don't identify a node if there is a path that is inferred to
+ define the name, raise, or return (e.g. any executed if/elif/else branch).
"""
uncertain_nodes = []
for other_node in found_nodes:
- if in_type_checking_block(other_node):
- continue
-
- if not isinstance(other_node, nodes.AssignName):
+ if isinstance(other_node, nodes.AssignName):
+ name = other_node.name
+ elif isinstance(other_node, (nodes.Import, nodes.ImportFrom)):
+ name = node.name
+ else:
continue
- closest_if = utils.get_node_first_ancestor_of_type(other_node, nodes.If)
- if closest_if is None:
- continue
- if node.frame() is not closest_if.frame():
- continue
- if closest_if is not None and closest_if.parent_of(node):
+ all_if = [
+ n
+ for n in other_node.node_ancestors()
+ if isinstance(n, nodes.If) and not n.parent_of(node)
+ ]
+ if not all_if:
continue
- # Name defined in every if/else branch
- if NamesConsumer._exhaustively_define_name_raise_or_return(
- other_node.name, closest_if
+ closest_if = all_if[0]
+ if (
+ isinstance(node, nodes.AssignName)
+ and node.frame() is not closest_if.frame()
):
continue
+ if closest_if.parent_of(node):
+ continue
- # Higher-level if already determined to be always false
- if any(
- if_node.parent_of(closest_if)
- for if_node in self._if_nodes_deemed_uncertain
- ):
- uncertain_nodes.append(other_node)
+ outer_if = all_if[-1]
+ if NamesConsumer._node_guarded_by_same_test(node, outer_if):
continue
- # All inferred values must test false
- if isinstance(closest_if.test, nodes.NamedExpr):
- test = closest_if.test.value
- else:
- test = closest_if.test
- all_inferred = utils.infer_all(test)
- if not all_inferred or not all(
- isinstance(inferred, nodes.Const) and not inferred.value
- for inferred in all_inferred
- ):
+ # Name defined in the if/else control flow
+ if NamesConsumer._inferred_to_define_name_raise_or_return(name, outer_if):
continue
uncertain_nodes.append(other_node)
- self._if_nodes_deemed_uncertain.add(closest_if)
return uncertain_nodes
@staticmethod
+ def _node_guarded_by_same_test(node: nodes.NodeNG, other_if: nodes.If) -> bool:
+ """Identify if `node` is guarded by an equivalent test as `other_if`.
+
+ Two tests are equivalent if their string representations are identical
+ or if their inferred values consist only of constants and those constants
+ are identical, and the if test guarding `node` is not a Name.
+ """
+ other_if_test_as_string = other_if.test.as_string()
+ other_if_test_all_inferred = utils.infer_all(other_if.test)
+ for ancestor in node.node_ancestors():
+ if not isinstance(ancestor, nodes.If):
+ continue
+ if ancestor.test.as_string() == other_if_test_as_string:
+ return True
+ if isinstance(ancestor.test, nodes.Name):
+ continue
+ all_inferred = utils.infer_all(ancestor.test)
+ if len(all_inferred) == len(other_if_test_all_inferred):
+ if any(
+ not isinstance(test, nodes.Const)
+ for test in (*all_inferred, *other_if_test_all_inferred)
+ ):
+ continue
+ if {test.value for test in all_inferred} != {
+ test.value for test in other_if_test_all_inferred
+ }:
+ continue
+ return True
+
+ return False
+
+ @staticmethod
def _uncertain_nodes_in_except_blocks(
found_nodes: list[nodes.NodeNG],
node: nodes.NodeNG,
@@ -921,6 +938,18 @@ scope_type : {self._atomic.scope_type}
for child_named_expr in node.nodes_of_class(nodes.NamedExpr)
):
return True
+ if isinstance(node, (nodes.Import, nodes.ImportFrom)) and any(
+ (node_name[1] and node_name[1] == name) or (node_name[0] == name)
+ for node_name in node.names
+ ):
+ return True
+ if isinstance(node, nodes.With) and any(
+ isinstance(item[1], nodes.AssignName) and item[1].name == name
+ for item in node.items
+ ):
+ return True
+ if isinstance(node, (nodes.ClassDef, nodes.FunctionDef)) and node.name == name:
+ return True
return False
@staticmethod
@@ -939,18 +968,23 @@ scope_type : {self._atomic.scope_type}
for nested_stmt in stmt.get_children()
):
return True
+ if isinstance(
+ stmt, nodes.TryExcept
+ ) and NamesConsumer._defines_name_raises_or_returns_recursive(name, stmt):
+ return True
return False
@staticmethod
def _check_loop_finishes_via_except(
node: nodes.NodeNG, other_node_try_except: nodes.TryExcept
) -> bool:
- """Check for a case described in https://github.com/PyCQA/pylint/issues/5683.
+ """Check for a specific control flow scenario.
- It consists of a specific control flow scenario where the only
- non-break exit from a loop consists of the very except handler we are
- examining, such that code in the `else` branch of the loop can depend on it
- being assigned.
+ Described in https://github.com/pylint-dev/pylint/issues/5683.
+
+ A scenario where the only non-break exit from a loop consists of the very
+ except handler we are examining, such that code in the `else` branch of
+ the loop can depend on it being assigned.
Example:
@@ -1247,6 +1281,9 @@ class VariablesChecker(BaseChecker):
tuple[nodes.ExceptHandler, nodes.AssignName]
] = []
"""This is a queue, last in first out."""
+ self._evaluated_type_checking_scopes: dict[
+ str, list[nodes.LocalsDictNodeNG]
+ ] = {}
self._postponed_evaluation_enabled = False
@utils.only_required_for_messages(
@@ -1707,21 +1744,16 @@ class VariablesChecker(BaseChecker):
if found_nodes is None:
return (VariableVisitConsumerAction.CONTINUE, None)
if not found_nodes:
- if node.name in current_consumer.consumed_uncertain:
- confidence = CONTROL_FLOW
- else:
- confidence = HIGH
- self.add_message(
- "used-before-assignment",
- args=node.name,
- node=node,
- confidence=confidence,
- )
+ self._report_unfound_name_definition(node, current_consumer)
# Mark for consumption any nodes added to consumed_uncertain by
# get_next_to_consume() because they might not have executed.
+ nodes_to_consume = current_consumer.consumed_uncertain[node.name]
+ nodes_to_consume = self._filter_type_checking_import_from_consumption(
+ node, nodes_to_consume
+ )
return (
VariableVisitConsumerAction.RETURN,
- current_consumer.consumed_uncertain[node.name],
+ nodes_to_consume,
)
self._check_late_binding_closure(node)
@@ -1858,7 +1890,9 @@ class VariablesChecker(BaseChecker):
confidence=HIGH,
)
- elif self._is_only_type_assignment(node, defstmt):
+ elif not self._is_builtin(node.name) and self._is_only_type_assignment(
+ node, defstmt
+ ):
if node.scope().locals.get(node.name):
self.add_message(
"used-before-assignment", args=node.name, node=node, confidence=HIGH
@@ -1885,6 +1919,61 @@ class VariablesChecker(BaseChecker):
return (VariableVisitConsumerAction.RETURN, found_nodes)
+ def _report_unfound_name_definition(
+ self, node: nodes.NodeNG, current_consumer: NamesConsumer
+ ) -> None:
+ """Reports used-before-assignment when all name definition nodes
+ get filtered out by NamesConsumer.
+ """
+ if (
+ self._postponed_evaluation_enabled
+ and utils.is_node_in_type_annotation_context(node)
+ ):
+ return
+ if self._is_builtin(node.name):
+ return
+ if self._is_variable_annotation_in_function(node):
+ return
+ if (
+ node.name in self._evaluated_type_checking_scopes
+ and node.scope() in self._evaluated_type_checking_scopes[node.name]
+ ):
+ return
+
+ confidence = (
+ CONTROL_FLOW if node.name in current_consumer.consumed_uncertain else HIGH
+ )
+ self.add_message(
+ "used-before-assignment",
+ args=node.name,
+ node=node,
+ confidence=confidence,
+ )
+
+ def _filter_type_checking_import_from_consumption(
+ self, node: nodes.NodeNG, nodes_to_consume: list[nodes.NodeNG]
+ ) -> list[nodes.NodeNG]:
+ """Do not consume type-checking import node as used-before-assignment
+ may invoke in different scopes.
+ """
+ type_checking_import = next(
+ (
+ n
+ for n in nodes_to_consume
+ if isinstance(n, (nodes.Import, nodes.ImportFrom))
+ and in_type_checking_block(n)
+ ),
+ None,
+ )
+ # If used-before-assignment reported for usage of type checking import
+ # keep track of its scope
+ if type_checking_import and not self._is_variable_annotation_in_function(node):
+ self._evaluated_type_checking_scopes.setdefault(node.name, []).append(
+ node.scope()
+ )
+ nodes_to_consume = [n for n in nodes_to_consume if n != type_checking_import]
+ return nodes_to_consume
+
@utils.only_required_for_messages("no-name-in-module")
def visit_import(self, node: nodes.Import) -> None:
"""Check modules attribute accesses."""
@@ -2049,7 +2138,6 @@ class VariablesChecker(BaseChecker):
parent = parent.parent
return False
- # pylint: disable = too-many-branches
@staticmethod
def _is_variable_violation(
node: nodes.Name,
@@ -2203,42 +2291,6 @@ class VariablesChecker(BaseChecker):
anc is defnode.value for anc in node.node_ancestors()
)
- # Look for type checking definitions inside a type checking guard.
- # Relevant for function annotations only, not variable annotations (AnnAssign)
- if (
- isinstance(defstmt, (nodes.Import, nodes.ImportFrom))
- and isinstance(defstmt.parent, nodes.If)
- and in_type_checking_block(defstmt)
- and not in_type_checking_block(node)
- ):
- defstmt_parent = defstmt.parent
-
- maybe_annotation = utils.get_node_first_ancestor_of_type(
- node, nodes.AnnAssign
- )
- if not (
- maybe_annotation
- and utils.get_node_first_ancestor_of_type(
- maybe_annotation, nodes.FunctionDef
- )
- ):
- # Exempt those definitions that are used inside the type checking
- # guard or that are defined in any elif/else type checking guard branches.
- used_in_branch = defstmt_parent.parent_of(node)
- if not used_in_branch:
- if defstmt_parent.has_elif_block():
- defined_in_or_else = utils.is_defined(
- node.name, defstmt_parent.orelse[0]
- )
- else:
- defined_in_or_else = any(
- utils.is_defined(node.name, content)
- for content in defstmt_parent.orelse
- )
-
- if not defined_in_or_else:
- maybe_before_assign = True
-
return maybe_before_assign, annotation_return, use_outer_definition
@staticmethod
@@ -2254,7 +2306,7 @@ class VariablesChecker(BaseChecker):
return any(
VariablesChecker._maybe_used_and_assigned_at_once(elt)
for elt in defstmt.value.elts
- if isinstance(elt, NODES_WITH_VALUE_ATTR + (nodes.IfExp, nodes.Match))
+ if isinstance(elt, (*NODES_WITH_VALUE_ATTR, nodes.IfExp, nodes.Match))
)
value = defstmt.value
if isinstance(value, nodes.IfExp):
@@ -2278,18 +2330,15 @@ class VariablesChecker(BaseChecker):
for call in value.nodes_of_class(klass=nodes.Call)
)
- def _is_only_type_assignment(
- self, node: nodes.Name, defstmt: nodes.Statement
- ) -> bool:
+ def _is_builtin(self, name: str) -> bool:
+ return name in self.linter.config.additional_builtins or utils.is_builtin(name)
+
+ @staticmethod
+ def _is_only_type_assignment(node: nodes.Name, defstmt: nodes.Statement) -> bool:
"""Check if variable only gets assigned a type and never a value."""
if not isinstance(defstmt, nodes.AnnAssign) or defstmt.value:
return False
- if node.name in self.linter.config.additional_builtins or utils.is_builtin(
- node.name
- ):
- return False
-
defstmt_frame = defstmt.frame(future=True)
node_frame = node.frame(future=True)
@@ -2378,6 +2427,16 @@ class VariablesChecker(BaseChecker):
return True
return False
+ @staticmethod
+ def _is_variable_annotation_in_function(node: nodes.NodeNG) -> bool:
+ is_annotation = utils.get_node_first_ancestor_of_type(node, nodes.AnnAssign)
+ return (
+ is_annotation
+ and utils.get_node_first_ancestor_of_type( # type: ignore[return-value]
+ is_annotation, nodes.FunctionDef
+ )
+ )
+
def _ignore_class_scope(self, node: nodes.NodeNG) -> bool:
"""Return True if the node is in a local class scope, as an assignment.
@@ -2427,10 +2486,7 @@ class VariablesChecker(BaseChecker):
# the usage is safe because the function will not be defined either if
# the variable is not defined.
scope = node.scope()
- # FunctionDef subclasses Lambda due to a curious ontology. Check both.
- # See https://github.com/PyCQA/astroid/issues/291
- # TODO: Revisit when astroid 3.0 includes the change
- if isinstance(scope, nodes.Lambda) and any(
+ if isinstance(scope, (nodes.Lambda, nodes.FunctionDef)) and any(
asmt.scope().parent_of(scope) for asmt in astmts
):
return
@@ -2481,7 +2537,7 @@ class VariablesChecker(BaseChecker):
else_stmt, (nodes.Return, nodes.Raise, nodes.Break, nodes.Continue)
):
return
- # TODO: 2.16: Consider using RefactoringChecker._is_function_def_never_returning
+ # TODO: 3.0: Consider using RefactoringChecker._is_function_def_never_returning
if isinstance(else_stmt, nodes.Expr) and isinstance(
else_stmt.value, nodes.Call
):
@@ -2906,7 +2962,7 @@ class VariablesChecker(BaseChecker):
@staticmethod
def _nodes_to_unpack(node: nodes.NodeNG) -> list[nodes.NodeNG] | None:
"""Return the list of values of the `Assign` node."""
- if isinstance(node, (nodes.Tuple, nodes.List) + DICT_TYPES):
+ if isinstance(node, (nodes.Tuple, nodes.List, *DICT_TYPES)):
return node.itered() # type: ignore[no-any-return]
if isinstance(node, astroid.Instance) and any(
ancestor.qname() == "typing.NamedTuple" for ancestor in node.ancestors()
@@ -2961,7 +3017,9 @@ class VariablesChecker(BaseChecker):
if not isinstance(module, nodes.Module):
return None
except astroid.NotFoundError:
- if module.name in self._ignored_modules:
+ # Unable to import `name` from `module`. Since `name` may itself be a
+ # module, we first check if it matches the ignored modules.
+ if is_module_ignored(f"{module.qname()}.{name}", self._ignored_modules):
return None
self.add_message(
"no-name-in-module", args=(name, module.name), node=node
diff --git a/pylint/config/__init__.py b/pylint/config/__init__.py
index 5f90bbae0..5dbda321c 100644
--- a/pylint/config/__init__.py
+++ b/pylint/config/__init__.py
@@ -1,67 +1,9 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-__all__ = [
- "ConfigurationMixIn", # Deprecated
- "find_default_config_files",
- "find_pylintrc", # Deprecated
- "Option", # Deprecated
- "OptionsManagerMixIn", # Deprecated
- "OptionParser", # Deprecated
- "OptionsProviderMixIn", # Deprecated
- "UnsupportedAction", # Deprecated
- "PYLINTRC",
- "USER_HOME", # Compatibility with the old API
- "PYLINT_HOME", # Compatibility with the old API
- "save_results", # Compatibility with the old API # Deprecated
- "load_results", # Compatibility with the old API # Deprecated
-]
+__all__ = ["find_default_config_files"]
-import warnings
-
-from pylint.config.arguments_provider import UnsupportedAction
-from pylint.config.configuration_mixin import ConfigurationMixIn
-from pylint.config.environment_variable import PYLINTRC
-from pylint.config.find_default_config_files import (
- find_default_config_files,
- find_pylintrc,
-)
-from pylint.config.option import Option
-from pylint.config.option_manager_mixin import OptionsManagerMixIn
-from pylint.config.option_parser import OptionParser # type: ignore[attr-defined]
-from pylint.config.options_provider_mixin import ( # type: ignore[attr-defined]
- OptionsProviderMixIn,
-)
-from pylint.constants import PYLINT_HOME, USER_HOME
-from pylint.utils import LinterStats
-
-
-def load_results(base: str) -> LinterStats | None:
- # TODO: 3.0: Remove deprecated function
- # pylint: disable=import-outside-toplevel
- from pylint.lint.caching import load_results as _real_load_results
-
- warnings.warn(
- "'pylint.config.load_results' is deprecated, please use "
- "'pylint.lint.load_results' instead. This will be removed in 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- return _real_load_results(base, PYLINT_HOME)
-
-
-def save_results(results: LinterStats, base: str) -> None:
- # TODO: 3.0: Remove deprecated function
- # pylint: disable=import-outside-toplevel
- from pylint.lint.caching import save_results as _real_save_results
-
- warnings.warn(
- "'pylint.config.save_results' is deprecated, please use "
- "'pylint.lint.save_results' instead. This will be removed in 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- return _real_save_results(results, base, PYLINT_HOME)
+from pylint.config.find_default_config_files import find_default_config_files
diff --git a/pylint/config/_pylint_config/__init__.py b/pylint/config/_pylint_config/__init__.py
index 622d0dfe3..8d36bd88b 100644
--- a/pylint/config/_pylint_config/__init__.py
+++ b/pylint/config/_pylint_config/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Everything related to the 'pylint-config' command.
diff --git a/pylint/config/_pylint_config/generate_command.py b/pylint/config/_pylint_config/generate_command.py
index 110069b90..d1b73c99b 100644
--- a/pylint/config/_pylint_config/generate_command.py
+++ b/pylint/config/_pylint_config/generate_command.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Everything related to the 'pylint-config generate' command."""
from __future__ import annotations
-import warnings
from io import StringIO
from typing import TYPE_CHECKING
@@ -29,10 +28,8 @@ def generate_interactive_config(linter: PyLinter) -> None:
config_string = linter._generate_config_file(minimal=minimal)
else:
output_stream = StringIO()
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- linter.generate_config(stream=output_stream, skipsections=("Commands",))
- config_string = output_stream.getvalue()
+ linter._generate_config(stream=output_stream, skipsections=("Commands",))
+ config_string = output_stream.getvalue()
if to_file:
with open(output_file_name, "w", encoding="utf-8") as f:
diff --git a/pylint/config/_pylint_config/help_message.py b/pylint/config/_pylint_config/help_message.py
index 15c9803e7..7ba947429 100644
--- a/pylint/config/_pylint_config/help_message.py
+++ b/pylint/config/_pylint_config/help_message.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Everything related to the 'pylint-config -h' command and subcommands."""
diff --git a/pylint/config/_pylint_config/main.py b/pylint/config/_pylint_config/main.py
index 716702df5..e562da2ef 100644
--- a/pylint/config/_pylint_config/main.py
+++ b/pylint/config/_pylint_config/main.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Everything related to the 'pylint-config' command."""
diff --git a/pylint/config/_pylint_config/setup.py b/pylint/config/_pylint_config/setup.py
index ae52b99ba..211f9bc6d 100644
--- a/pylint/config/_pylint_config/setup.py
+++ b/pylint/config/_pylint_config/setup.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Everything related to the setup of the 'pylint-config' command."""
diff --git a/pylint/config/_pylint_config/utils.py b/pylint/config/_pylint_config/utils.py
index cd5f8affe..f9185e8b1 100644
--- a/pylint/config/_pylint_config/utils.py
+++ b/pylint/config/_pylint_config/utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Utils for the 'pylint-config' command."""
@@ -9,12 +9,7 @@ from __future__ import annotations
import sys
from collections.abc import Callable
from pathlib import Path
-from typing import TypeVar
-
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
+from typing import Literal, TypeVar
if sys.version_info >= (3, 10):
from typing import ParamSpec
diff --git a/pylint/config/argument.py b/pylint/config/argument.py
index d648ae7e4..d826cbd3e 100644
--- a/pylint/config/argument.py
+++ b/pylint/config/argument.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Definition of an Argument class and transformers for various argument types.
@@ -13,10 +13,9 @@ import argparse
import os
import pathlib
import re
-import sys
from collections.abc import Callable
from glob import glob
-from typing import Any, Pattern, Sequence, Tuple, Union
+from typing import Any, Literal, Pattern, Sequence, Tuple, Union
from pylint import interfaces
from pylint import utils as pylint_utils
@@ -24,12 +23,6 @@ from pylint.config.callback_actions import _CallbackAction, _ExtendAction
from pylint.config.deprecation_actions import _NewNamesAction, _OldNamesAction
from pylint.constants import PY38_PLUS
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
-
_ArgumentTypes = Union[
str,
int,
diff --git a/pylint/config/arguments_manager.py b/pylint/config/arguments_manager.py
index ef1d0cc72..b99c9476f 100644
--- a/pylint/config/arguments_manager.py
+++ b/pylint/config/arguments_manager.py
@@ -1,24 +1,18 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Arguments manager class used to handle command-line arguments and options."""
from __future__ import annotations
import argparse
-import configparser
-import copy
-import optparse # pylint: disable=deprecated-module
-import os
import re
import sys
import textwrap
import warnings
-from collections import OrderedDict
from collections.abc import Sequence
-from pathlib import Path
-from typing import TYPE_CHECKING, Any, TextIO, Union
+from typing import TYPE_CHECKING, Any, TextIO
import tomlkit
@@ -37,11 +31,6 @@ from pylint.config.exceptions import (
_UnrecognizedOptionError,
)
from pylint.config.help_formatter import _HelpFormatter
-from pylint.config.option import Option
-from pylint.config.option_parser import OptionParser # type: ignore[attr-defined]
-from pylint.config.options_provider_mixin import ( # type: ignore[attr-defined]
- OptionsProviderMixIn,
-)
from pylint.config.utils import _convert_option_to_argument, _parse_rich_type_value
from pylint.constants import MAIN_CHECKER_NAME
from pylint.typing import DirectoryNamespaceDict, OptionDict
@@ -55,10 +44,7 @@ else:
if TYPE_CHECKING:
from pylint.config.arguments_provider import _ArgumentsProvider
-ConfigProvider = Union["_ArgumentsProvider", OptionsProviderMixIn]
-
-# pylint: disable-next=too-many-instance-attributes
class _ArgumentsManager:
"""Arguments manager class used to handle command-line arguments and options."""
@@ -95,21 +81,6 @@ class _ArgumentsManager:
self._directory_namespaces: DirectoryNamespaceDict = {}
"""Mapping of directories and their respective namespace objects."""
- # TODO: 3.0: Remove deprecated attributes introduced to keep API
- # parity with optparse. Until '_maxlevel'
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- self.reset_parsers(usage or "")
- # list of registered options providers
- self._options_providers: list[ConfigProvider] = []
- # dictionary associating option name to checker
- self._all_options: OrderedDict[str, ConfigProvider] = OrderedDict()
- self._short_options: dict[str, str] = {}
- self._nocallback_options: dict[ConfigProvider, str] = {}
- self._mygroups: dict[str, optparse.OptionGroup] = {}
- # verbosity
- self._maxlevel: int = 0
-
@property
def config(self) -> argparse.Namespace:
"""Namespace for all options."""
@@ -119,25 +90,6 @@ class _ArgumentsManager:
def config(self, value: argparse.Namespace) -> None:
self._config = value
- @property
- def options_providers(self) -> list[ConfigProvider]:
- # TODO: 3.0: Remove deprecated attribute.
- warnings.warn(
- "options_providers has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- return self._options_providers
-
- @options_providers.setter
- def options_providers(self, value: list[ConfigProvider]) -> None:
- warnings.warn(
- "Setting options_providers has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- self._options_providers = value
-
def _register_options_provider(self, provider: _ArgumentsProvider) -> None:
"""Register an options provider and load its defaults."""
for opt, optdict in provider.options:
@@ -281,173 +233,12 @@ class _ArgumentsManager:
return parsed_args
- def reset_parsers(self, usage: str = "") -> None: # pragma: no cover
- """DEPRECATED."""
- warnings.warn(
- "reset_parsers has been deprecated. Parsers should be instantiated "
- "once during initialization and do not need to be reset.",
- DeprecationWarning,
- stacklevel=2,
- )
- # configuration file parser
- self.cfgfile_parser = configparser.ConfigParser(
- inline_comment_prefixes=("#", ";")
- )
- # command line parser
- self.cmdline_parser = OptionParser(Option, usage=usage)
- self.cmdline_parser.options_manager = self
- self._optik_option_attrs = set(self.cmdline_parser.option_class.ATTRS)
-
- def register_options_provider(
- self, provider: ConfigProvider, own_group: bool = True
- ) -> None: # pragma: no cover
- """DEPRECATED: Register an options provider."""
- warnings.warn(
- "register_options_provider has been deprecated. Options providers and "
- "arguments providers should be registered by initializing ArgumentsProvider. "
- "This automatically registers the provider on the ArgumentsManager.",
- DeprecationWarning,
- stacklevel=2,
- )
- self.options_providers.append(provider)
- non_group_spec_options = [
- option for option in provider.options if "group" not in option[1]
- ]
- groups = getattr(provider, "option_groups", ())
- if own_group and non_group_spec_options:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- self.add_option_group(
- provider.name.upper(),
- provider.__doc__,
- non_group_spec_options,
- provider,
- )
- else:
- for opt, optdict in non_group_spec_options:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- self.add_optik_option(provider, self.cmdline_parser, opt, optdict)
- for gname, gdoc in groups:
- gname = gname.upper()
- goptions = [
- option
- for option in provider.options
- if option[1].get("group", "").upper() == gname # type: ignore[union-attr]
- ]
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- self.add_option_group(gname, gdoc, goptions, provider)
-
- def add_option_group(
- self,
- group_name: str,
- _: str | None,
- options: list[tuple[str, OptionDict]],
- provider: ConfigProvider,
- ) -> None: # pragma: no cover
- """DEPRECATED."""
- warnings.warn(
- "add_option_group has been deprecated. Option groups should be "
- "registered by initializing ArgumentsProvider. "
- "This automatically registers the group on the ArgumentsManager.",
- DeprecationWarning,
- stacklevel=2,
- )
- # add option group to the command line parser
- if group_name in self._mygroups:
- group = self._mygroups[group_name]
- else:
- group = optparse.OptionGroup(
- self.cmdline_parser, title=group_name.capitalize()
- )
- self.cmdline_parser.add_option_group(group)
- self._mygroups[group_name] = group
- # add section to the config file
- if (
- group_name != "DEFAULT"
- and group_name not in self.cfgfile_parser._sections # type: ignore[attr-defined]
- ):
- self.cfgfile_parser.add_section(group_name)
- # add provider's specific options
- for opt, optdict in options:
- if not isinstance(optdict.get("action", "store"), str):
- optdict["action"] = "callback"
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- self.add_optik_option(provider, group, opt, optdict)
-
- def add_optik_option(
- self,
- provider: ConfigProvider,
- optikcontainer: optparse.OptionParser | optparse.OptionGroup,
- opt: str,
- optdict: OptionDict,
- ) -> None: # pragma: no cover
- """DEPRECATED."""
- warnings.warn(
- "add_optik_option has been deprecated. Options should be automatically "
- "added by initializing an ArgumentsProvider.",
- DeprecationWarning,
- stacklevel=2,
- )
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- args, optdict = self.optik_option(provider, opt, optdict)
- option = optikcontainer.add_option(*args, **optdict)
- self._all_options[opt] = provider
- self._maxlevel = max(self._maxlevel, option.level or 0)
-
- def optik_option(
- self, provider: ConfigProvider, opt: str, optdict: OptionDict
- ) -> tuple[list[str], OptionDict]: # pragma: no cover
- """DEPRECATED: Get our personal option definition and return a suitable form for
- use with optik/optparse.
- """
- warnings.warn(
- "optik_option has been deprecated. Parsing of option dictionaries should be done "
- "automatically by initializing an ArgumentsProvider.",
- DeprecationWarning,
- stacklevel=2,
- )
- optdict = copy.copy(optdict)
- if "action" in optdict:
- self._nocallback_options[provider] = opt
- else:
- optdict["action"] = "callback"
- optdict["callback"] = self.cb_set_provider_option
- # default is handled here and *must not* be given to optik if you
- # want the whole machinery to work
- if "default" in optdict:
- if (
- "help" in optdict
- and optdict.get("default") is not None
- and optdict["action"] not in ("store_true", "store_false")
- ):
- optdict["help"] += " [current: %default]" # type: ignore[operator]
- del optdict["default"]
- args = ["--" + str(opt)]
- if "short" in optdict:
- self._short_options[optdict["short"]] = opt # type: ignore[index]
- args.append("-" + optdict["short"]) # type: ignore[operator]
- del optdict["short"]
- # cleanup option definition dict before giving it to optik
- for key in list(optdict.keys()):
- if key not in self._optik_option_attrs:
- optdict.pop(key)
- return args, optdict
-
- def generate_config(
+ def _generate_config(
self, stream: TextIO | None = None, skipsections: tuple[str, ...] = ()
- ) -> None: # pragma: no cover
- """DEPRECATED: Write a configuration file according to the current configuration
+ ) -> None:
+ """Write a configuration file according to the current configuration
into the given stream or stdout.
"""
- warnings.warn(
- "generate_config has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
options_by_section = {}
sections = []
for group in sorted(
@@ -503,202 +294,10 @@ class _ArgumentsManager:
)
printed = True
- def load_provider_defaults(self) -> None: # pragma: no cover
- """DEPRECATED: Initialize configuration using default values."""
- warnings.warn(
- "load_provider_defaults has been deprecated. Parsing of option defaults should be done "
- "automatically by initializing an ArgumentsProvider.",
- DeprecationWarning,
- stacklevel=2,
- )
- for provider in self.options_providers:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- provider.load_defaults()
-
- def read_config_file(
- self, config_file: Path | None = None, verbose: bool = False
- ) -> None: # pragma: no cover
- """DEPRECATED: Read the configuration file but do not load it (i.e. dispatching
- values to each option's provider).
-
- :raises OSError: When the specified config file doesn't exist
- """
- warnings.warn(
- "read_config_file has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- if not config_file:
- if verbose:
- print(
- "No config file found, using default configuration", file=sys.stderr
- )
- return
- config_file = Path(os.path.expandvars(config_file)).expanduser()
- if not config_file.exists():
- raise OSError(f"The config file {str(config_file)} doesn't exist!")
- parser = self.cfgfile_parser
- if config_file.suffix == ".toml":
- try:
- self._parse_toml(config_file, parser)
- except tomllib.TOMLDecodeError:
- pass
- else:
- # Use this encoding in order to strip the BOM marker, if any.
- with open(config_file, encoding="utf_8_sig") as fp:
- parser.read_file(fp)
- # normalize each section's title
- for sect, values in list(parser._sections.items()): # type: ignore[attr-defined]
- if sect.startswith("pylint."):
- sect = sect[len("pylint.") :]
- if not sect.isupper() and values:
- parser._sections[sect.upper()] = values # type: ignore[attr-defined]
-
- if verbose:
- print(f"Using config file '{config_file}'", file=sys.stderr)
-
- @staticmethod
- def _parse_toml(
- config_file: Path, parser: configparser.ConfigParser
- ) -> None: # pragma: no cover
- """DEPRECATED: Parse and handle errors of a toml configuration file.
-
- TODO: 3.0: Remove deprecated method.
- """
- with open(config_file, mode="rb") as fp:
- content = tomllib.load(fp)
- try:
- sections_values = content["tool"]["pylint"]
- except KeyError:
- return
- for section, values in sections_values.items():
- section_name = section.upper()
- # TOML has rich types, convert values to
- # strings as ConfigParser expects.
- if not isinstance(values, dict):
- continue
- for option, value in values.items():
- if isinstance(value, bool):
- values[option] = "yes" if value else "no"
- elif isinstance(value, list):
- values[option] = ",".join(value)
- else:
- values[option] = str(value)
- for option, value in values.items():
- try:
- parser.set(section_name, option, value=value)
- except configparser.NoSectionError:
- parser.add_section(section_name)
- parser.set(section_name, option, value=value)
-
- def load_config_file(self) -> None: # pragma: no cover
- """DEPRECATED: Dispatch values previously read from a configuration file to each
- option's provider.
- """
- warnings.warn(
- "load_config_file has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- parser = self.cfgfile_parser
- for section in parser.sections():
- for option, value in parser.items(section):
- try:
- self.global_set_option(option, value)
- except (KeyError, optparse.OptionError):
- continue
-
- def load_configuration(self, **kwargs: Any) -> None: # pragma: no cover
- """DEPRECATED: Override configuration according to given parameters."""
- warnings.warn(
- "load_configuration has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- return self.load_configuration_from_config(kwargs)
-
- def load_configuration_from_config(
- self, config: dict[str, Any]
- ) -> None: # pragma: no cover
- warnings.warn(
- "DEPRECATED: load_configuration_from_config has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- for opt, opt_value in config.items():
- opt = opt.replace("_", "-")
- provider = self._all_options[opt]
- provider.set_option(opt, opt_value)
-
- def load_command_line_configuration(
- self, args: list[str] | None = None
- ) -> list[str]: # pragma: no cover
- """DEPRECATED: Override configuration according to command line parameters.
-
- return additional arguments
- """
- warnings.warn(
- "load_command_line_configuration has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- args = sys.argv[1:] if args is None else list(args)
- (options, args) = self.cmdline_parser.parse_args(args=args)
- for provider in self._nocallback_options:
- config = provider.config
- for attr in config.__dict__.keys():
- value = getattr(options, attr, None)
- if value is None:
- continue
- setattr(config, attr, value)
- return args # type: ignore[return-value]
-
- def help(self, level: int | None = None) -> str:
+ def help(self) -> str:
"""Return the usage string based on the available options."""
- if level is not None:
- warnings.warn(
- "Supplying a 'level' argument to help() has been deprecated."
- "You can call help() without any arguments.",
- DeprecationWarning,
- stacklevel=2,
- )
return self._arg_parser.format_help()
- def cb_set_provider_option( # pragma: no cover
- self, option: Any, opt: Any, value: Any, parser: Any
- ) -> None:
- """DEPRECATED: Optik callback for option setting."""
- # TODO: 3.0: Remove deprecated method.
- warnings.warn(
- "cb_set_provider_option has been deprecated. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- if opt.startswith("--"):
- # remove -- on long option
- opt = opt[2:]
- else:
- # short option, get its long equivalent
- opt = self._short_options[opt[1:]]
- # trick since we can't set action='store_true' on options
- if value is None:
- value = 1
- self.set_option(opt, value)
-
- def global_set_option(self, opt: str, value: Any) -> None: # pragma: no cover
- """DEPRECATED: Set option on the correct option provider."""
- # TODO: 3.0: Remove deprecated method.
- warnings.warn(
- "global_set_option has been deprecated. You can use _arguments_manager.set_option "
- "or linter.set_option to set options on the global configuration object.",
- DeprecationWarning,
- stacklevel=2,
- )
- self.set_option(opt, value)
-
def _generate_config_file(self, *, minimal: bool = False) -> str:
"""Write a configuration file according to the current configuration into
stdout.
@@ -795,30 +394,8 @@ class _ArgumentsManager:
return str(toml_string)
- def set_option(
- self,
- optname: str,
- value: Any,
- action: str | None = "default_value",
- optdict: None | str | OptionDict = "default_value",
- ) -> None:
+ def set_option(self, optname: str, value: Any) -> None:
"""Set an option on the namespace object."""
- # TODO: 3.0: Remove deprecated arguments.
- if action != "default_value":
- warnings.warn(
- "The 'action' argument has been deprecated. You can use set_option "
- "without the 'action' or 'optdict' arguments.",
- DeprecationWarning,
- stacklevel=2,
- )
- if optdict != "default_value":
- warnings.warn(
- "The 'optdict' argument has been deprecated. You can use set_option "
- "without the 'action' or 'optdict' arguments.",
- DeprecationWarning,
- stacklevel=2,
- )
-
self.config = self._arg_parser.parse_known_args(
[f"--{optname.replace('_', '-')}", _parse_rich_type_value(value)],
self.config,
diff --git a/pylint/config/arguments_provider.py b/pylint/config/arguments_provider.py
index f5aac2f1d..7f75718ca 100644
--- a/pylint/config/arguments_provider.py
+++ b/pylint/config/arguments_provider.py
@@ -1,14 +1,11 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Arguments provider class used to expose options."""
from __future__ import annotations
-import argparse
-import optparse # pylint: disable=deprecated-module
-import warnings
from collections.abc import Iterator
from typing import Any
@@ -16,19 +13,6 @@ from pylint.config.arguments_manager import _ArgumentsManager
from pylint.typing import OptionDict, Options
-class UnsupportedAction(Exception):
- """Raised by set_option when it doesn't know what to do for an action."""
-
- def __init__(self, *args: object) -> None:
- # TODO: 3.0: Remove deprecated exception
- warnings.warn(
- "UnsupportedAction has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*args)
-
-
class _ArgumentsProvider:
"""Base class for classes that provide arguments."""
@@ -47,170 +31,35 @@ class _ArgumentsProvider:
self._arguments_manager._register_options_provider(self)
- self._level = 0
-
- @property
- def level(self) -> int:
- # TODO: 3.0: Remove deprecated attribute
- warnings.warn(
- "The level attribute has been deprecated. It was used to display the checker in the help or not,"
- " and everything is displayed in the help now. It will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- return self._level
-
- @level.setter
- def level(self, value: int) -> None:
- # TODO: 3.0: Remove deprecated attribute
- warnings.warn(
- "Setting the level attribute has been deprecated. It was used to display the checker "
- "in the help or not, and everything is displayed in the help now. It will be removed "
- "in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- self._level = value
-
- @property
- def config(self) -> argparse.Namespace:
- # TODO: 3.0: Remove deprecated attribute
- warnings.warn(
- "The checker-specific config attribute has been deprecated. Please use "
- "'linter.config' to access the global configuration object.",
- DeprecationWarning,
- stacklevel=2,
- )
- return self._arguments_manager.config
-
- def load_defaults(self) -> None: # pragma: no cover
- """DEPRECATED: Initialize the provider using default values."""
- warnings.warn(
- "load_defaults has been deprecated. Option groups should be "
- "registered by initializing an ArgumentsProvider. "
- "This automatically registers the group on the ArgumentsManager.",
- DeprecationWarning,
- stacklevel=2,
- )
- for opt, optdict in self.options:
- action = optdict.get("action")
- if action != "callback":
- # callback action have no default
- if optdict is None:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- optdict = self.get_option_def(opt)
- default = optdict.get("default")
- self.set_option(opt, default, action, optdict)
-
- def option_attrname(
- self, opt: str, optdict: OptionDict | None = None
- ) -> str: # pragma: no cover
- """DEPRECATED: Get the config attribute corresponding to opt."""
- warnings.warn(
- "option_attrname has been deprecated. It will be removed "
- "in a future release.",
- DeprecationWarning,
- stacklevel=2,
- )
- if optdict is None:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- optdict = self.get_option_def(opt)
- return optdict.get("dest", opt.replace("-", "_")) # type: ignore[return-value]
-
- def option_value(self, opt: str) -> Any: # pragma: no cover
- """DEPRECATED: Get the current value for the given option."""
- warnings.warn(
- "option_value has been deprecated. It will be removed "
- "in a future release.",
- DeprecationWarning,
- stacklevel=2,
- )
+ def _option_value(self, opt: str) -> Any:
+ """Get the current value for the given option."""
return getattr(self._arguments_manager.config, opt.replace("-", "_"), None)
- def set_option( # pragma: no cover
- self,
- optname: Any,
- value: Any,
- action: Any = None, # pylint: disable=unused-argument
- optdict: Any = None, # pylint: disable=unused-argument
- ) -> None:
- """DEPRECATED: Method called to set an option (registered in the options
- list).
- """
- # TODO: 3.0: Remove deprecated method.
- warnings.warn(
- "set_option has been deprecated. You can use _arguments_manager.set_option "
- "or linter.set_option to set options on the global configuration object.",
- DeprecationWarning,
- stacklevel=2,
- )
- self._arguments_manager.set_option(optname, value)
-
- def get_option_def(self, opt: str) -> OptionDict: # pragma: no cover
- """DEPRECATED: Return the dictionary defining an option given its name.
-
- :raises OptionError: If the option isn't found.
- """
- warnings.warn(
- "get_option_def has been deprecated. It will be removed "
- "in a future release.",
- DeprecationWarning,
- stacklevel=2,
- )
- assert self.options
- for option in self.options:
- if option[0] == opt:
- return option[1]
- raise optparse.OptionError(
- f"no such option {opt} in section {self.name!r}", opt # type: ignore[arg-type]
- )
-
- def options_by_section(
+ def _options_by_section(
self,
) -> Iterator[
tuple[str, list[tuple[str, OptionDict, Any]]]
| tuple[None, dict[str, list[tuple[str, OptionDict, Any]]]]
- ]: # pragma: no cover
- """DEPRECATED: Return an iterator on options grouped by section.
+ ]:
+ """Return an iterator on options grouped by section.
(section, [list of (optname, optdict, optvalue)])
"""
- # TODO 3.0: Make this function private see
- # https://github.com/PyCQA/pylint/pull/6665#discussion_r880143229
- # It's only used in '_get_global_options_documentation'
- warnings.warn(
- "options_by_section has been deprecated. It will be removed "
- "in a future release.",
- DeprecationWarning,
- stacklevel=2,
- )
sections: dict[str, list[tuple[str, OptionDict, Any]]] = {}
for optname, optdict in self.options:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- sections.setdefault(optdict.get("group"), []).append( # type: ignore[arg-type]
- (optname, optdict, self.option_value(optname))
- )
+ sections.setdefault(optdict.get("group"), []).append( # type: ignore[arg-type]
+ (optname, optdict, self._option_value(optname))
+ )
if None in sections:
yield None, sections.pop(None) # type: ignore[call-overload]
for section, options in sorted(sections.items()):
yield section.upper(), options
- def options_and_values(
+ def _options_and_values(
self, options: Options | None = None
- ) -> Iterator[tuple[str, OptionDict, Any]]: # pragma: no cover
+ ) -> Iterator[tuple[str, OptionDict, Any]]:
"""DEPRECATED."""
- warnings.warn(
- "options_and_values has been deprecated. It will be removed "
- "in a future release.",
- DeprecationWarning,
- stacklevel=2,
- )
if options is None:
options = self.options
for optname, optdict in options:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- yield optname, optdict, self.option_value(optname)
+ yield optname, optdict, self._option_value(optname)
diff --git a/pylint/config/callback_actions.py b/pylint/config/callback_actions.py
index a4c633464..7c93f2553 100644
--- a/pylint/config/callback_actions.py
+++ b/pylint/config/callback_actions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=too-many-arguments, redefined-builtin, duplicate-code
@@ -11,7 +11,6 @@ from __future__ import annotations
import abc
import argparse
import sys
-import warnings
from collections.abc import Callable, Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any
@@ -265,11 +264,9 @@ class _GenerateRCFileAction(_AccessRunObjectAction):
values: str | Sequence[Any] | None,
option_string: str | None = "--generate-rcfile",
) -> None:
- # TODO: 2.x: Deprecate this after the auto-upgrade functionality of
+ # TODO: 3.x: Deprecate this after the auto-upgrade functionality of
# pylint-config is sufficient.
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- self.run.linter.generate_config(skipsections=("Commands",))
+ self.run.linter._generate_config(skipsections=("Commands",))
sys.exit(0)
diff --git a/pylint/config/config_file_parser.py b/pylint/config/config_file_parser.py
index 019f9b738..047df5889 100644
--- a/pylint/config/config_file_parser.py
+++ b/pylint/config/config_file_parser.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Configuration file parser class."""
@@ -9,7 +9,6 @@ from __future__ import annotations
import configparser
import os
import sys
-import warnings
from pathlib import Path
from typing import TYPE_CHECKING
@@ -41,23 +40,13 @@ class _ConfigurationFileParser:
config_content: dict[str, str] = {}
options: list[str] = []
+ ini_file_with_sections = self._ini_file_with_sections(file_path)
for section in parser.sections():
- if self._ini_file_with_sections(file_path) and not section.startswith(
- "pylint"
- ):
- if section.lower() == "master":
- # TODO: 3.0: Remove deprecated handling of master, only allow 'pylint.' sections
- warnings.warn(
- "The use of 'MASTER' or 'master' as configuration section for pylint "
- "has been deprecated, as it's bad practice to not start sections titles "
- "with the tool name. Please use 'pylint.main' instead.",
- UserWarning,
- )
- else:
- continue
- for opt, value in parser[section].items():
- config_content[opt] = value
- options += [f"--{opt}", value]
+ if ini_file_with_sections and not section.startswith("pylint"):
+ continue
+ for option, value in parser[section].items():
+ config_content[option] = value
+ options += [f"--{option}", value]
return config_content, options
@staticmethod
diff --git a/pylint/config/config_initialization.py b/pylint/config/config_initialization.py
index 3c9c4e22a..4f7b614ee 100644
--- a/pylint/config/config_initialization.py
+++ b/pylint/config/config_initialization.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/config/configuration_mixin.py b/pylint/config/configuration_mixin.py
deleted file mode 100644
index 55857224a..000000000
--- a/pylint/config/configuration_mixin.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-from __future__ import annotations
-
-import warnings
-from typing import Any
-
-from pylint.config.option_manager_mixin import OptionsManagerMixIn
-from pylint.config.options_provider_mixin import ( # type: ignore[attr-defined]
- OptionsProviderMixIn,
-)
-
-
-class ConfigurationMixIn(OptionsManagerMixIn, OptionsProviderMixIn): # type: ignore[misc]
- """Basic mixin for simple configurations which don't need the
- manager / providers model.
- """
-
- def __init__(self, *args: Any, **kwargs: Any) -> None:
- # TODO: 3.0: Remove deprecated class
- warnings.warn(
- "ConfigurationMixIn has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- if not args:
- kwargs.setdefault("usage", "")
- OptionsManagerMixIn.__init__(self, *args, **kwargs)
- OptionsProviderMixIn.__init__(self)
- if not getattr(self, "option_groups", None):
- self.option_groups: list[tuple[str, str]] = []
- for _, optdict in self.options:
- try:
- gdef = (optdict["group"].upper(), "")
- except KeyError:
- continue
- if gdef not in self.option_groups:
- self.option_groups.append(gdef)
- self.register_options_provider(self, own_group=False)
diff --git a/pylint/config/deprecation_actions.py b/pylint/config/deprecation_actions.py
index ceef200a7..85a77cc78 100644
--- a/pylint/config/deprecation_actions.py
+++ b/pylint/config/deprecation_actions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=too-many-arguments, redefined-builtin
@@ -104,4 +104,5 @@ class _NewNamesAction(argparse._StoreAction):
f"{self.option_strings[0]} has been deprecated. Please look into "
f"using any of the following options: {', '.join(self.new_names)}.",
DeprecationWarning,
+ stacklevel=2,
)
diff --git a/pylint/config/environment_variable.py b/pylint/config/environment_variable.py
deleted file mode 100644
index 291b1651c..000000000
--- a/pylint/config/environment_variable.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-import warnings
-
-from pylint.config.find_default_config_files import find_pylintrc
-
-with warnings.catch_warnings():
- warnings.simplefilter("ignore")
- PYLINTRC = find_pylintrc()
diff --git a/pylint/config/exceptions.py b/pylint/config/exceptions.py
index cb4fc1f8f..982e3f494 100644
--- a/pylint/config/exceptions.py
+++ b/pylint/config/exceptions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py
index 43e682a58..3b03f6357 100644
--- a/pylint/config/find_default_config_files.py
+++ b/pylint/config/find_default_config_files.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import configparser
import os
import sys
-import warnings
from collections.abc import Iterator
from pathlib import Path
@@ -17,7 +16,28 @@ else:
import tomli as tomllib
RC_NAMES = (Path("pylintrc"), Path(".pylintrc"))
-CONFIG_NAMES = RC_NAMES + (Path("pyproject.toml"), Path("setup.cfg"))
+PYPROJECT_NAME = Path("pyproject.toml")
+CONFIG_NAMES = (*RC_NAMES, PYPROJECT_NAME, Path("setup.cfg"))
+
+
+def _find_pyproject() -> Path:
+ """Search for file pyproject.toml in the parent directories recursively.
+
+ It resolves symlinks, so if there is any symlink up in the tree, it does not respect them
+ """
+ current_dir = Path.cwd().resolve()
+ is_root = False
+ while not is_root:
+ if (current_dir / PYPROJECT_NAME).is_file():
+ return current_dir / PYPROJECT_NAME
+ is_root = (
+ current_dir == current_dir.parent
+ or (current_dir / ".git").is_dir()
+ or (current_dir / ".hg").is_dir()
+ )
+ current_dir = current_dir.parent
+
+ return current_dir
def _toml_has_config(path: Path | str) -> bool:
@@ -101,6 +121,13 @@ def find_default_config_files() -> Iterator[Path]:
pass
try:
+ parent_pyproject = _find_pyproject()
+ if parent_pyproject.is_file() and _toml_has_config(parent_pyproject):
+ yield parent_pyproject.resolve()
+ except OSError:
+ pass
+
+ try:
yield from _find_config_in_home_or_environment()
except OSError:
pass
@@ -110,21 +137,3 @@ def find_default_config_files() -> Iterator[Path]:
yield Path("/etc/pylintrc").resolve()
except OSError:
pass
-
-
-def find_pylintrc() -> str | None:
- """Search the pylint rc file and return its path if it finds it, else return
- None.
- """
- # TODO: 3.0: Remove deprecated function
- warnings.warn(
- "find_pylintrc and the PYLINTRC constant have been deprecated. "
- "Use find_default_config_files if you want access to pylint's configuration file "
- "finding logic.",
- DeprecationWarning,
- stacklevel=2,
- )
- for config_file in find_default_config_files():
- if str(config_file).endswith("pylintrc"):
- return str(config_file)
- return None
diff --git a/pylint/config/help_formatter.py b/pylint/config/help_formatter.py
index 5e517d944..78d43d178 100644
--- a/pylint/config/help_formatter.py
+++ b/pylint/config/help_formatter.py
@@ -1,13 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import argparse
from pylint.config.callback_actions import _CallbackAction
-from pylint.constants import DEFAULT_PYLINT_HOME, OLD_DEFAULT_PYLINT_HOME
+from pylint.constants import DEFAULT_PYLINT_HOME
class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
@@ -35,8 +35,7 @@ class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
Environment variables:
The following environment variables are used:
* PYLINTHOME Path to the directory where persistent data for the run will
- be stored. If not found, it defaults to '{DEFAULT_PYLINT_HOME}'
- or '{OLD_DEFAULT_PYLINT_HOME}' (in the current working directory).
+ be stored. If not found, it defaults to '{DEFAULT_PYLINT_HOME}'.
* PYLINTRC Path to the configuration file. See the documentation for the method used
to search for configuration file.
diff --git a/pylint/config/option.py b/pylint/config/option.py
deleted file mode 100644
index 74e4d45d8..000000000
--- a/pylint/config/option.py
+++ /dev/null
@@ -1,239 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-from __future__ import annotations
-
-import copy
-import optparse # pylint: disable=deprecated-module
-import pathlib
-import re
-import warnings
-from collections.abc import Callable, Sequence
-from re import Pattern
-from typing import Any
-
-from pylint import utils
-
-
-# pylint: disable=unused-argument
-def _csv_validator(
- _: Any, name: str, value: str | list[str] | tuple[str]
-) -> Sequence[str]:
- return utils._check_csv(value)
-
-
-# pylint: disable=unused-argument
-def _regexp_validator(
- _: Any, name: str, value: str | re.Pattern[str]
-) -> re.Pattern[str]:
- if hasattr(value, "pattern"):
- return value # type: ignore[return-value]
- return re.compile(value)
-
-
-# pylint: disable=unused-argument
-def _regexp_csv_validator(
- _: Any, name: str, value: str | list[str]
-) -> list[re.Pattern[str]]:
- return [_regexp_validator(_, name, val) for val in _csv_validator(_, name, value)]
-
-
-def _regexp_paths_csv_validator(
- _: Any, name: str, value: str | list[Pattern[str]]
-) -> list[Pattern[str]]:
- if isinstance(value, list):
- return value
- patterns = []
- for val in _csv_validator(_, name, value):
- patterns.append(
- re.compile(
- str(pathlib.PureWindowsPath(val)).replace("\\", "\\\\")
- + "|"
- + pathlib.PureWindowsPath(val).as_posix()
- )
- )
- return patterns
-
-
-def _choice_validator(choices: list[Any], name: str, value: Any) -> Any:
- if value not in choices:
- msg = "option %s: invalid value: %r, should be in %s"
- raise optparse.OptionValueError(msg % (name, value, choices))
- return value
-
-
-def _yn_validator(opt: str, _: str, value: Any) -> bool:
- if isinstance(value, int):
- return bool(value)
- if isinstance(value, str):
- value = value.lower()
- if value in {"y", "yes", "true"}:
- return True
- if value in {"n", "no", "false"}:
- return False
- msg = "option %s: invalid yn value %r, should be in (y, yes, true, n, no, false)"
- raise optparse.OptionValueError(msg % (opt, value))
-
-
-def _multiple_choice_validator(choices: list[Any], name: str, value: Any) -> Any:
- values = utils._check_csv(value)
- for csv_value in values:
- if csv_value not in choices:
- msg = "option %s: invalid value: %r, should be in %s"
- raise optparse.OptionValueError(msg % (name, csv_value, choices))
- return values
-
-
-def _non_empty_string_validator( # pragma: no cover # Unused
- opt: Any, _: str, value: str
-) -> str:
- if not value:
- msg = "indent string can't be empty."
- raise optparse.OptionValueError(msg)
- return utils._unquote(value)
-
-
-def _multiple_choices_validating_option( # pragma: no cover # Unused
- opt: optparse.Option, name: str, value: Any
-) -> Any:
- return _multiple_choice_validator(
- opt.choices, name, value # type: ignore[attr-defined]
- )
-
-
-def _py_version_validator(_: Any, name: str, value: Any) -> tuple[int, int, int]:
- if not isinstance(value, tuple):
- try:
- value = tuple(int(val) for val in value.split("."))
- except (ValueError, AttributeError):
- raise optparse.OptionValueError(
- f"Invalid format for {name}, should be version string. E.g., '3.8'"
- ) from None
- return value # type: ignore[no-any-return]
-
-
-VALIDATORS: dict[str, Callable[[Any, str, Any], Any] | Callable[[Any], Any]] = {
- "string": utils._unquote,
- "int": int,
- "float": float,
- "glob_paths_csv": _csv_validator,
- "regexp": lambda pattern: re.compile(pattern or ""),
- "regexp_csv": _regexp_csv_validator,
- "regexp_paths_csv": _regexp_paths_csv_validator,
- "csv": _csv_validator,
- "yn": _yn_validator,
- "choice": lambda opt, name, value: _choice_validator(opt["choices"], name, value),
- "confidence": lambda opt, name, value: _multiple_choice_validator(
- opt["choices"], name, value
- ),
- "multiple_choice": lambda opt, name, value: _multiple_choice_validator(
- opt["choices"], name, value
- ),
- "non_empty_string": _non_empty_string_validator,
- "py_version": _py_version_validator,
-}
-
-
-def _call_validator(opttype: str, optdict: Any, option: str, value: Any) -> Any:
- if opttype not in VALIDATORS:
- raise TypeError(f'Unsupported type "{opttype}"')
- try:
- return VALIDATORS[opttype](optdict, option, value) # type: ignore[call-arg]
- except TypeError:
- try:
- return VALIDATORS[opttype](value) # type: ignore[call-arg]
- except Exception as e:
- raise optparse.OptionValueError(
- f"{option} value ({value!r}) should be of type {opttype}"
- ) from e
-
-
-def _validate(value: Any, optdict: Any, name: str = "") -> Any:
- """Return a validated value for an option according to its type.
-
- optional argument name is only used for error message formatting
- """
- try:
- _type = optdict["type"]
- except KeyError:
- return value
- return _call_validator(_type, optdict, name, value)
-
-
-# pylint: disable=no-member
-class Option(optparse.Option):
- TYPES = optparse.Option.TYPES + (
- "glob_paths_csv",
- "regexp",
- "regexp_csv",
- "regexp_paths_csv",
- "csv",
- "yn",
- "confidence",
- "multiple_choice",
- "non_empty_string",
- "py_version",
- )
- ATTRS = optparse.Option.ATTRS + ["hide", "level"]
- TYPE_CHECKER = copy.copy(optparse.Option.TYPE_CHECKER)
- TYPE_CHECKER["glob_paths_csv"] = _csv_validator
- TYPE_CHECKER["regexp"] = _regexp_validator
- TYPE_CHECKER["regexp_csv"] = _regexp_csv_validator
- TYPE_CHECKER["regexp_paths_csv"] = _regexp_paths_csv_validator
- TYPE_CHECKER["csv"] = _csv_validator
- TYPE_CHECKER["yn"] = _yn_validator
- TYPE_CHECKER["confidence"] = _multiple_choices_validating_option
- TYPE_CHECKER["multiple_choice"] = _multiple_choices_validating_option
- TYPE_CHECKER["non_empty_string"] = _non_empty_string_validator
- TYPE_CHECKER["py_version"] = _py_version_validator
-
- def __init__(self, *opts: Any, **attrs: Any) -> None:
- # TODO: 3.0: Remove deprecated class
- warnings.warn(
- "Option has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(*opts, **attrs)
- if hasattr(self, "hide") and self.hide:
- self.help = optparse.SUPPRESS_HELP
-
- def _check_choice(self) -> None:
- if self.type in {"choice", "multiple_choice", "confidence"}:
- if self.choices is None: # type: ignore[attr-defined]
- raise optparse.OptionError(
- "must supply a list of choices for type 'choice'", self
- )
- if not isinstance(self.choices, (tuple, list)): # type: ignore[attr-defined]
- raise optparse.OptionError(
- # pylint: disable-next=consider-using-f-string
- "choices must be a list of strings ('%s' supplied)"
- % str(type(self.choices)).split("'")[1], # type: ignore[attr-defined]
- self,
- )
- elif self.choices is not None: # type: ignore[attr-defined]
- raise optparse.OptionError(
- f"must not supply choices for type {self.type!r}", self
- )
-
- optparse.Option.CHECK_METHODS[2] = _check_choice # type: ignore[index]
-
- def process( # pragma: no cover # Argparse
- self, opt: Any, value: Any, values: Any, parser: Any
- ) -> int:
- assert isinstance(self.dest, str)
- if self.callback and self.callback.__module__ == "pylint.lint.run":
- return 1
- # First, convert the value(s) to the right type. Howl if any
- # value(s) are bogus.
- value = self.convert_value(opt, value)
- if self.type == "named":
- existent = getattr(values, self.dest)
- if existent:
- existent.update(value)
- value = existent
- # And then take whatever action is expected of us.
- # This is a separate method to make life easier for
- # subclasses to add new actions.
- return self.take_action(self.action, self.dest, opt, value, values, parser)
diff --git a/pylint/config/option_manager_mixin.py b/pylint/config/option_manager_mixin.py
deleted file mode 100644
index c468f494f..000000000
--- a/pylint/config/option_manager_mixin.py
+++ /dev/null
@@ -1,372 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-
-# pylint: disable=duplicate-code
-
-from __future__ import annotations
-
-import collections
-import configparser
-import contextlib
-import copy
-import optparse # pylint: disable=deprecated-module
-import os
-import sys
-import warnings
-from collections.abc import Iterator
-from pathlib import Path
-from typing import TYPE_CHECKING, Any, TextIO
-
-from pylint import utils
-from pylint.config.option import Option
-from pylint.config.option_parser import OptionParser # type: ignore[attr-defined]
-from pylint.typing import OptionDict
-
-if TYPE_CHECKING:
- from pylint.config.options_provider_mixin import ( # type: ignore[attr-defined]
- OptionsProviderMixin,
- )
-
-if sys.version_info >= (3, 11):
- import tomllib
-else:
- import tomli as tomllib
-
-
-def _expand_default(self: optparse.HelpFormatter, option: Option) -> str:
- """Patch OptionParser.expand_default with custom behaviour.
-
- This will handle defaults to avoid overriding values in the
- configuration file.
- """
- if self.parser is None or not self.default_tag:
- return str(option.help)
- optname = option._long_opts[0][2:]
- try:
- provider = self.parser.options_manager._all_options[optname] # type: ignore[attr-defined]
- except KeyError:
- value = None
- else:
- optdict = provider.get_option_def(optname)
- optname = provider.option_attrname(optname, optdict)
- value = getattr(provider.config, optname, optdict)
- value = utils._format_option_value(optdict, value)
- if value is optparse.NO_DEFAULT or not value:
- value = self.NO_DEFAULT_VALUE
- return option.help.replace(self.default_tag, str(value)) # type: ignore[union-attr]
-
-
-@contextlib.contextmanager
-def _patch_optparse() -> Iterator[None]:
- # pylint: disable = redefined-variable-type
- orig_default = optparse.HelpFormatter
- try:
- optparse.HelpFormatter.expand_default = _expand_default # type: ignore[assignment]
- yield
- finally:
- optparse.HelpFormatter.expand_default = orig_default # type: ignore[assignment]
-
-
-class OptionsManagerMixIn:
- """Handle configuration from both a configuration file and command line options."""
-
- def __init__(self, usage: str) -> None:
- # TODO: 3.0: Remove deprecated class
- warnings.warn(
- "OptionsManagerMixIn has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- self.reset_parsers(usage)
- # list of registered options providers
- self.options_providers: list[OptionsProviderMixin] = []
- # dictionary associating option name to checker
- self._all_options: collections.OrderedDict[Any, Any] = collections.OrderedDict()
- self._short_options: dict[Any, Any] = {}
- self._nocallback_options: dict[Any, Any] = {}
- self._mygroups: dict[Any, Any] = {}
- # verbosity
- self._maxlevel = 0
-
- def reset_parsers(self, usage: str = "") -> None:
- # configuration file parser
- self.cfgfile_parser = configparser.ConfigParser(
- inline_comment_prefixes=("#", ";")
- )
- # command line parser
- self.cmdline_parser = OptionParser(Option, usage=usage)
- self.cmdline_parser.options_manager = self
- self._optik_option_attrs = set(self.cmdline_parser.option_class.ATTRS)
-
- def register_options_provider(
- self, provider: OptionsProviderMixin, own_group: bool = True
- ) -> None:
- """Register an options provider."""
- self.options_providers.append(provider)
- non_group_spec_options = [
- option for option in provider.options if "group" not in option[1]
- ]
- groups = getattr(provider, "option_groups", ())
- if own_group and non_group_spec_options:
- self.add_option_group(
- provider.name.upper(),
- provider.__doc__,
- non_group_spec_options,
- provider,
- )
- else:
- for opt, optdict in non_group_spec_options:
- self.add_optik_option(provider, self.cmdline_parser, opt, optdict)
- for gname, gdoc in groups:
- gname = gname.upper()
- goptions = [
- option
- for option in provider.options
- if option[1].get("group", "").upper() == gname
- ]
- self.add_option_group(gname, gdoc, goptions, provider)
-
- def add_option_group(
- self, group_name: str, _: Any, options: Any, provider: OptionsProviderMixin
- ) -> None:
- # add option group to the command line parser
- if group_name in self._mygroups:
- group = self._mygroups[group_name]
- else:
- group = optparse.OptionGroup(
- self.cmdline_parser, title=group_name.capitalize()
- )
- self.cmdline_parser.add_option_group(group)
- self._mygroups[group_name] = group
- # add section to the config file
- if (
- group_name != "DEFAULT"
- and group_name not in self.cfgfile_parser._sections # type: ignore[attr-defined]
- ):
- self.cfgfile_parser.add_section(group_name)
- # add provider's specific options
- for opt, optdict in options:
- if not isinstance(optdict.get("action", "store"), str):
- optdict["action"] = "callback"
- self.add_optik_option(provider, group, opt, optdict)
-
- def add_optik_option(
- self,
- provider: OptionsProviderMixin,
- optikcontainer: Any,
- opt: str,
- optdict: OptionDict,
- ) -> None:
- args, optdict = self.optik_option(provider, opt, optdict)
- option = optikcontainer.add_option(*args, **optdict)
- self._all_options[opt] = provider
- self._maxlevel = max(self._maxlevel, option.level or 0)
-
- def optik_option(
- self, provider: OptionsProviderMixin, opt: str, optdict: OptionDict
- ) -> tuple[list[str], OptionDict]:
- """Get our personal option definition and return a suitable form for
- use with optik/optparse.
- """
- optdict = copy.copy(optdict)
- if "action" in optdict:
- self._nocallback_options[provider] = opt
- else:
- optdict["action"] = "callback"
- optdict["callback"] = self.cb_set_provider_option
- # default is handled here and *must not* be given to optik if you
- # want the whole machinery to work
- if "default" in optdict:
- if (
- "help" in optdict
- and optdict.get("default") is not None
- and optdict["action"] not in ("store_true", "store_false")
- ):
- optdict["help"] += " [current: %default]" # type: ignore[operator]
- del optdict["default"]
- args = ["--" + str(opt)]
- if "short" in optdict:
- self._short_options[optdict["short"]] = opt
- args.append("-" + optdict["short"]) # type: ignore[operator]
- del optdict["short"]
- # cleanup option definition dict before giving it to optik
- for key in list(optdict.keys()):
- if key not in self._optik_option_attrs:
- optdict.pop(key)
- return args, optdict
-
- def cb_set_provider_option(
- self, option: Option, opt: str, value: Any, parser: Any
- ) -> None:
- """Optik callback for option setting."""
- if opt.startswith("--"):
- # remove -- on long option
- opt = opt[2:]
- else:
- # short option, get its long equivalent
- opt = self._short_options[opt[1:]]
- # trick since we can't set action='store_true' on options
- if value is None:
- value = 1
- self.global_set_option(opt, value)
-
- def global_set_option(self, opt: str, value: Any) -> None:
- """Set option on the correct option provider."""
- self._all_options[opt].set_option(opt, value)
-
- def generate_config(
- self, stream: TextIO | None = None, skipsections: tuple[str, ...] = ()
- ) -> None:
- """Write a configuration file according to the current configuration
- into the given stream or stdout.
- """
- options_by_section: dict[str, list[tuple[str, OptionDict, Any]]] = {}
- sections = []
- for provider in self.options_providers:
- for section, options in provider.options_by_section():
- if section is None:
- section = provider.name
- if section in skipsections:
- continue
- options = [
- (n, d, v)
- for (n, d, v) in options
- if d.get("type") is not None and not d.get("deprecated")
- ]
- if not options:
- continue
- if section not in sections:
- sections.append(section)
- all_options = options_by_section.setdefault(section, [])
- all_options += options
- stream = stream or sys.stdout
- printed = False
- for section in sections:
- if printed:
- print("\n", file=stream)
- utils.format_section(
- stream, section.upper(), sorted(options_by_section[section])
- )
- printed = True
-
- def load_provider_defaults(self) -> None:
- """Initialize configuration using default values."""
- for provider in self.options_providers:
- provider.load_defaults()
-
- def read_config_file(
- self, config_file: Path | None = None, verbose: bool = False
- ) -> None:
- """Read the configuration file but do not load it (i.e. dispatching
- values to each option's provider).
- """
- if config_file:
- config_file = Path(os.path.expandvars(config_file)).expanduser()
- if not config_file.exists():
- raise OSError(f"The config file {str(config_file)} doesn't exist!")
-
- parser = self.cfgfile_parser
- if config_file.suffix == ".toml":
- try:
- self._parse_toml(config_file, parser)
- except tomllib.TOMLDecodeError:
- pass
- else:
- # Use this encoding in order to strip the BOM marker, if any.
- with open(config_file, encoding="utf_8_sig") as fp:
- parser.read_file(fp)
- # normalize each section's title
- for sect, values in list(parser._sections.items()): # type: ignore[attr-defined]
- if sect.startswith("pylint."):
- sect = sect[len("pylint.") :]
- if not sect.isupper() and values:
- parser._sections[sect.upper()] = values # type: ignore[attr-defined]
-
- if not verbose:
- return
- if config_file and config_file.exists():
- msg = f"Using config file '{config_file}'"
- else:
- msg = "No config file found, using default configuration"
- print(msg, file=sys.stderr)
-
- def _parse_toml(self, config_file: Path, parser: configparser.ConfigParser) -> None:
- """Parse and handle errors of a toml configuration file."""
- with open(config_file, mode="rb") as fp:
- content = tomllib.load(fp)
- try:
- sections_values = content["tool"]["pylint"]
- except KeyError:
- return
- for section, values in sections_values.items():
- section_name = section.upper()
- # TOML has rich types, convert values to
- # strings as ConfigParser expects.
- if not isinstance(values, dict):
- # This class is a mixin: add_message comes from the `PyLinter` class
- self.add_message( # type: ignore[attr-defined]
- "bad-configuration-section", line=0, args=(section, values)
- )
- continue
- for option, value in values.items():
- if isinstance(value, bool):
- values[option] = "yes" if value else "no"
- elif isinstance(value, list):
- values[option] = ",".join(value)
- else:
- values[option] = str(value)
- for option, value in values.items():
- try:
- parser.set(section_name, option, value=value)
- except configparser.NoSectionError:
- parser.add_section(section_name)
- parser.set(section_name, option, value=value)
-
- def load_config_file(self) -> None:
- """Dispatch values previously read from a configuration file to each
- option's provider.
- """
- parser = self.cfgfile_parser
- for section in parser.sections():
- for option, value in parser.items(section):
- try:
- self.global_set_option(option, value)
- except (KeyError, optparse.OptionError):
- continue
-
- def load_configuration(self, **kwargs: Any) -> None:
- """Override configuration according to given parameters."""
- return self.load_configuration_from_config(kwargs)
-
- def load_configuration_from_config(self, config: dict[str, Any]) -> None:
- for opt, opt_value in config.items():
- opt = opt.replace("_", "-")
- provider = self._all_options[opt]
- provider.set_option(opt, opt_value)
-
- def load_command_line_configuration(
- self, args: list[str] | None = None
- ) -> list[str]:
- """Override configuration according to command line parameters.
-
- return additional arguments
- """
- with _patch_optparse():
- args = sys.argv[1:] if args is None else list(args)
- (options, args) = self.cmdline_parser.parse_args(args=args)
- for provider in self._nocallback_options:
- config = provider.config
- for attr in config.__dict__.keys():
- value = getattr(options, attr, None)
- if value is None:
- continue
- setattr(config, attr, value)
- return args # type: ignore[return-value]
-
- def help(self, level: int = 0) -> str:
- """Return the usage string for available options."""
- self.cmdline_parser.formatter.output_level = level
- with _patch_optparse():
- return str(self.cmdline_parser.format_help())
diff --git a/pylint/config/option_parser.py b/pylint/config/option_parser.py
deleted file mode 100644
index 9ffb80116..000000000
--- a/pylint/config/option_parser.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-# type: ignore # Deprecated module.
-
-import optparse # pylint: disable=deprecated-module
-import warnings
-
-from pylint.config.option import Option
-
-
-def _level_options(group, outputlevel):
- return [
- option
- for option in group.option_list
- if (getattr(option, "level", 0) or 0) <= outputlevel
- and option.help is not optparse.SUPPRESS_HELP
- ]
-
-
-class OptionParser(optparse.OptionParser):
- def __init__(self, option_class, *args, **kwargs):
- # TODO: 3.0: Remove deprecated class
- warnings.warn(
- "OptionParser has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- super().__init__(option_class=Option, *args, **kwargs) # noqa: B026
-
- def format_option_help(self, formatter=None):
- if formatter is None:
- formatter = self.formatter
- outputlevel = getattr(formatter, "output_level", 0)
- formatter.store_option_strings(self)
- result = [formatter.format_heading("Options")]
- formatter.indent()
- if self.option_list:
- result.append(optparse.OptionContainer.format_option_help(self, formatter))
- result.append("\n")
- for group in self.option_groups:
- if group.level <= outputlevel and (
- group.description or _level_options(group, outputlevel)
- ):
- result.append(group.format_help(formatter))
- result.append("\n")
- formatter.dedent()
- # Drop the last "\n", or the header if no options or option groups:
- return "".join(result[:-1])
-
- def _match_long_opt(self, opt): # pragma: no cover # Unused
- """Disable abbreviations."""
- if opt not in self._long_opt:
- raise optparse.BadOptionError(opt)
- return opt
diff --git a/pylint/config/options_provider_mixin.py b/pylint/config/options_provider_mixin.py
deleted file mode 100644
index 67f64ee0a..000000000
--- a/pylint/config/options_provider_mixin.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-# type: ignore # Deprecated module.
-
-import optparse # pylint: disable=deprecated-module
-import warnings
-
-from pylint.config.callback_actions import _CallbackAction
-from pylint.config.option import _validate
-from pylint.typing import Options
-
-
-class UnsupportedAction(Exception):
- """Raised by set_option when it doesn't know what to do for an action."""
-
-
-class OptionsProviderMixIn:
- """Mixin to provide options to an OptionsManager."""
-
- # those attributes should be overridden
- name = "default"
- options: Options = ()
- level = 0
-
- def __init__(self):
- # TODO: 3.0: Remove deprecated class
- warnings.warn(
- "OptionsProviderMixIn has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- self.config = optparse.Values()
- self.load_defaults()
-
- def load_defaults(self):
- """Initialize the provider using default values."""
- for opt, optdict in self.options:
- action = optdict.get("action")
- if action != "callback":
- # callback action have no default
- if optdict is None:
- optdict = self.get_option_def(opt)
- default = optdict.get("default")
- self.set_option(opt, default, action, optdict)
-
- def option_attrname(self, opt, optdict=None):
- """Get the config attribute corresponding to opt."""
- if optdict is None:
- optdict = self.get_option_def(opt)
- return optdict.get("dest", opt.replace("-", "_"))
-
- def option_value(self, opt):
- """Get the current value for the given option."""
- return getattr(self.config, self.option_attrname(opt), None)
-
- def set_option(self, optname, value, action=None, optdict=None):
- """Method called to set an option (registered in the options list)."""
- if optdict is None:
- optdict = self.get_option_def(optname)
- if value is not None:
- value = _validate(value, optdict, optname)
- if action is None:
- action = optdict.get("action", "store")
- if action == "store":
- setattr(self.config, self.option_attrname(optname, optdict), value)
- elif action in {"store_true", "count"}:
- setattr(self.config, self.option_attrname(optname, optdict), value)
- elif action == "store_false":
- setattr(self.config, self.option_attrname(optname, optdict), value)
- elif action == "append":
- optname = self.option_attrname(optname, optdict)
- _list = getattr(self.config, optname, None)
- if _list is None:
- if isinstance(value, (list, tuple)):
- _list = value
- elif value is not None:
- _list = [value]
- setattr(self.config, optname, _list)
- elif isinstance(_list, tuple):
- setattr(self.config, optname, _list + (value,))
- else:
- _list.append(value)
- elif (
- action == "callback"
- or (not isinstance(action, str))
- and issubclass(action, _CallbackAction)
- ):
- return
- else:
- raise UnsupportedAction(action)
-
- def get_option_def(self, opt):
- """Return the dictionary defining an option given its name."""
- assert self.options
- for option in self.options:
- if option[0] == opt:
- return option[1]
- raise optparse.OptionError(
- f"no such option {opt} in section {self.name!r}", opt
- )
-
- def options_by_section(self):
- """Return an iterator on options grouped by section.
-
- (section, [list of (optname, optdict, optvalue)])
- """
- sections = {}
- for optname, optdict in self.options:
- sections.setdefault(optdict.get("group"), []).append(
- (optname, optdict, self.option_value(optname))
- )
- if None in sections:
- yield None, sections.pop(None)
- for section, options in sorted(sections.items()):
- yield section.upper(), options
-
- def options_and_values(self, options=None):
- if options is None:
- options = self.options
- for optname, optdict in options:
- yield optname, optdict, self.option_value(optname)
diff --git a/pylint/config/utils.py b/pylint/config/utils.py
index d7cbd7c07..91e4ff86f 100644
--- a/pylint/config/utils.py
+++ b/pylint/config/utils.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Utils for arguments/options parsing and handling."""
from __future__ import annotations
import re
-import warnings
from collections.abc import Callable, Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any
@@ -39,14 +38,6 @@ def _convert_option_to_argument(
| _ExtendArgument
):
"""Convert an optdict to an Argument class instance."""
- if "level" in optdict and "hide" not in optdict:
- warnings.warn(
- "The 'level' key in optdicts has been deprecated. "
- "Use 'hide' with a boolean to hide an option from the help message. "
- f"optdict={optdict}",
- DeprecationWarning,
- )
-
# Get the long and short flags
flags = [f"--{opt}"]
if "short" in optdict:
@@ -74,17 +65,9 @@ def _convert_option_to_argument(
section=optdict.get("group", None),
metavar=optdict.get("metavar", None),
)
- try:
- default = optdict["default"]
- except KeyError:
- warnings.warn(
- "An option dictionary should have a 'default' key to specify "
- "the option's default value. This key will be required in pylint "
- "3.0. It is not required for 'store_true' and callable actions. "
- f"optdict={optdict}",
- DeprecationWarning,
- )
- default = None
+
+ default = optdict["default"]
+
if action == "extend":
return _ExtendArgument(
flags=flags,
diff --git a/pylint/constants.py b/pylint/constants.py
index de29fb9b8..5bf4abf5c 100644
--- a/pylint/constants.py
+++ b/pylint/constants.py
@@ -1,14 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import os
-import pathlib
import platform
import sys
-from datetime import datetime
import astroid
import platformdirs
@@ -49,9 +47,6 @@ MSG_TYPES_STATUS = {"I": 0, "C": 16, "R": 8, "W": 4, "E": 2, "F": 1}
# on all project using [MAIN] in their rcfile.
MAIN_CHECKER_NAME = "main"
-USER_HOME = os.path.expanduser("~")
-# TODO: 3.0: Remove in 3.0 with all the surrounding code
-OLD_DEFAULT_PYLINT_HOME = ".pylint.d"
DEFAULT_PYLINT_HOME = platformdirs.user_cache_dir("pylint")
DEFAULT_IGNORE_LIST = ("CVS",)
@@ -101,55 +96,10 @@ INCOMPATIBLE_WITH_USELESS_SUPPRESSION = frozenset(
)
-def _warn_about_old_home(pylint_home: pathlib.Path) -> None:
- """Warn users about the old pylint home being deprecated.
-
- The spam prevention mechanism is due to pylint being used in parallel by
- pre-commit, and the message being spammy in this context
- Also if you work with an old version of pylint that recreates the
- old pylint home, you can get the old message for a long time.
- """
- prefix_spam_prevention = "pylint_warned_about_old_cache_already"
- spam_prevention_file = pathlib.Path(pylint_home) / datetime.now().strftime(
- prefix_spam_prevention + "_%Y-%m-%d.temp"
- )
- old_home = pathlib.Path(USER_HOME) / OLD_DEFAULT_PYLINT_HOME
-
- if old_home.exists() and not spam_prevention_file.exists():
- print(
- f"PYLINTHOME is now '{pylint_home}' but obsolescent '{old_home}' is found; "
- "you can safely remove the latter",
- file=sys.stderr,
- )
-
- # Remove old spam prevention file
- if pylint_home.exists():
- for filename in pylint_home.iterdir():
- if prefix_spam_prevention in str(filename):
- try:
- os.remove(pylint_home / filename)
- except OSError: # pragma: no cover
- pass
-
- # Create spam prevention file for today
- try:
- pylint_home.mkdir(parents=True, exist_ok=True)
- with open(spam_prevention_file, "w", encoding="utf8") as f:
- f.write("")
- except Exception as exc: # pragma: no cover # pylint: disable=broad-except
- print(
- "Can't write the file that was supposed to "
- f"prevent 'pylint.d' deprecation spam in {pylint_home} because of {exc}."
- )
-
-
def _get_pylint_home() -> str:
"""Return the pylint home."""
if "PYLINTHOME" in os.environ:
return os.environ["PYLINTHOME"]
-
- _warn_about_old_home(pathlib.Path(DEFAULT_PYLINT_HOME))
-
return DEFAULT_PYLINT_HOME
diff --git a/pylint/epylint.py b/pylint/epylint.py
deleted file mode 100755
index dd23b450b..000000000
--- a/pylint/epylint.py
+++ /dev/null
@@ -1,224 +0,0 @@
-# mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4
-# -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4
-
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Emacs and Flymake compatible Pylint.
-
-This script is for integration with Emacs and is compatible with Flymake mode.
-
-epylint walks out of python packages before invoking pylint. This avoids
-reporting import errors that occur when a module within a package uses the
-absolute import path to get another module within this package.
-
-For example:
- - Suppose a package is structured as
-
- a/__init__.py
- a/b/x.py
- a/c/y.py
-
- - Then if y.py imports x as "from a.b import x" the following produces pylint
- errors
-
- cd a/c; pylint y.py
-
- - The following obviously doesn't
-
- pylint a/c/y.py
-
- - As this script will be invoked by Emacs within the directory of the file
- we are checking we need to go out of it to avoid these false positives.
-
-You may also use py_run to run pylint with desired options and get back (or not)
-its output.
-"""
-
-from __future__ import annotations
-
-import os
-import shlex
-import sys
-import warnings
-from collections.abc import Sequence
-from io import StringIO
-from subprocess import PIPE, Popen
-from typing import NoReturn, TextIO, overload
-
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
-
-def _get_env() -> dict[str, str]:
- """Extracts the environment PYTHONPATH and appends the current 'sys.path'
- to it.
- """
- env = dict(os.environ)
- env["PYTHONPATH"] = os.pathsep.join(sys.path)
- return env
-
-
-def lint(filename: str, options: Sequence[str] = ()) -> int:
- """Pylint the given file.
-
- When run from Emacs we will be in the directory of a file, and passed its
- filename. If this file is part of a package and is trying to import other
- modules from within its own package or another package rooted in a directory
- below it, pylint will classify it as a failed import.
-
- To get around this, we traverse down the directory tree to find the root of
- the package this module is in. We then invoke pylint from this directory.
-
- Finally, we must correct the filenames in the output generated by pylint so
- Emacs doesn't become confused (it will expect just the original filename,
- while pylint may extend it with extra directories if we've traversed down
- the tree)
- """
- # traverse downwards until we are out of a python package
- full_path = os.path.abspath(filename)
- parent_path = os.path.dirname(full_path)
- child_path = os.path.basename(full_path)
-
- while parent_path != "/" and os.path.exists(
- os.path.join(parent_path, "__init__.py")
- ):
- child_path = os.path.join(os.path.basename(parent_path), child_path)
- parent_path = os.path.dirname(parent_path)
-
- # Start pylint
- # Ensure we use the python and pylint associated with the running epylint
- run_cmd = "import sys; from pylint.lint import Run; Run(sys.argv[1:])"
- cmd = (
- [sys.executable, "-c", run_cmd]
- + [
- "--msg-template",
- "{path}:{line}: {category} ({msg_id}, {symbol}, {obj}) {msg}",
- "-r",
- "n",
- child_path,
- ]
- + list(options)
- )
-
- with Popen(
- cmd, stdout=PIPE, cwd=parent_path, env=_get_env(), universal_newlines=True
- ) as process:
- for line in process.stdout: # type: ignore[union-attr]
- # remove pylintrc warning
- if line.startswith("No config file found"):
- continue
-
- # modify the file name that's put out to reverse the path traversal we made
- parts = line.split(":")
- if parts and parts[0] == child_path:
- line = ":".join([filename] + parts[1:])
- print(line, end=" ")
-
- process.wait()
- return process.returncode
-
-
-@overload
-def py_run(
- command_options: str = ...,
- return_std: Literal[False] = ...,
- stdout: TextIO | int | None = ...,
- stderr: TextIO | int | None = ...,
-) -> None:
- ...
-
-
-@overload
-def py_run(
- command_options: str,
- return_std: Literal[True],
- stdout: TextIO | int | None = ...,
- stderr: TextIO | int | None = ...,
-) -> tuple[StringIO, StringIO]:
- ...
-
-
-def py_run(
- command_options: str = "",
- return_std: bool = False,
- stdout: TextIO | int | None = None,
- stderr: TextIO | int | None = None,
-) -> tuple[StringIO, StringIO] | None:
- """Run pylint from python.
-
- ``command_options`` is a string containing ``pylint`` command line options;
- ``return_std`` (boolean) indicates return of created standard output
- and error (see below);
- ``stdout`` and ``stderr`` are 'file-like' objects in which standard output
- could be written.
-
- Calling agent is responsible for stdout/err management (creation, close).
- Default standard output and error are those from sys,
- or standalone ones (``subprocess.PIPE``) are used
- if they are not set and ``return_std``.
-
- If ``return_std`` is set to ``True``, this function returns a 2-uple
- containing standard output and error related to created process,
- as follows: ``(stdout, stderr)``.
-
- To silently run Pylint on a module, and get its standard output and error:
- >>> (pylint_stdout, pylint_stderr) = py_run( 'module_name.py', True)
- """
- warnings.warn(
- "'epylint' will be removed in pylint 3.0, use https://github.com/emacsorphanage/pylint instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- # Detect if we use Python as executable or not, else default to `python`
- executable = sys.executable if "python" in sys.executable else "python"
-
- # Create command line to call pylint
- epylint_part = [executable, "-c", "from pylint import epylint;epylint.Run()"]
- options = shlex.split(command_options, posix=not sys.platform.startswith("win"))
- cli = epylint_part + options
-
- # Providing standard output and/or error if not set
- if stdout is None:
- stdout = PIPE if return_std else sys.stdout
- if stderr is None:
- stderr = PIPE if return_std else sys.stderr
- # Call pylint in a sub-process
- with Popen(
- cli,
- shell=False,
- stdout=stdout,
- stderr=stderr,
- env=_get_env(),
- universal_newlines=True,
- ) as process:
- proc_stdout, proc_stderr = process.communicate()
- # Return standard output and error
- if return_std:
- return StringIO(proc_stdout), StringIO(proc_stderr)
- return None
-
-
-def Run(argv: Sequence[str] | None = None) -> NoReturn:
- warnings.warn(
- "'epylint' will be removed in pylint 3.0, use https://github.com/emacsorphanage/pylint instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- if not argv and len(sys.argv) == 1:
- print(f"Usage: {sys.argv[0]} <filename> [options]")
- sys.exit(1)
-
- argv = argv or sys.argv[1:]
- if not os.path.exists(argv[0]):
- print(f"{argv[0]} does not exist")
- sys.exit(1)
- else:
- sys.exit(lint(argv[0], argv[1:]))
-
-
-if __name__ == "__main__":
- Run()
diff --git a/pylint/exceptions.py b/pylint/exceptions.py
index 766eb9327..2bfbfa8cc 100644
--- a/pylint/exceptions.py
+++ b/pylint/exceptions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Exception classes raised by various operations within pylint."""
diff --git a/pylint/extensions/__init__.py b/pylint/extensions/__init__.py
index 01b978e4b..e9e2b0d1b 100644
--- a/pylint/extensions/__init__.py
+++ b/pylint/extensions/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py
index 33edc95e9..dddc577d6 100644
--- a/pylint/extensions/_check_docs_utils.py
+++ b/pylint/extensions/_check_docs_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Utility methods for docstring checking."""
diff --git a/pylint/extensions/bad_builtin.py b/pylint/extensions/bad_builtin.py
index 904b2a394..22ef2b95e 100644
--- a/pylint/extensions/bad_builtin.py
+++ b/pylint/extensions/bad_builtin.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checker for deprecated builtins."""
diff --git a/pylint/extensions/broad_try_clause.py b/pylint/extensions/broad_try_clause.py
index 2291d32d4..762055a25 100644
--- a/pylint/extensions/broad_try_clause.py
+++ b/pylint/extensions/broad_try_clause.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Looks for try/except statements with too much code in the try clause."""
diff --git a/pylint/extensions/check_elif.py b/pylint/extensions/check_elif.py
index b584ea35e..de20ed8ec 100644
--- a/pylint/extensions/check_elif.py
+++ b/pylint/extensions/check_elif.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/code_style.py b/pylint/extensions/code_style.py
index 262a7f0c4..5ce1ae476 100644
--- a/pylint/extensions/code_style.py
+++ b/pylint/extensions/code_style.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/comparetozero.py b/pylint/extensions/comparetozero.py
deleted file mode 100644
index 116bf229a..000000000
--- a/pylint/extensions/comparetozero.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Looks for comparisons to zero."""
-
-from __future__ import annotations
-
-import itertools
-from typing import TYPE_CHECKING
-
-import astroid
-from astroid import nodes
-
-from pylint import checkers
-from pylint.checkers import utils
-from pylint.interfaces import HIGH
-
-if TYPE_CHECKING:
- from pylint.lint import PyLinter
-
-
-def _is_constant_zero(node: str | nodes.NodeNG) -> bool:
- # We have to check that node.value is not False because node.value == 0 is True
- # when node.value is False
- return (
- isinstance(node, astroid.Const) and node.value == 0 and node.value is not False
- )
-
-
-class CompareToZeroChecker(checkers.BaseChecker):
- """Checks for comparisons to zero.
-
- Most of the time you should use the fact that integers with a value of 0 are false.
- An exception to this rule is when 0 is allowed in the program and has a
- different meaning than None!
- """
-
- # configuration section name
- name = "compare-to-zero"
- msgs = {
- "C2001": (
- '"%s" can be simplified to "%s" as 0 is falsey',
- "compare-to-zero",
- "Used when Pylint detects comparison to a 0 constant.",
- )
- }
-
- options = ()
-
- @utils.only_required_for_messages("compare-to-zero")
- def visit_compare(self, node: nodes.Compare) -> None:
- # pylint: disable=duplicate-code
- _operators = ["!=", "==", "is not", "is"]
- # note: astroid.Compare has the left most operand in node.left
- # while the rest are a list of tuples in node.ops
- # the format of the tuple is ('compare operator sign', node)
- # here we squash everything into `ops` to make it easier for processing later
- ops: list[tuple[str, nodes.NodeNG]] = [("", node.left)]
- ops.extend(node.ops)
- iter_ops = iter(ops)
- all_ops = list(itertools.chain(*iter_ops))
-
- for ops_idx in range(len(all_ops) - 2):
- op_1 = all_ops[ops_idx]
- op_2 = all_ops[ops_idx + 1]
- op_3 = all_ops[ops_idx + 2]
- error_detected = False
-
- # 0 ?? X
- if _is_constant_zero(op_1) and op_2 in _operators:
- error_detected = True
- op = op_3
- # X ?? 0
- elif op_2 in _operators and _is_constant_zero(op_3):
- error_detected = True
- op = op_1
-
- if error_detected:
- original = f"{op_1.as_string()} {op_2} {op_3.as_string()}"
- suggestion = (
- op.as_string()
- if op_2 in {"!=", "is not"}
- else f"not {op.as_string()}"
- )
- self.add_message(
- "compare-to-zero",
- args=(original, suggestion),
- node=node,
- confidence=HIGH,
- )
-
-
-def register(linter: PyLinter) -> None:
- linter.register_checker(CompareToZeroChecker(linter))
diff --git a/pylint/extensions/comparison_placement.py b/pylint/extensions/comparison_placement.py
index df7cc9890..f7ecceae3 100644
--- a/pylint/extensions/comparison_placement.py
+++ b/pylint/extensions/comparison_placement.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checks for yoda comparisons (variable before constant)
See https://en.wikipedia.org/wiki/Yoda_conditions.
diff --git a/pylint/extensions/confusing_elif.py b/pylint/extensions/confusing_elif.py
index ada8b5ab1..546b644b3 100644
--- a/pylint/extensions/confusing_elif.py
+++ b/pylint/extensions/confusing_elif.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/consider_refactoring_into_while_condition.py b/pylint/extensions/consider_refactoring_into_while_condition.py
index b4b53d8fa..b7e905e8a 100644
--- a/pylint/extensions/consider_refactoring_into_while_condition.py
+++ b/pylint/extensions/consider_refactoring_into_while_condition.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Looks for try/except statements with too much code in the try clause."""
diff --git a/pylint/extensions/consider_ternary_expression.py b/pylint/extensions/consider_ternary_expression.py
index 0e9444662..83046ce38 100644
--- a/pylint/extensions/consider_ternary_expression.py
+++ b/pylint/extensions/consider_ternary_expression.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for if / assign blocks that can be rewritten with if-expressions."""
diff --git a/pylint/extensions/dict_init_mutate.py b/pylint/extensions/dict_init_mutate.py
index fb4c83647..4977e234b 100644
--- a/pylint/extensions/dict_init_mutate.py
+++ b/pylint/extensions/dict_init_mutate.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for use of dictionary mutation after initialization."""
from __future__ import annotations
diff --git a/pylint/extensions/docparams.py b/pylint/extensions/docparams.py
index 0c2e4e9e3..6e173c39e 100644
--- a/pylint/extensions/docparams.py
+++ b/pylint/extensions/docparams.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Pylint plugin for checking in Sphinx, Google, or Numpy style docstrings."""
diff --git a/pylint/extensions/docstyle.py b/pylint/extensions/docstyle.py
index 1ca2885e9..c54ab93b2 100644
--- a/pylint/extensions/docstyle.py
+++ b/pylint/extensions/docstyle.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/dunder.py b/pylint/extensions/dunder.py
index e0e9af316..ad3e272aa 100644
--- a/pylint/extensions/dunder.py
+++ b/pylint/extensions/dunder.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/empty_comment.py b/pylint/extensions/empty_comment.py
index e8a914708..61e257ffd 100644
--- a/pylint/extensions/empty_comment.py
+++ b/pylint/extensions/empty_comment.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/emptystring.py b/pylint/extensions/emptystring.py
deleted file mode 100644
index f96a980f5..000000000
--- a/pylint/extensions/emptystring.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Looks for comparisons to empty string."""
-
-from __future__ import annotations
-
-import itertools
-from typing import TYPE_CHECKING
-
-from astroid import nodes
-
-from pylint import checkers
-from pylint.checkers import utils
-from pylint.interfaces import HIGH
-
-if TYPE_CHECKING:
- from pylint.lint import PyLinter
-
-
-class CompareToEmptyStringChecker(checkers.BaseChecker):
- name = "compare-to-empty-string"
- msgs = {
- "C1901": (
- '"%s" can be simplified to "%s" as an empty string is falsey',
- "compare-to-empty-string",
- "Used when Pylint detects comparison to an empty string constant.",
- )
- }
-
- options = ()
-
- @utils.only_required_for_messages("compare-to-empty-string")
- def visit_compare(self, node: nodes.Compare) -> None:
- """Checks for comparisons to empty string.
-
- Most of the time you should use the fact that empty strings are false.
- An exception to this rule is when an empty string value is allowed in the program
- and has a different meaning than None!
- """
- _operators = {"!=", "==", "is not", "is"}
- # note: astroid.Compare has the left most operand in node.left while the rest
- # are a list of tuples in node.ops the format of the tuple is
- # ('compare operator sign', node) here we squash everything into `ops`
- # to make it easier for processing later
- ops: list[tuple[str, nodes.NodeNG | None]] = [("", node.left)]
- ops.extend(node.ops)
- iter_ops = iter(ops)
- ops = list(itertools.chain(*iter_ops)) # type: ignore[arg-type]
- for ops_idx in range(len(ops) - 2):
- op_1: nodes.NodeNG | None = ops[ops_idx]
- op_2: str = ops[ops_idx + 1] # type: ignore[assignment]
- op_3: nodes.NodeNG | None = ops[ops_idx + 2]
- error_detected = False
- if op_1 is None or op_3 is None or op_2 not in _operators:
- continue
- node_name = ""
- # x ?? ""
- if utils.is_empty_str_literal(op_1):
- error_detected = True
- node_name = op_3.as_string()
- # '' ?? X
- elif utils.is_empty_str_literal(op_3):
- error_detected = True
- node_name = op_1.as_string()
- if error_detected:
- suggestion = f"not {node_name}" if op_2 in {"==", "is"} else node_name
- self.add_message(
- "compare-to-empty-string",
- args=(node.as_string(), suggestion),
- node=node,
- confidence=HIGH,
- )
-
-
-def register(linter: PyLinter) -> None:
- linter.register_checker(CompareToEmptyStringChecker(linter))
diff --git a/pylint/extensions/eq_without_hash.py b/pylint/extensions/eq_without_hash.py
index b0d0f01bd..5f39dfa3e 100644
--- a/pylint/extensions/eq_without_hash.py
+++ b/pylint/extensions/eq_without_hash.py
@@ -1,12 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""This is the remnant of the python3 checker.
It was removed because the transition from python 2 to python3 is
behind us, but some checks are still useful in python3 after all.
-See https://github.com/PyCQA/pylint/issues/5025
+See https://github.com/pylint-dev/pylint/issues/5025
"""
from astroid import nodes
diff --git a/pylint/extensions/for_any_all.py b/pylint/extensions/for_any_all.py
index bc7dd9c48..2369a595d 100644
--- a/pylint/extensions/for_any_all.py
+++ b/pylint/extensions/for_any_all.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for use of for loops that only check for a condition."""
diff --git a/pylint/extensions/magic_value.py b/pylint/extensions/magic_value.py
index 7cfb410ae..c69711f85 100644
--- a/pylint/extensions/magic_value.py
+++ b/pylint/extensions/magic_value.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Checks for magic values instead of literals."""
diff --git a/pylint/extensions/mccabe.py b/pylint/extensions/mccabe.py
index ea64d2ebf..604360fb7 100644
--- a/pylint/extensions/mccabe.py
+++ b/pylint/extensions/mccabe.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Module to add McCabe checker class for pylint."""
diff --git a/pylint/extensions/no_self_use.py b/pylint/extensions/no_self_use.py
index 0fd38877f..8b9b8aa9b 100644
--- a/pylint/extensions/no_self_use.py
+++ b/pylint/extensions/no_self_use.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/overlapping_exceptions.py b/pylint/extensions/overlapping_exceptions.py
index 93d225137..ddcf24e7c 100644
--- a/pylint/extensions/overlapping_exceptions.py
+++ b/pylint/extensions/overlapping_exceptions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Looks for overlapping exceptions."""
diff --git a/pylint/extensions/private_import.py b/pylint/extensions/private_import.py
index df08c7116..a9e537c1b 100644
--- a/pylint/extensions/private_import.py
+++ b/pylint/extensions/private_import.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for imports on private external modules and names."""
diff --git a/pylint/extensions/redefined_loop_name.py b/pylint/extensions/redefined_loop_name.py
index df333fab9..d03b80be3 100644
--- a/pylint/extensions/redefined_loop_name.py
+++ b/pylint/extensions/redefined_loop_name.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Optional checker to warn when loop variables are overwritten in the loop's body."""
diff --git a/pylint/extensions/redefined_variable_type.py b/pylint/extensions/redefined_variable_type.py
index 8d88d856e..ba5af3136 100644
--- a/pylint/extensions/redefined_variable_type.py
+++ b/pylint/extensions/redefined_variable_type.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/set_membership.py b/pylint/extensions/set_membership.py
index f267e046f..b72f5aa18 100644
--- a/pylint/extensions/set_membership.py
+++ b/pylint/extensions/set_membership.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/typing.py b/pylint/extensions/typing.py
index 264d0c383..2956465cf 100644
--- a/pylint/extensions/typing.py
+++ b/pylint/extensions/typing.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/extensions/while_used.py b/pylint/extensions/while_used.py
index 6f9612196..da1f9d59c 100644
--- a/pylint/extensions/while_used.py
+++ b/pylint/extensions/while_used.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check for use of while loops."""
diff --git a/pylint/graph.py b/pylint/graph.py
index 5cffca615..4112fadfa 100644
--- a/pylint/graph.py
+++ b/pylint/graph.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Graph manipulation utilities.
diff --git a/pylint/interfaces.py b/pylint/interfaces.py
index 221084fab..a93a40ceb 100644
--- a/pylint/interfaces.py
+++ b/pylint/interfaces.py
@@ -1,28 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Interfaces for Pylint objects."""
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-import warnings
-from tokenize import TokenInfo
-from typing import TYPE_CHECKING, NamedTuple
-
-from astroid import nodes
-
-if TYPE_CHECKING:
- from pylint.checkers import BaseChecker
- from pylint.message import Message
- from pylint.reporters.ureports.nodes import Section
+from typing import NamedTuple
__all__ = (
- "IRawChecker",
- "IAstroidChecker",
- "ITokenChecker",
- "IReporter",
- "IChecker",
"HIGH",
"CONTROL_FLOW",
"INFERENCE",
@@ -51,87 +35,3 @@ UNDEFINED = Confidence("UNDEFINED", "Warning without any associated confidence l
CONFIDENCE_LEVELS = [HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, UNDEFINED]
CONFIDENCE_LEVEL_NAMES = [i.name for i in CONFIDENCE_LEVELS]
-
-
-class Interface:
- """Base class for interfaces."""
-
- def __init__(self) -> None:
- warnings.warn(
- "Interface and all of its subclasses have been deprecated "
- "and will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
-
- @classmethod
- def is_implemented_by(
- cls: type[Interface] | tuple[type[Interface], ...], instance: BaseChecker
- ) -> bool:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- return implements(instance, cls)
-
-
-def implements(
- obj: BaseChecker,
- interface: type[Interface] | tuple[type[Interface], ...],
-) -> bool:
- """Does the given object (maybe an instance or class) implement the interface."""
- # TODO: 3.0: Remove deprecated function
- warnings.warn(
- "implements has been deprecated in favour of using basic "
- "inheritance patterns without using __implements__.",
- DeprecationWarning,
- stacklevel=2,
- )
- implements_ = getattr(obj, "__implements__", ())
- if not isinstance(implements_, (list, tuple)):
- implements_ = (implements_,)
- return any(issubclass(i, interface) for i in implements_)
-
-
-class IChecker(Interface):
- """Base interface, to be used only for sub interfaces definition."""
-
- def open(self) -> None:
- """Called before visiting project (i.e. set of modules)."""
-
- def close(self) -> None:
- """Called after visiting project (i.e. set of modules)."""
-
-
-class IRawChecker(IChecker):
- """Interface for checker which need to parse the raw file."""
-
- def process_module(self, node: nodes.Module) -> None:
- """Process a module.
-
- The module's content is accessible via ``astroid.stream``
- """
-
-
-class ITokenChecker(IChecker):
- """Interface for checkers that need access to the token list."""
-
- def process_tokens(self, tokens: list[TokenInfo]) -> None:
- """Process a module.
-
- Tokens is a list of all source code tokens in the file.
- """
-
-
-class IAstroidChecker(IChecker):
- """Interface for checker which prefers receive events according to
- statement type.
- """
-
-
-class IReporter(Interface):
- """Reporter collect messages and display results encapsulated in a layout."""
-
- def handle_message(self, msg: Message) -> None:
- """Handle the given message object."""
-
- def display_reports(self, layout: Section) -> None:
- """Display results encapsulated in the layout tree."""
diff --git a/pylint/lint/__init__.py b/pylint/lint/__init__.py
index 573d9c262..adc920708 100644
--- a/pylint/lint/__init__.py
+++ b/pylint/lint/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Pylint [options] modules_or_packages.
@@ -27,12 +27,7 @@ from pylint.lint.report_functions import (
report_total_messages_stats,
)
from pylint.lint.run import Run
-from pylint.lint.utils import (
- _augment_sys_path,
- _patch_sys_path,
- augmented_sys_path,
- fix_import_path,
-)
+from pylint.lint.utils import _augment_sys_path, augmented_sys_path
__all__ = [
"check_parallel",
@@ -42,8 +37,6 @@ __all__ = [
"report_total_messages_stats",
"Run",
"ArgumentPreprocessingError",
- "_patch_sys_path",
- "fix_import_path",
"_augment_sys_path",
"augmented_sys_path",
"discover_package_path",
diff --git a/pylint/lint/base_options.py b/pylint/lint/base_options.py
index b7c81991a..ee811db4e 100644
--- a/pylint/lint/base_options.py
+++ b/pylint/lint/base_options.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Functions that creates the basic options for the Run and PyLinter classes."""
diff --git a/pylint/lint/caching.py b/pylint/lint/caching.py
index 8ea8a2236..97c4503d1 100644
--- a/pylint/lint/caching.py
+++ b/pylint/lint/caching.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -45,6 +45,7 @@ def load_results(
"You're using an old pylint cache with invalid data following "
f"an upgrade, please delete '{data_file}'.",
UserWarning,
+ stacklevel=2,
)
raise TypeError
return data
diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py
index bb25986e4..1e8fd032f 100644
--- a/pylint/lint/expand_modules.py
+++ b/pylint/lint/expand_modules.py
@@ -1,12 +1,11 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import os
import sys
-import warnings
from collections.abc import Sequence
from re import Pattern
@@ -24,18 +23,6 @@ def _modpath_from_file(filename: str, is_namespace: bool, path: list[str]) -> li
)
-def get_python_path(filepath: str) -> str:
- # TODO: Remove deprecated function
- warnings.warn(
- "get_python_path has been deprecated because assumption that there's always an __init__.py "
- "is not true since python 3.3 and is causing problems, particularly with PEP 420."
- "Use discover_package_path and pass source root(s).",
- DeprecationWarning,
- stacklevel=2,
- )
- return discover_package_path(filepath, [])
-
-
def discover_package_path(modulepath: str, source_roots: Sequence[str]) -> str:
"""Discover package path from one its modules and source roots."""
dirname = os.path.realpath(os.path.expanduser(modulepath))
@@ -101,7 +88,7 @@ def expand_modules(
):
continue
module_package_path = discover_package_path(something, source_roots)
- additional_search_path = [".", module_package_path] + path
+ additional_search_path = [".", module_package_path, *path]
if os.path.exists(something):
# this is a file or a directory
try:
diff --git a/pylint/lint/message_state_handler.py b/pylint/lint/message_state_handler.py
index ddeeaa7bc..26028f0fa 100644
--- a/pylint/lint/message_state_handler.py
+++ b/pylint/lint/message_state_handler.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-import sys
import tokenize
from collections import defaultdict
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Literal
from pylint import exceptions, interfaces
from pylint.constants import (
@@ -27,12 +26,6 @@ from pylint.utils.pragma_parser import (
parse_pragma,
)
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
-
if TYPE_CHECKING:
from pylint.lint.pylinter import PyLinter
@@ -55,9 +48,8 @@ class _MessageStateHandler:
"enable-msg": self._options_methods["enable"],
}
self._pragma_lineno: dict[str, int] = {}
- # TODO: 3.0: Update key type to str when current_name is always str
self._stashed_messages: defaultdict[
- tuple[str | None, str], list[tuple[str | None, str]]
+ tuple[str, str], list[tuple[str | None, str]]
] = defaultdict(list)
"""Some messages in the options (for --enable and --disable) are encountered
too early to warn about them.
diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py
index 544a256d3..e57c7e8ab 100644
--- a/pylint/lint/parallel.py
+++ b/pylint/lint/parallel.py
@@ -1,11 +1,10 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import functools
-import warnings
from collections import defaultdict
from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, Any
@@ -42,7 +41,7 @@ def _worker_initialize(
"""Function called to initialize a worker for a Process within a concurrent Pool.
:param linter: A linter-class (PyLinter) instance pickled with dill
- :param extra_packages_paths: Extra entries to be added to sys.path
+ :param extra_packages_paths: Extra entries to be added to `sys.path`
"""
global _worker_linter # pylint: disable=global-statement
_worker_linter = dill.loads(linter)
@@ -61,10 +60,9 @@ def _worker_check_single_file(
file_item: FileItem,
) -> tuple[
int,
- # TODO: 3.0: Make this only str after deprecation has been removed
- str | None,
str,
- str | None,
+ str,
+ str,
list[Message],
LinterStats,
int,
@@ -82,14 +80,6 @@ def _worker_check_single_file(
msgs = _worker_linter.reporter.messages
assert isinstance(_worker_linter.reporter, reporters.CollectingReporter)
_worker_linter.reporter.reset()
- if _worker_linter.current_name is None:
- warnings.warn(
- (
- "In pylint 3.0 the current_name attribute of the linter object should be a string. "
- "If unknown it should be initialized as an empty string."
- ),
- DeprecationWarning,
- )
return (
id(multiprocessing.current_process()),
_worker_linter.current_name,
@@ -175,4 +165,4 @@ def check_parallel(
linter.msg_status |= msg_status
_merge_mapreduce_data(linter, all_mapreduce_data)
- linter.stats = merge_stats([linter.stats] + all_stats)
+ linter.stats = merge_stats([linter.stats, *all_stats])
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py
index 863076f8f..ed607aca5 100644
--- a/pylint/lint/pylinter.py
+++ b/pylint/lint/pylinter.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -12,14 +12,13 @@ import os
import sys
import tokenize
import traceback
-import warnings
from collections import defaultdict
from collections.abc import Callable, Iterator, Sequence
from io import TextIOWrapper
from pathlib import Path
from re import Pattern
from types import ModuleType
-from typing import Any
+from typing import Any, Protocol
import astroid
from astroid import nodes
@@ -69,12 +68,6 @@ from pylint.typing import (
)
from pylint.utils import ASTWalker, FileState, LinterStats, utils
-if sys.version_info >= (3, 8):
- from typing import Protocol
-else:
- from typing_extensions import Protocol
-
-
MANAGER = astroid.MANAGER
@@ -139,26 +132,38 @@ MSGS: dict[str, MessageDefinitionTuple] = {
"raw-checker-failed",
"Used to inform that a built-in module has not been checked "
"using the raw checkers.",
- {"scope": WarningScope.LINE},
+ {
+ "scope": WarningScope.LINE,
+ "default_enabled": False,
+ },
),
"I0010": (
"Unable to consider inline option %r",
"bad-inline-option",
"Used when an inline option is either badly formatted or can't "
"be used inside modules.",
- {"scope": WarningScope.LINE},
+ {
+ "scope": WarningScope.LINE,
+ "default_enabled": False,
+ },
),
"I0011": (
"Locally disabling %s (%s)",
"locally-disabled",
"Used when an inline option disables a message or a messages category.",
- {"scope": WarningScope.LINE},
+ {
+ "scope": WarningScope.LINE,
+ "default_enabled": False,
+ },
),
"I0013": (
"Ignoring entire file",
"file-ignored",
"Used to inform that the file will not be checked",
- {"scope": WarningScope.LINE},
+ {
+ "scope": WarningScope.LINE,
+ "default_enabled": False,
+ },
),
"I0020": (
"Suppressed %s (from line %d)",
@@ -167,14 +172,20 @@ MSGS: dict[str, MessageDefinitionTuple] = {
"by a disable= comment in the file. This message is not "
"generated for messages that are ignored due to configuration "
"settings.",
- {"scope": WarningScope.LINE},
+ {
+ "scope": WarningScope.LINE,
+ "default_enabled": False,
+ },
),
"I0021": (
"Useless suppression of %s",
"useless-suppression",
"Reported when a message is explicitly disabled for a line or "
"a block of code, but never triggered.",
- {"scope": WarningScope.LINE},
+ {
+ "scope": WarningScope.LINE,
+ "default_enabled": False,
+ },
),
"I0022": (
'Pragma "%s" is deprecated, use "%s" instead',
@@ -185,6 +196,7 @@ MSGS: dict[str, MessageDefinitionTuple] = {
{
"old_names": [("I0014", "deprecated-disable-all")],
"scope": WarningScope.LINE,
+ "default_enabled": False,
},
),
"E0001": (
@@ -311,7 +323,8 @@ class PyLinter(
self.options: Options = options + _make_linter_options(self)
for opt_group in option_groups:
self.option_groups_descs[opt_group[0]] = opt_group[1]
- self._option_groups: tuple[tuple[str, str], ...] = option_groups + (
+ self._option_groups: tuple[tuple[str, str], ...] = (
+ *option_groups,
("Messages control", "Options controlling analysis messages"),
("Reports", "Options related to output formatting and reporting"),
)
@@ -339,32 +352,13 @@ class PyLinter(
# Attributes related to visiting files
self.file_state = FileState("", self.msgs_store, is_base_filestate=True)
- self.current_name: str | None = None
+ self.current_name: str = ""
self.current_file: str | None = None
self._ignore_file = False
self._ignore_paths: list[Pattern[str]] = []
self.register_checker(self)
- @property
- def option_groups(self) -> tuple[tuple[str, str], ...]:
- # TODO: 3.0: Remove deprecated attribute
- warnings.warn(
- "The option_groups attribute has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- return self._option_groups
-
- @option_groups.setter
- def option_groups(self, value: tuple[tuple[str, str], ...]) -> None:
- warnings.warn(
- "The option_groups attribute has been deprecated and will be removed in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- self._option_groups = value
-
def load_default_plugins(self) -> None:
checkers.initialize(self)
reporters.initialize(self)
@@ -655,23 +649,12 @@ class PyLinter(
else:
yield something
- def check(self, files_or_modules: Sequence[str] | str) -> None:
+ def check(self, files_or_modules: Sequence[str]) -> None:
"""Main checking entry: check a list of files or modules from their name.
files_or_modules is either a string or list of strings presenting modules to check.
"""
- # 1) Initialize
self.initialize()
-
- # 2) Gather all files
- if not isinstance(files_or_modules, (list, tuple)):
- # TODO: 3.0: Remove deprecated typing and update docstring
- warnings.warn(
- "In pylint 3.0, the checkers check function will only accept sequence of string",
- DeprecationWarning,
- stacklevel=2,
- )
- files_or_modules = (files_or_modules,) # type: ignore[assignment]
if self.config.recursive:
files_or_modules = tuple(self._discover_files(files_or_modules))
if self.config.from_stdin:
@@ -687,7 +670,7 @@ class PyLinter(
}
)
- # TODO: Move the parallel invocation into step 5 of the checking process
+ # TODO: Move the parallel invocation into step 3 of the checking process
if not self.config.from_stdin and self.config.jobs > 1:
original_sys_path = sys.path[:]
check_parallel(
@@ -699,7 +682,7 @@ class PyLinter(
sys.path = original_sys_path
return
- # 3) Get all FileItems
+ # 1) Get all FileItems
with augmented_sys_path(extra_packages_paths):
if self.config.from_stdin:
fileitems = self._get_file_descr_from_stdin(files_or_modules[0])
@@ -711,10 +694,10 @@ class PyLinter(
# The contextmanager also opens all checkers and sets up the PyLinter class
with augmented_sys_path(extra_packages_paths):
with self._astroid_module_checker() as check_astroid_module:
- # 4) Get the AST for each FileItem
+ # 2) Get the AST for each FileItem
ast_per_fileitem = self._get_asts(fileitems, data)
- # 5) Lint each ast
+ # 3) Lint each ast
self._lint_files(ast_per_fileitem, check_astroid_module)
def _get_asts(
@@ -743,15 +726,6 @@ class PyLinter(
return ast_per_fileitem
- def check_single_file(self, name: str, filepath: str, modname: str) -> None:
- warnings.warn(
- "In pylint 3.0, the checkers check_single_file function will be removed. "
- "Use check_single_file_item instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- self.check_single_file_item(FileItem(name, filepath, modname))
-
def check_single_file_item(self, file: FileItem) -> None:
"""Check single file item.
@@ -919,26 +893,13 @@ class PyLinter(
self.add_message(key, args=message)
return result
- def set_current_module(
- self, modname: str | None, filepath: str | None = None
- ) -> None:
+ def set_current_module(self, modname: str, filepath: str | None = None) -> None:
"""Set the name of the currently analyzed module and
init statistics for it.
"""
if not modname and filepath is None:
return
self.reporter.on_set_current_module(modname or "", filepath)
- if modname is None:
- # TODO: 3.0: Remove all modname or ""'s in this method
- warnings.warn(
- (
- "In pylint 3.0 modname should be a string so that it can be used to "
- "correctly set the current_name attribute of the linter instance. "
- "If unknown it should be initialized as an empty string."
- ),
- DeprecationWarning,
- stacklevel=2,
- )
self.current_name = modname
self.current_file = filepath or modname
self.stats.init_single_module(modname or "")
@@ -976,41 +937,9 @@ class PyLinter(
tokencheckers = [
c for c in _checkers if isinstance(c, checkers.BaseTokenChecker)
]
- # TODO: 3.0: Remove deprecated for-loop
- for c in _checkers:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- if (
- interfaces.implements(c, interfaces.ITokenChecker)
- and c not in tokencheckers
- and c is not self
- ):
- tokencheckers.append(c) # type: ignore[arg-type] # pragma: no cover
- warnings.warn( # pragma: no cover
- "Checkers should subclass BaseTokenChecker "
- "instead of using the __implements__ mechanism. Use of __implements__ "
- "will no longer be supported in pylint 3.0",
- DeprecationWarning,
- )
rawcheckers = [
c for c in _checkers if isinstance(c, checkers.BaseRawFileChecker)
]
- # TODO: 3.0: Remove deprecated if-statement
- for c in _checkers:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- if (
- interfaces.implements(c, interfaces.IRawChecker)
- and c not in rawcheckers
- ):
- rawcheckers.append(c) # type: ignore[arg-type] # pragma: no cover
- warnings.warn( # pragma: no cover
- "Checkers should subclass BaseRawFileChecker "
- "instead of using the __implements__ mechanism. Use of __implements__ "
- "will no longer be supported in pylint 3.0",
- DeprecationWarning,
- )
- # notify global begin
for checker in _checkers:
checker.open()
walker.add_checker(checker)
@@ -1085,10 +1014,6 @@ class PyLinter(
retval = self._check_astroid_module(
ast_node, walker, rawcheckers, tokencheckers
)
-
- # TODO: 3.0: Remove unnecessary assertion
- assert self.current_name
-
self.stats.by_module[self.current_name]["statement"] = (
walker.nbstatements - before_check_statements
)
@@ -1154,12 +1079,7 @@ class PyLinter(
"""
# Display whatever messages are left on the reporter.
self.reporter.display_messages(report_nodes.Section())
-
- # TODO: 3.0: Remove second half of if-statement
- if (
- not self.file_state._is_base_filestate
- and self.file_state.base_name is not None
- ):
+ if not self.file_state._is_base_filestate:
# load previous results if any
previous_stats = load_results(self.file_state.base_name)
self.reporter.on_close(self.stats, previous_stats)
@@ -1181,11 +1101,9 @@ class PyLinter(
def _report_evaluation(self) -> int | None:
"""Make the global evaluation report."""
- # check with at least check 1 statements (usually 0 when there is a
+ # check with at least a statement (usually 0 when there is a
# syntax error preventing pylint from further processing)
note = None
- # TODO: 3.0: Remove assertion
- assert self.file_state.base_name is not None
previous_stats = load_results(self.file_state.base_name)
if self.stats.statement == 0:
return note
@@ -1270,12 +1188,7 @@ class PyLinter(
msg_cat = MSG_TYPES[message_definition.msgid[0]]
self.msg_status |= MSG_TYPES_STATUS[message_definition.msgid[0]]
self.stats.increase_single_message_count(msg_cat, 1)
- # TODO: 3.0 Should be removable after https://github.com/PyCQA/pylint/pull/5580
- self.stats.increase_single_module_message_count(
- self.current_name, # type: ignore[arg-type]
- msg_cat,
- 1,
- )
+ self.stats.increase_single_module_message_count(self.current_name, msg_cat, 1)
try:
self.stats.by_msg[message_definition.symbol] += 1
except KeyError:
diff --git a/pylint/lint/report_functions.py b/pylint/lint/report_functions.py
index 7d1674977..da7ab5fbc 100644
--- a/pylint/lint/report_functions.py
+++ b/pylint/lint/report_functions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/lint/run.py b/pylint/lint/run.py
index 49b807f87..776803f2e 100644
--- a/pylint/lint/run.py
+++ b/pylint/lint/run.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -9,7 +9,7 @@ import sys
import warnings
from collections.abc import Sequence
from pathlib import Path
-from typing import Any, ClassVar
+from typing import ClassVar
from pylint import config
from pylint.checkers.utils import clear_lru_caches
@@ -97,9 +97,6 @@ def _cpu_count() -> int:
return cpu_count
-UNUSED_PARAM_SENTINEL = object()
-
-
class Run:
"""Helper class to use as main for pylint with 'run(*sys.argv[1:])'."""
@@ -123,7 +120,6 @@ group are mutually exclusive.",
args: Sequence[str],
reporter: BaseReporter | None = None,
exit: bool = True, # pylint: disable=redefined-builtin
- do_exit: Any = UNUSED_PARAM_SENTINEL,
) -> None:
# Immediately exit if user asks for version
if "--version" in args:
@@ -158,9 +154,6 @@ group are mutually exclusive.",
# load command line plugins
linter.load_plugin_modules(self._plugins)
- linter.disable("I")
- linter.enable("c-extension-no-member")
-
# Register the options needed for 'pylint-config'
# By not registering them by default they don't show up in the normal usage message
if self._is_pylint_config:
@@ -175,6 +168,7 @@ group are mutually exclusive.",
warnings.warn(
"NOTE: The 'pylint-config' command is experimental and usage can change",
UserWarning,
+ stacklevel=2,
)
code = _handle_pylint_config_commands(linter)
if exit:
@@ -214,14 +208,6 @@ group are mutually exclusive.",
else:
linter.check(args)
score_value = linter.generate_reports()
-
- if do_exit is not UNUSED_PARAM_SENTINEL:
- warnings.warn(
- "do_exit is deprecated and it is going to be removed in a future version.",
- DeprecationWarning,
- )
- exit = do_exit
-
if linter.config.clear_cache_post_run:
clear_lru_caches()
MANAGER.clear_cache()
diff --git a/pylint/lint/utils.py b/pylint/lint/utils.py
index 98fb8087a..a7fbfd0bc 100644
--- a/pylint/lint/utils.py
+++ b/pylint/lint/utils.py
@@ -1,19 +1,18 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import contextlib
+import platform
import sys
import traceback
-import warnings
from collections.abc import Iterator, Sequence
from datetime import datetime
from pathlib import Path
-from pylint.config import PYLINT_HOME
-from pylint.lint.expand_modules import discover_package_path
+from pylint.constants import PYLINT_HOME, full_version
def prepare_crash_report(ex: Exception, filepath: str, crash_file_path: str) -> Path:
@@ -26,18 +25,20 @@ def prepare_crash_report(ex: Exception, filepath: str, crash_file_path: str) ->
if not issue_template_path.exists():
template = """\
First, please verify that the bug is not already filled:
-https://github.com/PyCQA/pylint/issues/
+https://github.com/pylint-dev/pylint/issues/
-Then create a new crash issue:
-https://github.com/PyCQA/pylint/issues/new?assignees=&labels=crash%2Cneeds+triage&template=BUG-REPORT.yml
+Then create a new issue:
+https://github.com/pylint-dev/pylint/issues/new?labels=Crash 💥%2CNeeds triage 📥
-"""
- template += f"""\
+"""
+ template += f"""
Issue title:
Crash ``{ex}`` (if possible, be more specific about what made pylint crash)
-Content:
-When parsing the following file:
+
+### Bug description
+
+When parsing the following ``a.py``:
<!--
If sharing the code is not an option, please state so,
@@ -48,11 +49,49 @@ When parsing the following file:
{file_content}
```
-pylint crashed with a ``{ex.__class__.__name__}`` and with the following stacktrace:
+### Command used
+
+```shell
+pylint a.py
```
+
+### Pylint output
+
+<details open>
+ <summary>
+ pylint crashed with a ``{ex.__class__.__name__}`` and with the following stacktrace:
+ </summary>
+
+```python
"""
template += traceback.format_exc()
- template += "```\n"
+ template += f"""
+```
+
+
+</details>
+
+### Expected behavior
+
+No crash.
+
+### Pylint version
+
+```shell
+{full_version}
+```
+
+### OS / Environment
+
+{sys.platform} ({platform.system()})
+
+### Additional dependencies
+
+<!--
+Please remove this part if you're not using any of
+your dependencies in the example.
+ -->
+"""
try:
with open(issue_template_path, "a", encoding="utf8") as f:
f.write(template)
@@ -73,19 +112,6 @@ def get_fatal_error_message(filepath: str, issue_template_path: Path) -> str:
)
-def _patch_sys_path(args: Sequence[str]) -> list[str]:
- # TODO: Remove deprecated function
- warnings.warn(
- "_patch_sys_path has been deprecated because it relies on auto-magic package path "
- "discovery which is implemented by get_python_path that is deprecated. "
- "Use _augment_sys_path and pass additional sys.path entries as an argument obtained from "
- "discover_package_path.",
- DeprecationWarning,
- stacklevel=2,
- )
- return _augment_sys_path([discover_package_path(arg, []) for arg in args])
-
-
def _augment_sys_path(additional_paths: Sequence[str]) -> list[str]:
original = list(sys.path)
changes = []
@@ -100,28 +126,6 @@ def _augment_sys_path(additional_paths: Sequence[str]) -> list[str]:
@contextlib.contextmanager
-def fix_import_path(args: Sequence[str]) -> Iterator[None]:
- """Prepare 'sys.path' for running the linter checks.
-
- Within this context, each of the given arguments is importable.
- Paths are added to 'sys.path' in corresponding order to the arguments.
- We avoid adding duplicate directories to sys.path.
- `sys.path` is reset to its original value upon exiting this context.
- """
- # TODO: Remove deprecated function
- warnings.warn(
- "fix_import_path has been deprecated because it relies on auto-magic package path "
- "discovery which is implemented by get_python_path that is deprecated. "
- "Use augmented_sys_path and pass additional sys.path entries as an argument obtained from "
- "discover_package_path.",
- DeprecationWarning,
- stacklevel=2,
- )
- with augmented_sys_path([discover_package_path(arg, []) for arg in args]):
- yield
-
-
-@contextlib.contextmanager
def augmented_sys_path(additional_paths: Sequence[str]) -> Iterator[None]:
"""Augment 'sys.path' by adding non-existent entries from additional_paths."""
original = _augment_sys_path(additional_paths)
diff --git a/pylint/message/__init__.py b/pylint/message/__init__.py
index 11d2b17dc..6fa8e44b7 100644
--- a/pylint/message/__init__.py
+++ b/pylint/message/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""All the classes related to Message handling."""
diff --git a/pylint/message/_deleted_message_ids.py b/pylint/message/_deleted_message_ids.py
index 4f361c96a..60289e805 100644
--- a/pylint/message/_deleted_message_ids.py
+++ b/pylint/message/_deleted_message_ids.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -18,7 +18,7 @@ DELETED_MSGID_PREFIXES: list[int] = []
DELETED_MESSAGES_IDS = {
# Everything until the next comment is from the PY3K+ checker
- "https://github.com/PyCQA/pylint/pull/4942": [
+ "https://github.com/pylint-dev/pylint/pull/4942": [
DeletedMessage("W1601", "apply-builtin"),
DeletedMessage("E1601", "print-statement"),
DeletedMessage("E1602", "parameter-unpacking"),
@@ -95,10 +95,10 @@ DELETED_MESSAGES_IDS = {
DeletedMessage("W1661", "exception-escape"),
DeletedMessage("W1662", "comprehension-escape"),
],
- "https://github.com/PyCQA/pylint/pull/3578": [
+ "https://github.com/pylint-dev/pylint/pull/3578": [
DeletedMessage("W0312", "mixed-indentation"),
],
- "https://github.com/PyCQA/pylint/pull/3577": [
+ "https://github.com/pylint-dev/pylint/pull/3577": [
DeletedMessage(
"C0326",
"bad-whitespace",
@@ -109,7 +109,7 @@ DELETED_MESSAGES_IDS = {
],
),
],
- "https://github.com/PyCQA/pylint/pull/3571": [
+ "https://github.com/pylint-dev/pylint/pull/3571": [
DeletedMessage("C0330", "bad-continuation")
],
"https://pylint.readthedocs.io/en/latest/whatsnew/1/1.4.html#what-s-new-in-pylint-1-4-3": [
@@ -117,10 +117,10 @@ DELETED_MESSAGES_IDS = {
DeletedMessage("R0922", "abstract-class-little-used"),
DeletedMessage("W0142", "star-args"),
],
- "https://github.com/PyCQA/pylint/issues/2409": [
+ "https://github.com/pylint-dev/pylint/issues/2409": [
DeletedMessage("W0232", "no-init"),
],
- "https://github.com/PyCQA/pylint/pull/6421": [
+ "https://github.com/pylint-dev/pylint/pull/6421": [
DeletedMessage("W0111", "assign-to-new-keyword"),
],
}
diff --git a/pylint/message/message.py b/pylint/message/message.py
index 23dd6c082..6ee8c5f78 100644
--- a/pylint/message/message.py
+++ b/pylint/message/message.py
@@ -1,11 +1,10 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
from dataclasses import asdict, dataclass
-from warnings import warn
from pylint.constants import MSG_TYPES
from pylint.interfaces import UNDEFINED, Confidence
@@ -35,27 +34,10 @@ class Message: # pylint: disable=too-many-instance-attributes
self,
msg_id: str,
symbol: str,
- location: tuple[str, str, str, str, int, int] | MessageLocationTuple,
+ location: MessageLocationTuple,
msg: str,
confidence: Confidence | None,
) -> None:
- if not isinstance(location, MessageLocationTuple):
- warn(
- "In pylint 3.0, Messages will only accept a MessageLocationTuple as location parameter",
- DeprecationWarning,
- stacklevel=2,
- )
- location = MessageLocationTuple(
- location[0],
- location[1],
- location[2],
- location[3],
- location[4],
- location[5],
- None,
- None,
- )
-
self.msg_id = msg_id
self.symbol = symbol
self.msg = msg
diff --git a/pylint/message/message_definition.py b/pylint/message/message_definition.py
index 25aa87d92..29a8780cb 100644
--- a/pylint/message/message_definition.py
+++ b/pylint/message/message_definition.py
@@ -1,11 +1,10 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import sys
-import warnings
from typing import TYPE_CHECKING, Any
from astroid import nodes
@@ -73,21 +72,8 @@ class MessageDefinition:
def __str__(self) -> str:
return f"{repr(self)}:\n{self.msg} {self.description}"
- def may_be_emitted(
- self,
- py_version: tuple[int, ...] | sys._version_info | None = None,
- ) -> bool:
- """Return True if message may be emitted using the configured py_version."""
- if py_version is None:
- py_version = sys.version_info
- warnings.warn(
- "'py_version' will be a required parameter of "
- "'MessageDefinition.may_be_emitted' in pylint 3.0. The most likely "
- "solution is to use 'linter.config.py_version' if you need to keep "
- "using this function, or to use 'MessageDefinition.is_message_enabled'"
- " instead.",
- DeprecationWarning,
- )
+ def may_be_emitted(self, py_version: tuple[int, ...] | sys._version_info) -> bool:
+ """May the message be emitted using the configured py_version?"""
if self.minversion is not None and self.minversion > py_version:
return False
if self.maxversion is not None and self.maxversion <= py_version:
diff --git a/pylint/message/message_definition_store.py b/pylint/message/message_definition_store.py
index 7bbc70a51..4921be212 100644
--- a/pylint/message/message_definition_store.py
+++ b/pylint/message/message_definition_store.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -58,7 +58,7 @@ class MessageDefinitionStore:
# Since MessageDefinitionStore is only initialized once
# and the arguments are relatively small we do not run the
# risk of creating a large memory leak.
- # See discussion in: https://github.com/PyCQA/pylint/pull/5673
+ # See discussion in: https://github.com/pylint-dev/pylint/pull/5673
@functools.lru_cache( # pylint: disable=method-cache-max-size-none # noqa: B019
maxsize=None
)
diff --git a/pylint/message/message_id_store.py b/pylint/message/message_id_store.py
index d1810bd2b..273522d3d 100644
--- a/pylint/message/message_id_store.py
+++ b/pylint/message/message_id_store.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/py.typed b/pylint/py.typed
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pylint/py.typed
diff --git a/pylint/pyreverse/__init__.py b/pylint/pyreverse/__init__.py
index 458c0f35d..175e9cb67 100644
--- a/pylint/pyreverse/__init__.py
+++ b/pylint/pyreverse/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Pyreverse.extensions."""
diff --git a/pylint/pyreverse/diadefslib.py b/pylint/pyreverse/diadefslib.py
index 85b23052e..3b7694823 100644
--- a/pylint/pyreverse/diadefslib.py
+++ b/pylint/pyreverse/diadefslib.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Handle diagram generation options for class diagram or default diagrams."""
@@ -12,6 +12,7 @@ from typing import Any
import astroid
from astroid import nodes
+from astroid.modutils import is_stdlib_module
from pylint.pyreverse.diagrams import ClassDiagram, PackageDiagram
from pylint.pyreverse.inspector import Linker, Project
@@ -67,10 +68,14 @@ class DiaDefGenerator:
return self.anc_level, self.association_level
def show_node(self, node: nodes.ClassDef) -> bool:
- """True if builtins and not show_builtins."""
- if self.config.show_builtin:
- return True
- return node.root().name != "builtins" # type: ignore[no-any-return]
+ """Determine if node should be shown based on config."""
+ if node.root().name == "builtins":
+ return self.config.show_builtin # type: ignore[no-any-return]
+
+ if is_stdlib_module(node.root().name):
+ return self.config.show_stdlib # type: ignore[no-any-return]
+
+ return True
def add_class(self, node: nodes.ClassDef) -> None:
"""Visit one class and add it to diagram."""
diff --git a/pylint/pyreverse/diagrams.py b/pylint/pyreverse/diagrams.py
index 4437d3c4e..01bce7dc3 100644
--- a/pylint/pyreverse/diagrams.py
+++ b/pylint/pyreverse/diagrams.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Diagram objects."""
@@ -13,7 +13,7 @@ import astroid
from astroid import nodes, util
from pylint.checkers.utils import decorated_with_property
-from pylint.pyreverse.utils import FilterMixIn, is_interface
+from pylint.pyreverse.utils import FilterMixIn
class Figure:
@@ -50,7 +50,13 @@ class DiagramEntity(Figure):
) -> None:
super().__init__()
self.title = title
- self.node: nodes.NodeNG = node if node else nodes.NodeNG()
+ self.node: nodes.NodeNG = node or nodes.NodeNG(
+ lineno=None,
+ col_offset=None,
+ end_lineno=None,
+ end_col_offset=None,
+ parent=None,
+ )
self.shape = self.default_shape
@@ -195,11 +201,7 @@ class ClassDiagram(Figure, FilterMixIn):
node = obj.node
obj.attrs = self.get_attrs(node)
obj.methods = self.get_methods(node)
- # shape
- if is_interface(node):
- obj.shape = "interface"
- else:
- obj.shape = "class"
+ obj.shape = "class"
# inheritance link
for par_node in node.ancestors(recurs=False):
try:
@@ -207,13 +209,6 @@ class ClassDiagram(Figure, FilterMixIn):
self.add_relationship(obj, par_obj, "specialization")
except KeyError:
continue
- # implements link
- for impl_node in node.implements:
- try:
- impl_obj = self.object_from_node(impl_node)
- self.add_relationship(obj, impl_obj, "implements")
- except KeyError:
- continue
# associations & aggregations links
for name, values in list(node.aggregations_type.items()):
diff --git a/pylint/pyreverse/dot_printer.py b/pylint/pyreverse/dot_printer.py
index 99cb17e97..edaea2384 100644
--- a/pylint/pyreverse/dot_printer.py
+++ b/pylint/pyreverse/dot_printer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Class to generate files in dot format and image formats supported by Graphviz."""
@@ -25,13 +25,11 @@ class HTMLLabels(Enum):
ALLOWED_CHARSETS: frozenset[str] = frozenset(("utf-8", "iso-8859-1", "latin1"))
SHAPES: dict[NodeType, str] = {
NodeType.PACKAGE: "box",
- NodeType.INTERFACE: "record",
NodeType.CLASS: "record",
}
# pylint: disable-next=consider-using-namedtuple-or-dataclass
ARROWS: dict[EdgeType, dict[str, str]] = {
EdgeType.INHERITS: {"arrowtail": "none", "arrowhead": "empty"},
- EdgeType.IMPLEMENTS: {"arrowtail": "node", "arrowhead": "empty", "style": "dashed"},
EdgeType.ASSOCIATION: {
"fontcolor": "green",
"arrowtail": "none",
diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py
index 523ff8171..0cabe9473 100644
--- a/pylint/pyreverse/inspector.py
+++ b/pylint/pyreverse/inspector.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Visitor doing some post-processing on the astroid tree.
@@ -12,13 +12,11 @@ from __future__ import annotations
import collections
import os
import traceback
-import warnings
from abc import ABC, abstractmethod
-from collections.abc import Generator
-from typing import Any, Callable, Optional
+from typing import Callable, Optional
import astroid
-from astroid import nodes, util
+from astroid import nodes
from pylint import constants
from pylint.pyreverse import utils
@@ -39,27 +37,6 @@ def _astroid_wrapper(
return None
-def interfaces(node: nodes.ClassDef) -> Generator[Any, None, None]:
- """Return an iterator on interfaces implemented by the given class node."""
- try:
- implements = astroid.bases.Instance(node).getattr("__implements__")[0]
- except astroid.exceptions.NotFoundError:
- return
- if implements.frame(future=True) is not node:
- return
- found = set()
- missing = False
- for iface in nodes.unpack_infer(implements):
- if isinstance(iface, util.UninferableBase):
- missing = True
- continue
- if iface not in found:
- found.add(iface)
- yield iface
- if missing:
- raise astroid.exceptions.InferenceError()
-
-
class IdGeneratorMixIn:
"""Mixin adding the ability to generate integer uid."""
@@ -129,9 +106,6 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor):
* aggregations_type
as instance_attrs_type but for aggregations relationships
-
- * implements,
- list of implemented interface _objects_ (only on astroid.Class nodes)
"""
def __init__(self, project: Project, tag: bool = False) -> None:
@@ -172,7 +146,6 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor):
"""Visit an astroid.Class node.
* set the locals_type and instance_attrs_type mappings
- * set the implements list and build it
* optionally tag the node with a unique id
"""
if hasattr(node, "locals_type"):
@@ -194,24 +167,6 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor):
if not isinstance(assignattr, nodes.Unknown):
self.associations_handler.handle(assignattr, node)
self.handle_assignattr_type(assignattr, node)
- # resolve implemented interface
- try:
- ifaces = interfaces(node)
- if ifaces is not None:
- node.implements = list(ifaces)
- if node.implements:
- # TODO: 3.0: Remove support for __implements__
- warnings.warn(
- "pyreverse will drop support for resolving and displaying "
- "implemented interfaces in pylint 3.0. The implementation "
- "relies on the '__implements__' attribute proposed in PEP 245"
- ", which was rejected in 2006.",
- DeprecationWarning,
- )
- else:
- node.implements = []
- except astroid.InferenceError:
- node.implements = []
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
"""Visit an astroid.Function node.
diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py
index a2dc94734..58128bb57 100644
--- a/pylint/pyreverse/main.py
+++ b/pylint/pyreverse/main.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Create UML diagrams for classes and modules in <packages>."""
@@ -27,7 +27,6 @@ from pylint.typing import Options
DIRECTLY_SUPPORTED_FORMATS = (
"dot",
- "vcg",
"puml",
"plantuml",
"mmd",
@@ -35,23 +34,16 @@ DIRECTLY_SUPPORTED_FORMATS = (
)
DEFAULT_COLOR_PALETTE = (
- "aliceblue",
- "antiquewhite",
- "aquamarine",
- "burlywood",
- "cadetblue",
- "chartreuse",
- "chocolate",
- "coral",
- "cornflowerblue",
- "cyan",
- "darkgoldenrod",
- "darkseagreen",
- "dodgerblue",
- "forestgreen",
- "gold",
- "hotpink",
- "mediumspringgreen",
+ # colorblind scheme taken from https://personal.sron.nl/~pault/
+ "#77AADD", # light blue
+ "#99DDFF", # light cyan
+ "#44BB99", # mint
+ "#BBCC33", # pear
+ "#AAAA00", # olive
+ "#EEDD88", # light yellow
+ "#EE8866", # orange
+ "#FFAABB", # pink
+ "#DDDDDD", # pale grey
)
OPTIONS: Options = (
@@ -138,6 +130,15 @@ OPTIONS: Options = (
},
),
(
+ "show-stdlib",
+ {
+ "short": "L",
+ "action": "store_true",
+ "default": False,
+ "help": "include standard library objects in representation of classes",
+ },
+ ),
+ (
"module-names",
{
"short": "m",
@@ -157,6 +158,14 @@ OPTIONS: Options = (
},
),
(
+ "no-standalone",
+ {
+ "action": "store_true",
+ "default": False,
+ "help": "only show nodes with connections",
+ },
+ ),
+ (
"output",
{
"short": "o",
diff --git a/pylint/pyreverse/mermaidjs_printer.py b/pylint/pyreverse/mermaidjs_printer.py
index a8f3c576b..61d0d7948 100644
--- a/pylint/pyreverse/mermaidjs_printer.py
+++ b/pylint/pyreverse/mermaidjs_printer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Class to generate files in mermaidjs format."""
@@ -17,12 +17,10 @@ class MermaidJSPrinter(Printer):
NODES: dict[NodeType, str] = {
NodeType.CLASS: "class",
- NodeType.INTERFACE: "class",
NodeType.PACKAGE: "class",
}
ARROWS: dict[EdgeType, str] = {
EdgeType.INHERITS: "--|>",
- EdgeType.IMPLEMENTS: "..|>",
EdgeType.ASSOCIATION: "--*",
EdgeType.AGGREGATION: "--o",
EdgeType.USES: "-->",
@@ -46,7 +44,6 @@ class MermaidJSPrinter(Printer):
# pylint: disable=duplicate-code
if properties is None:
properties = NodeProperties(label=name)
- stereotype = "~~Interface~~" if type_ is NodeType.INTERFACE else ""
nodetype = self.NODES[type_]
body = []
if properties.attrs:
@@ -60,7 +57,7 @@ class MermaidJSPrinter(Printer):
line += f" {get_annotation_label(func.returns)}"
body.append(line)
name = name.split(".")[-1]
- self.emit(f"{nodetype} {name}{stereotype} {{")
+ self.emit(f"{nodetype} {name} {{")
self._inc_indent()
for line in body:
self.emit(line)
diff --git a/pylint/pyreverse/plantuml_printer.py b/pylint/pyreverse/plantuml_printer.py
index de3f983b7..5f703b62e 100644
--- a/pylint/pyreverse/plantuml_printer.py
+++ b/pylint/pyreverse/plantuml_printer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Class to generate files in dot format and image formats supported by Graphviz."""
@@ -17,12 +17,10 @@ class PlantUmlPrinter(Printer):
NODES: dict[NodeType, str] = {
NodeType.CLASS: "class",
- NodeType.INTERFACE: "class",
NodeType.PACKAGE: "package",
}
ARROWS: dict[EdgeType, str] = {
EdgeType.INHERITS: "--|>",
- EdgeType.IMPLEMENTS: "..|>",
EdgeType.ASSOCIATION: "--*",
EdgeType.AGGREGATION: "--o",
EdgeType.USES: "-->",
@@ -56,10 +54,9 @@ class PlantUmlPrinter(Printer):
"""
if properties is None:
properties = NodeProperties(label=name)
- stereotype = " << interface >>" if type_ is NodeType.INTERFACE else ""
nodetype = self.NODES[type_]
if properties.color and properties.color != self.DEFAULT_COLOR:
- color = f" #{properties.color}"
+ color = f" #{properties.color.lstrip('#')}"
else:
color = ""
body = []
@@ -76,7 +73,7 @@ class PlantUmlPrinter(Printer):
label = properties.label if properties.label is not None else name
if properties.fontcolor and properties.fontcolor != self.DEFAULT_COLOR:
label = f"<color:{properties.fontcolor}>{label}</color>"
- self.emit(f'{nodetype} "{label}" as {name}{stereotype}{color} {{')
+ self.emit(f'{nodetype} "{label}" as {name}{color} {{')
self._inc_indent()
for line in body:
self.emit(line)
diff --git a/pylint/pyreverse/printer.py b/pylint/pyreverse/printer.py
index cdbf7e3c8..f08c74602 100644
--- a/pylint/pyreverse/printer.py
+++ b/pylint/pyreverse/printer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Base class defining the interface for a printer."""
@@ -17,13 +17,11 @@ from pylint.pyreverse.utils import get_annotation_label
class NodeType(Enum):
CLASS = "class"
- INTERFACE = "interface"
PACKAGE = "package"
class EdgeType(Enum):
INHERITS = "inherits"
- IMPLEMENTS = "implements"
ASSOCIATION = "association"
AGGREGATION = "aggregation"
USES = "uses"
diff --git a/pylint/pyreverse/printer_factory.py b/pylint/pyreverse/printer_factory.py
index 41e8b46c8..fdbe480ed 100644
--- a/pylint/pyreverse/printer_factory.py
+++ b/pylint/pyreverse/printer_factory.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -8,10 +8,8 @@ from pylint.pyreverse.dot_printer import DotPrinter
from pylint.pyreverse.mermaidjs_printer import HTMLMermaidJSPrinter, MermaidJSPrinter
from pylint.pyreverse.plantuml_printer import PlantUmlPrinter
from pylint.pyreverse.printer import Printer
-from pylint.pyreverse.vcg_printer import VCGPrinter
filetype_to_printer: dict[str, type[Printer]] = {
- "vcg": VCGPrinter,
"plantuml": PlantUmlPrinter,
"puml": PlantUmlPrinter,
"mmd": MermaidJSPrinter,
diff --git a/pylint/pyreverse/utils.py b/pylint/pyreverse/utils.py
index 078bc1b7e..6294773b2 100644
--- a/pylint/pyreverse/utils.py
+++ b/pylint/pyreverse/utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Generic classes/functions for pyreverse core/extensions."""
@@ -72,11 +72,6 @@ def get_visibility(name: str) -> str:
return visibility
-def is_interface(node: nodes.ClassDef) -> bool:
- # bw compatibility
- return node.type == "interface" # type: ignore[no-any-return]
-
-
def is_exception(node: nodes.ClassDef) -> bool:
# bw compatibility
return node.type == "exception" # type: ignore[no-any-return]
diff --git a/pylint/pyreverse/vcg_printer.py b/pylint/pyreverse/vcg_printer.py
deleted file mode 100644
index b9e2e94f3..000000000
--- a/pylint/pyreverse/vcg_printer.py
+++ /dev/null
@@ -1,303 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Functions to generate files readable with George Sander's vcg
-(Visualization of Compiler Graphs).
-
-You can download vcg at https://rw4.cs.uni-sb.de/~sander/html/gshome.html
-Note that vcg exists as a debian package.
-See vcg's documentation for explanation about the different values that
-maybe used for the functions parameters.
-"""
-
-from __future__ import annotations
-
-from collections.abc import Mapping
-from typing import Any
-
-from pylint.pyreverse.printer import EdgeType, Layout, NodeProperties, NodeType, Printer
-
-ATTRS_VAL = {
- "algos": (
- "dfs",
- "tree",
- "minbackward",
- "left_to_right",
- "right_to_left",
- "top_to_bottom",
- "bottom_to_top",
- "maxdepth",
- "maxdepthslow",
- "mindepth",
- "mindepthslow",
- "mindegree",
- "minindegree",
- "minoutdegree",
- "maxdegree",
- "maxindegree",
- "maxoutdegree",
- ),
- "booleans": ("yes", "no"),
- "colors": (
- "black",
- "white",
- "blue",
- "red",
- "green",
- "yellow",
- "magenta",
- "lightgrey",
- "cyan",
- "darkgrey",
- "darkblue",
- "darkred",
- "darkgreen",
- "darkyellow",
- "darkmagenta",
- "darkcyan",
- "gold",
- "lightblue",
- "lightred",
- "lightgreen",
- "lightyellow",
- "lightmagenta",
- "lightcyan",
- "lilac",
- "turquoise",
- "aquamarine",
- "khaki",
- "purple",
- "yellowgreen",
- "pink",
- "orange",
- "orchid",
- ),
- "shapes": ("box", "ellipse", "rhomb", "triangle"),
- "textmodes": ("center", "left_justify", "right_justify"),
- "arrowstyles": ("solid", "line", "none"),
- "linestyles": ("continuous", "dashed", "dotted", "invisible"),
-}
-
-# meaning of possible values:
-# O -> string
-# 1 -> int
-# list -> value in list
-GRAPH_ATTRS = {
- "title": 0,
- "label": 0,
- "color": ATTRS_VAL["colors"],
- "textcolor": ATTRS_VAL["colors"],
- "bordercolor": ATTRS_VAL["colors"],
- "width": 1,
- "height": 1,
- "borderwidth": 1,
- "textmode": ATTRS_VAL["textmodes"],
- "shape": ATTRS_VAL["shapes"],
- "shrink": 1,
- "stretch": 1,
- "orientation": ATTRS_VAL["algos"],
- "vertical_order": 1,
- "horizontal_order": 1,
- "xspace": 1,
- "yspace": 1,
- "layoutalgorithm": ATTRS_VAL["algos"],
- "late_edge_labels": ATTRS_VAL["booleans"],
- "display_edge_labels": ATTRS_VAL["booleans"],
- "dirty_edge_labels": ATTRS_VAL["booleans"],
- "finetuning": ATTRS_VAL["booleans"],
- "manhattan_edges": ATTRS_VAL["booleans"],
- "smanhattan_edges": ATTRS_VAL["booleans"],
- "port_sharing": ATTRS_VAL["booleans"],
- "edges": ATTRS_VAL["booleans"],
- "nodes": ATTRS_VAL["booleans"],
- "splines": ATTRS_VAL["booleans"],
-}
-NODE_ATTRS = {
- "title": 0,
- "label": 0,
- "color": ATTRS_VAL["colors"],
- "textcolor": ATTRS_VAL["colors"],
- "bordercolor": ATTRS_VAL["colors"],
- "width": 1,
- "height": 1,
- "borderwidth": 1,
- "textmode": ATTRS_VAL["textmodes"],
- "shape": ATTRS_VAL["shapes"],
- "shrink": 1,
- "stretch": 1,
- "vertical_order": 1,
- "horizontal_order": 1,
-}
-EDGE_ATTRS = {
- "sourcename": 0,
- "targetname": 0,
- "label": 0,
- "linestyle": ATTRS_VAL["linestyles"],
- "class": 1,
- "thickness": 0,
- "color": ATTRS_VAL["colors"],
- "textcolor": ATTRS_VAL["colors"],
- "arrowcolor": ATTRS_VAL["colors"],
- "backarrowcolor": ATTRS_VAL["colors"],
- "arrowsize": 1,
- "backarrowsize": 1,
- "arrowstyle": ATTRS_VAL["arrowstyles"],
- "backarrowstyle": ATTRS_VAL["arrowstyles"],
- "textmode": ATTRS_VAL["textmodes"],
- "priority": 1,
- "anchor": 1,
- "horizontal_order": 1,
-}
-SHAPES: dict[NodeType, str] = {
- NodeType.PACKAGE: "box",
- NodeType.CLASS: "box",
- NodeType.INTERFACE: "ellipse",
-}
-# pylint: disable-next=consider-using-namedtuple-or-dataclass
-ARROWS: dict[EdgeType, dict[str, str | int]] = {
- EdgeType.USES: {
- "arrowstyle": "solid",
- "backarrowstyle": "none",
- "backarrowsize": 0,
- },
- EdgeType.INHERITS: {
- "arrowstyle": "solid",
- "backarrowstyle": "none",
- "backarrowsize": 10,
- },
- EdgeType.IMPLEMENTS: {
- "arrowstyle": "solid",
- "backarrowstyle": "none",
- "linestyle": "dotted",
- "backarrowsize": 10,
- },
- EdgeType.ASSOCIATION: {
- "arrowstyle": "solid",
- "backarrowstyle": "none",
- "textcolor": "green",
- },
- EdgeType.AGGREGATION: {
- "arrowstyle": "solid",
- "backarrowstyle": "none",
- "textcolor": "green",
- },
-}
-ORIENTATION: dict[Layout, str] = {
- Layout.LEFT_TO_RIGHT: "left_to_right",
- Layout.RIGHT_TO_LEFT: "right_to_left",
- Layout.TOP_TO_BOTTOM: "top_to_bottom",
- Layout.BOTTOM_TO_TOP: "bottom_to_top",
-}
-
-# Misc utilities ###############################################################
-
-
-class VCGPrinter(Printer):
- def _open_graph(self) -> None:
- """Emit the header lines."""
- self.emit("graph:{\n")
- self._inc_indent()
- self._write_attributes(
- GRAPH_ATTRS,
- title=self.title,
- layoutalgorithm="dfs",
- late_edge_labels="yes",
- port_sharing="no",
- manhattan_edges="yes",
- )
- if self.layout:
- self._write_attributes(GRAPH_ATTRS, orientation=ORIENTATION[self.layout])
-
- def _close_graph(self) -> None:
- """Emit the lines needed to properly close the graph."""
- self._dec_indent()
- self.emit("}")
-
- def emit_node(
- self,
- name: str,
- type_: NodeType,
- properties: NodeProperties | None = None,
- ) -> None:
- """Create a new node.
-
- Nodes can be classes, packages, participants etc.
- """
- if properties is None:
- properties = NodeProperties(label=name)
- elif properties.label is None:
- properties.label = name
- self.emit(f'node: {{title:"{name}"', force_newline=False)
- self._write_attributes(
- NODE_ATTRS,
- label=self._build_label_for_node(properties),
- shape=SHAPES[type_],
- )
- self.emit("}")
-
- @staticmethod
- def _build_label_for_node(properties: NodeProperties) -> str:
- fontcolor = "\f09" if properties.fontcolor == "red" else ""
- label = rf"\fb{fontcolor}{properties.label}\fn"
- if properties.attrs is None and properties.methods is None:
- # return a compact form which only displays the classname in a box
- return label
- attrs = properties.attrs or []
- methods = properties.methods or []
- method_names = [func.name for func in methods]
- # box width for UML like diagram
- maxlen = max(len(name) for name in [properties.label] + method_names + attrs)
- line = "_" * (maxlen + 2)
- label = rf"{label}\n\f{line}"
- for attr in attrs:
- label = rf"{label}\n\f08{attr}"
- if attrs:
- label = rf"{label}\n\f{line}"
- for func in method_names:
- label = rf"{label}\n\f10{func}()"
- return label
-
- def emit_edge(
- self,
- from_node: str,
- to_node: str,
- type_: EdgeType,
- label: str | None = None,
- ) -> None:
- """Create an edge from one node to another to display relationships."""
- self.emit(
- f'edge: {{sourcename:"{from_node}" targetname:"{to_node}"',
- force_newline=False,
- )
- attributes = ARROWS[type_]
- if label:
- attributes["label"] = label
- self._write_attributes(
- EDGE_ATTRS,
- **attributes,
- )
- self.emit("}")
-
- def _write_attributes(
- self, attributes_dict: Mapping[str, Any], **args: Any
- ) -> None:
- """Write graph, node or edge attributes."""
- for key, value in args.items():
- try:
- _type = attributes_dict[key]
- except KeyError as e:
- raise AttributeError(
- f"no such attribute {key}\npossible attributes are {attributes_dict.keys()}"
- ) from e
-
- if not _type:
- self.emit(f'{key}:"{value}"\n')
- elif _type == 1:
- self.emit(f"{key}:{int(value)}\n")
- elif value in _type:
- self.emit(f"{key}:{value}\n")
- else:
- raise ValueError(
- f"value {value} isn't correct for attribute {key} correct values are {type}"
- )
diff --git a/pylint/pyreverse/writer.py b/pylint/pyreverse/writer.py
index d92f4e2e5..58e967115 100644
--- a/pylint/pyreverse/writer.py
+++ b/pylint/pyreverse/writer.py
@@ -1,8 +1,8 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
-"""Utilities for creating VCG and Dot diagrams."""
+"""Utilities for creating diagrams."""
from __future__ import annotations
@@ -57,6 +57,12 @@ class DiagramWriter:
# sorted to get predictable (hence testable) results
for module in sorted(diagram.modules(), key=lambda x: x.title):
module.fig_id = module.node.qname()
+ if self.config.no_standalone and not any(
+ module in (rel.from_object, rel.to_object)
+ for rel in diagram.get_relationships("depends")
+ ):
+ continue
+
self.printer.emit_node(
module.fig_id,
type_=NodeType.PACKAGE,
@@ -75,9 +81,17 @@ class DiagramWriter:
# sorted to get predictable (hence testable) results
for obj in sorted(diagram.objects, key=lambda x: x.title): # type: ignore[no-any-return]
obj.fig_id = obj.node.qname()
- type_ = NodeType.INTERFACE if obj.shape == "interface" else NodeType.CLASS
+ if self.config.no_standalone and not any(
+ obj in (rel.from_object, rel.to_object)
+ for rel_type in ("specialization", "association", "aggregation")
+ for rel in diagram.get_relationships(rel_type)
+ ):
+ continue
+
self.printer.emit_node(
- obj.fig_id, type_=type_, properties=self.get_class_properties(obj)
+ obj.fig_id,
+ type_=NodeType.CLASS,
+ properties=self.get_class_properties(obj),
)
# inheritance links
for rel in diagram.get_relationships("specialization"):
@@ -86,13 +100,6 @@ class DiagramWriter:
rel.to_object.fig_id,
type_=EdgeType.INHERITS,
)
- # implementation links
- for rel in diagram.get_relationships("implements"):
- self.printer.emit_edge(
- rel.from_object.fig_id,
- rel.to_object.fig_id,
- type_=EdgeType.IMPLEMENTS,
- )
# generate associations
for rel in diagram.get_relationships("association"):
self.printer.emit_edge(
diff --git a/pylint/reporters/__init__.py b/pylint/reporters/__init__.py
index f22530de1..cf7b57576 100644
--- a/pylint/reporters/__init__.py
+++ b/pylint/reporters/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Utilities methods and classes for reporters."""
diff --git a/pylint/reporters/base_reporter.py b/pylint/reporters/base_reporter.py
index 3df970d80..d370b1910 100644
--- a/pylint/reporters/base_reporter.py
+++ b/pylint/reporters/base_reporter.py
@@ -1,14 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import os
import sys
-import warnings
from typing import TYPE_CHECKING, TextIO
-from warnings import warn
from pylint.message import Message
from pylint.reporters.ureports.nodes import Text
@@ -31,13 +29,6 @@ class BaseReporter:
"""Name of the reporter."""
def __init__(self, output: TextIO | None = None) -> None:
- if getattr(self, "__implements__", None):
- warnings.warn(
- "Using the __implements__ inheritance pattern for BaseReporter is no "
- "longer supported. Child classes should only inherit BaseReporter",
- DeprecationWarning,
- stacklevel=2,
- )
self.linter: PyLinter
self.section = 0
self.out: TextIO = output or sys.stdout
@@ -49,16 +40,6 @@ class BaseReporter:
"""Handle a new message triggered on the current file."""
self.messages.append(msg)
- def set_output(self, output: TextIO | None = None) -> None:
- """Set output stream."""
- # TODO: 3.0: Remove deprecated method
- warn(
- "'set_output' will be removed in 3.0, please use 'reporter.out = stream' instead",
- DeprecationWarning,
- stacklevel=2,
- )
- self.out = output or sys.stdout
-
def writeln(self, string: str = "") -> None:
"""Write a line in the output buffer."""
print(string, file=self.out)
diff --git a/pylint/reporters/collecting_reporter.py b/pylint/reporters/collecting_reporter.py
index ca9170253..943a74d55 100644
--- a/pylint/reporters/collecting_reporter.py
+++ b/pylint/reporters/collecting_reporter.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/reporters/json_reporter.py b/pylint/reporters/json_reporter.py
index 29df6ba07..176946e72 100644
--- a/pylint/reporters/json_reporter.py
+++ b/pylint/reporters/json_reporter.py
@@ -1,25 +1,19 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""JSON reporter."""
from __future__ import annotations
import json
-import sys
-from typing import TYPE_CHECKING, Optional
+from typing import TYPE_CHECKING, Optional, TypedDict
from pylint.interfaces import UNDEFINED
from pylint.message import Message
from pylint.reporters.base_reporter import BaseReporter
from pylint.typing import MessageLocationTuple
-if sys.version_info >= (3, 8):
- from typing import TypedDict
-else:
- from typing_extensions import TypedDict
-
if TYPE_CHECKING:
from pylint.lint.pylinter import PyLinter
from pylint.reporters.ureports.nodes import Section
@@ -75,7 +69,7 @@ class JSONReporter(BaseJSONReporter):
TODO: 3.0: Remove this JSONReporter in favor of the new one handling abs-path
and confidence.
- TODO: 2.16: Add a new JSONReporter handling abs-path, confidence and scores.
+ TODO: 3.0: Add a new JSONReporter handling abs-path, confidence and scores.
(Ultimately all other breaking change related to json for 3.0).
"""
diff --git a/pylint/reporters/multi_reporter.py b/pylint/reporters/multi_reporter.py
index 8bf0828c4..0c27293b7 100644
--- a/pylint/reporters/multi_reporter.py
+++ b/pylint/reporters/multi_reporter.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/reporters/reports_handler_mix_in.py b/pylint/reporters/reports_handler_mix_in.py
index 32a7190e7..95d45ba91 100644
--- a/pylint/reporters/reports_handler_mix_in.py
+++ b/pylint/reporters/reports_handler_mix_in.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/reporters/text.py b/pylint/reporters/text.py
index c25b31f7e..462ea48fe 100644
--- a/pylint/reporters/text.py
+++ b/pylint/reporters/text.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Plain text reporters:.
@@ -15,12 +15,11 @@ import re
import sys
import warnings
from dataclasses import asdict, fields
-from typing import TYPE_CHECKING, Dict, NamedTuple, Optional, TextIO, cast, overload
+from typing import TYPE_CHECKING, Dict, NamedTuple, TextIO
from pylint.message import Message
from pylint.reporters import BaseReporter
from pylint.reporters.ureports.text_writer import TextWriter
-from pylint.utils import _splitstrip
if TYPE_CHECKING:
from pylint.lint import PyLinter
@@ -37,6 +36,34 @@ class MessageStyle(NamedTuple):
style: tuple[str, ...] = ()
"""Tuple of style strings (see `ANSI_COLORS` for available values)."""
+ def __get_ansi_code(self) -> str:
+ """Return ANSI escape code corresponding to color and style.
+
+ :raise KeyError: if a nonexistent color or style identifier is given
+
+ :return: the built escape code
+ """
+ ansi_code = [ANSI_STYLES[effect] for effect in self.style]
+ if self.color:
+ if self.color.isdigit():
+ ansi_code.extend(["38", "5"])
+ ansi_code.append(self.color)
+ else:
+ ansi_code.append(ANSI_COLORS[self.color])
+ if ansi_code:
+ return ANSI_PREFIX + ";".join(ansi_code) + ANSI_END
+ return ""
+
+ def _colorize_ansi(self, msg: str) -> str:
+ if self.color is None and len(self.style) == 0:
+ # If both color and style are not defined, then leave the text as is.
+ return msg
+ escape_code = self.__get_ansi_code()
+ # If invalid (or unknown) color, don't wrap msg with ANSI codes
+ if escape_code:
+ return f"{escape_code}{msg}{ANSI_RESET}"
+ return msg
+
ColorMappingDict = Dict[str, MessageStyle]
@@ -70,85 +97,9 @@ MESSAGE_FIELDS = {i.name for i in fields(Message)}
"""All fields of the Message class."""
-def _get_ansi_code(msg_style: MessageStyle) -> str:
- """Return ANSI escape code corresponding to color and style.
-
- :param msg_style: the message style
-
- :raise KeyError: if a nonexistent color or style identifier is given
-
- :return: the built escape code
- """
- ansi_code = [ANSI_STYLES[effect] for effect in msg_style.style]
- if msg_style.color:
- if msg_style.color.isdigit():
- ansi_code.extend(["38", "5"])
- ansi_code.append(msg_style.color)
- else:
- ansi_code.append(ANSI_COLORS[msg_style.color])
- if ansi_code:
- return ANSI_PREFIX + ";".join(ansi_code) + ANSI_END
- return ""
-
-
-@overload
-def colorize_ansi(
- msg: str,
- msg_style: MessageStyle | None = ...,
-) -> str:
- ...
-
-
-@overload
-def colorize_ansi(
- msg: str,
- msg_style: str | None = ...,
- style: str = ...,
- *,
- color: str | None = ...,
-) -> str:
- # Remove for pylint 3.0
- ...
-
-
-def colorize_ansi(
- msg: str,
- msg_style: MessageStyle | str | None = None,
- style: str = "",
- **kwargs: str | None,
-) -> str:
- r"""colorize message by wrapping it with ANSI escape codes
-
- :param msg: the message string to colorize
-
- :param msg_style: the message style
- or color (for backwards compatibility): the color of the message style
-
- :param style: the message's style elements, this will be deprecated
-
- :param \**kwargs: used to accept `color` parameter while it is being deprecated
-
- :return: the ANSI escaped string
- """
- # TODO: 3.0: Remove deprecated typing and only accept MessageStyle as parameter
- if not isinstance(msg_style, MessageStyle):
- warnings.warn(
- "In pylint 3.0, the colorize_ansi function of Text reporters will only accept a "
- "MessageStyle parameter",
- DeprecationWarning,
- stacklevel=2,
- )
- color = kwargs.get("color")
- style_attrs = tuple(_splitstrip(style))
- msg_style = MessageStyle(color or msg_style, style_attrs)
- # If both color and style are not defined, then leave the text as is
- if msg_style.color is None and len(msg_style.style) == 0:
- return msg
- escape_code = _get_ansi_code(msg_style)
- # If invalid (or unknown) color, don't wrap msg with ANSI codes
- if escape_code:
- return f"{escape_code}{msg}{ANSI_RESET}"
- return msg
+def colorize_ansi(msg: str, msg_style: MessageStyle) -> str:
+ """Colorize message by wrapping it with ANSI escape codes."""
+ return msg_style._colorize_ansi(msg)
def make_header(msg: Message) -> str:
@@ -186,7 +137,8 @@ class TextReporter(BaseReporter):
if argument[0] not in MESSAGE_FIELDS:
warnings.warn(
f"Don't recognize the argument '{argument[0]}' in the --msg-template. "
- "Are you sure it is supported on the current version of pylint?"
+ "Are you sure it is supported on the current version of pylint?",
+ stacklevel=2,
)
template = re.sub(r"\{" + argument[0] + r"(:.*?)?\}", "", template)
self._fixed_template = template
@@ -269,30 +221,9 @@ class ColorizedTextReporter(TextReporter):
def __init__(
self,
output: TextIO | None = None,
- color_mapping: (
- ColorMappingDict | dict[str, tuple[str | None, str]] | None
- ) = None,
+ color_mapping: ColorMappingDict | None = None,
) -> None:
super().__init__(output)
- # TODO: 3.0: Remove deprecated typing and only accept ColorMappingDict as
- # color_mapping parameter
- if color_mapping and not isinstance(
- list(color_mapping.values())[0], MessageStyle
- ):
- warnings.warn(
- "In pylint 3.0, the ColorizedTextReporter will only accept ColorMappingDict as "
- "color_mapping parameter",
- DeprecationWarning,
- stacklevel=2,
- )
- temp_color_mapping: ColorMappingDict = {}
- for key, value in color_mapping.items():
- color = value[0]
- style_attrs = tuple(_splitstrip(value[1])) # type: ignore[arg-type]
- temp_color_mapping[key] = MessageStyle(color, style_attrs)
- color_mapping = temp_color_mapping
- else:
- color_mapping = cast(Optional[ColorMappingDict], color_mapping)
self.color_mapping = color_mapping or ColorizedTextReporter.COLOR_MAPPING
ansi_terms = ["xterm-16color", "xterm-256color"]
if os.environ.get("TERM") not in ansi_terms:
diff --git a/pylint/reporters/ureports/__init__.py b/pylint/reporters/ureports/__init__.py
index a6a0946af..b87c3c319 100644
--- a/pylint/reporters/ureports/__init__.py
+++ b/pylint/reporters/ureports/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
__all__ = ("BaseWriter",)
diff --git a/pylint/reporters/ureports/base_writer.py b/pylint/reporters/ureports/base_writer.py
index e4bd7e710..9a12123cb 100644
--- a/pylint/reporters/ureports/base_writer.py
+++ b/pylint/reporters/ureports/base_writer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Universal report objects and some formatting drivers.
diff --git a/pylint/reporters/ureports/nodes.py b/pylint/reporters/ureports/nodes.py
index 8b6bf32c6..59443996d 100644
--- a/pylint/reporters/ureports/nodes.py
+++ b/pylint/reporters/ureports/nodes.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Micro reports objects.
@@ -72,7 +72,7 @@ class BaseLayout(VNode):
assert self.parent is not self
if self.parent is None:
return []
- return [self.parent] + self.parent.parents()
+ return [self.parent, *self.parent.parents()]
def add_text(self, text: str) -> None:
"""Shortcut to add text data."""
diff --git a/pylint/reporters/ureports/text_writer.py b/pylint/reporters/ureports/text_writer.py
index 13c675aab..5dd6a5d08 100644
--- a/pylint/reporters/ureports/text_writer.py
+++ b/pylint/reporters/ureports/text_writer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Text formatting drivers for ureports."""
diff --git a/pylint/testutils/__init__.py b/pylint/testutils/__init__.py
index e9b8de1de..0ff9b773b 100644
--- a/pylint/testutils/__init__.py
+++ b/pylint/testutils/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Functional/non regression tests for pylint."""
diff --git a/pylint/testutils/_primer/__init__.py b/pylint/testutils/_primer/__init__.py
index 17c854572..2c40f561b 100644
--- a/pylint/testutils/_primer/__init__.py
+++ b/pylint/testutils/_primer/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
__all__ = ["PackageToLint", "PRIMER_DIRECTORY_PATH"]
diff --git a/pylint/testutils/_primer/package_to_lint.py b/pylint/testutils/_primer/package_to_lint.py
index d59f93ed5..1f596f02b 100644
--- a/pylint/testutils/_primer/package_to_lint.py
+++ b/pylint/testutils/_primer/package_to_lint.py
@@ -1,22 +1,17 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import logging
-import sys
from pathlib import Path
+from typing import Literal
from git import GitCommandError
from git.cmd import Git
from git.repo import Repo
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
PRIMER_DIRECTORY_PATH = Path("tests") / ".pylint_primer_tests"
diff --git a/pylint/testutils/_primer/primer.py b/pylint/testutils/_primer/primer.py
index 7d08f1df5..abe6bc4dd 100644
--- a/pylint/testutils/_primer/primer.py
+++ b/pylint/testutils/_primer/primer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/testutils/_primer/primer_command.py b/pylint/testutils/_primer/primer_command.py
index bbc930913..817c1a0d3 100644
--- a/pylint/testutils/_primer/primer_command.py
+++ b/pylint/testutils/_primer/primer_command.py
@@ -1,23 +1,17 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import abc
import argparse
-import sys
from pathlib import Path
-from typing import Dict
+from typing import Dict, TypedDict
from pylint.reporters.json_reporter import OldJsonExport
from pylint.testutils._primer import PackageToLint
-if sys.version_info >= (3, 8):
- from typing import TypedDict
-else:
- from typing_extensions import TypedDict
-
class PackageData(TypedDict):
commit: str
diff --git a/pylint/testutils/_primer/primer_compare_command.py b/pylint/testutils/_primer/primer_compare_command.py
index acc1c9562..b405d7577 100644
--- a/pylint/testutils/_primer/primer_compare_command.py
+++ b/pylint/testutils/_primer/primer_compare_command.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import json
diff --git a/pylint/testutils/_primer/primer_prepare_command.py b/pylint/testutils/_primer/primer_prepare_command.py
index e69e55b95..27e216bd5 100644
--- a/pylint/testutils/_primer/primer_prepare_command.py
+++ b/pylint/testutils/_primer/primer_prepare_command.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import sys
@@ -15,20 +15,21 @@ class PrepareCommand(PrimerCommand):
def run(self) -> None:
commit_string = ""
version_string = ".".join(str(x) for x in sys.version_info[:2])
+ # Shorten the SHA to avoid exceeding GitHub's 512 char ceiling
if self.config.clone:
for package, data in self.packages.items():
local_commit = data.lazy_clone()
print(f"Cloned '{package}' at commit '{local_commit}'.")
- commit_string += local_commit + "_"
+ commit_string += local_commit[:8] + "_"
elif self.config.check:
for package, data in self.packages.items():
local_commit = Repo(data.clone_directory).head.object.hexsha
print(f"Found '{package}' at commit '{local_commit}'.")
- commit_string += local_commit + "_"
+ commit_string += local_commit[:8] + "_"
elif self.config.make_commit_string:
for package, data in self.packages.items():
remote_sha1_commit = (
- Git().ls_remote(data.url, data.branch).split("\t")[0]
+ Git().ls_remote(data.url, data.branch).split("\t")[0][:8]
)
print(f"'{package}' remote is at commit '{remote_sha1_commit}'.")
commit_string += remote_sha1_commit + "_"
diff --git a/pylint/testutils/_primer/primer_run_command.py b/pylint/testutils/_primer/primer_run_command.py
index cd17d6b1d..7fb4a9ea2 100644
--- a/pylint/testutils/_primer/primer_run_command.py
+++ b/pylint/testutils/_primer/primer_run_command.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -77,7 +77,8 @@ class RunCommand(PrimerCommand):
# Duplicate code takes too long and is relatively safe
# TODO: Find a way to allow cyclic-import and compare output correctly
disables = ["--disable=duplicate-code,cyclic-import"]
- arguments = data.pylint_args + enables + disables
+ additional = ["--clear-cache-post-run=y"]
+ arguments = data.pylint_args + enables + disables + additional
output = StringIO()
reporter = JSONReporter(output)
print(f"Running 'pylint {', '.join(arguments)}'")
@@ -96,6 +97,7 @@ class RunCommand(PrimerCommand):
if fatal_msgs:
warnings.warn(
f"Encountered fatal errors while priming {package_name} !\n"
- f"{self._print_msgs(fatal_msgs)}\n\n"
+ f"{self._print_msgs(fatal_msgs)}\n\n",
+ stacklevel=2,
)
return messages, fatal_msgs
diff --git a/pylint/testutils/_run.py b/pylint/testutils/_run.py
index 0ad68868f..e0a19deca 100644
--- a/pylint/testutils/_run.py
+++ b/pylint/testutils/_run.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Classes and functions used to mimic normal pylint runs.
@@ -10,10 +10,8 @@ This module is considered private and can change at any time.
from __future__ import annotations
from collections.abc import Sequence
-from typing import Any
from pylint.lint import Run as LintRun
-from pylint.lint.run import UNUSED_PARAM_SENTINEL
from pylint.reporters.base_reporter import BaseReporter
from pylint.testutils.lint_module_test import PYLINTRC
@@ -39,7 +37,6 @@ class _Run(LintRun):
args: Sequence[str],
reporter: BaseReporter | None = None,
exit: bool = True, # pylint: disable=redefined-builtin
- do_exit: Any = UNUSED_PARAM_SENTINEL,
) -> None:
args = _add_rcfile_default_pylintrc(list(args))
- super().__init__(args, reporter, exit, do_exit)
+ super().__init__(args, reporter, exit)
diff --git a/pylint/testutils/checker_test_case.py b/pylint/testutils/checker_test_case.py
index 291f52002..343eb8254 100644
--- a/pylint/testutils/checker_test_case.py
+++ b/pylint/testutils/checker_test_case.py
@@ -1,11 +1,10 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import contextlib
-import warnings
from collections.abc import Generator, Iterator
from typing import Any
@@ -78,23 +77,8 @@ class CheckerTestCase:
assert expected_msg.line == gotten_msg.line, msg
assert expected_msg.col_offset == gotten_msg.col_offset, msg
if PY38_PLUS and not IS_PYPY or PY39_PLUS:
- # TODO: 3.0: Remove deprecated missing arguments and remove the warning
- if not expected_msg.end_line == gotten_msg.end_line:
- warnings.warn( # pragma: no cover
- f"The end_line attribute of {gotten_msg} does not match "
- f"the expected value in {expected_msg}. In pylint 3.0 correct end_line "
- "attributes will be required for MessageTest.",
- DeprecationWarning,
- stacklevel=2,
- )
- if not expected_msg.end_col_offset == gotten_msg.end_col_offset:
- warnings.warn( # pragma: no cover
- f"The end_col_offset attribute of {gotten_msg} does not match "
- f"the expected value in {expected_msg}. In pylint 3.0 correct end_col_offset "
- "attributes will be required for MessageTest.",
- DeprecationWarning,
- stacklevel=2,
- )
+ assert expected_msg.end_line == gotten_msg.end_line, msg
+ assert expected_msg.end_col_offset == gotten_msg.end_col_offset, msg
def walk(self, node: nodes.NodeNG) -> None:
"""Recursive walk on the given node."""
diff --git a/pylint/testutils/configuration_test.py b/pylint/testutils/configuration_test.py
index 8b921ceff..5ddb2c03b 100644
--- a/pylint/testutils/configuration_test.py
+++ b/pylint/testutils/configuration_test.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Utility functions for configuration testing."""
diff --git a/pylint/testutils/constants.py b/pylint/testutils/constants.py
index 1c3c69d79..0d93b7e87 100644
--- a/pylint/testutils/constants.py
+++ b/pylint/testutils/constants.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import operator
import re
diff --git a/pylint/testutils/decorator.py b/pylint/testutils/decorator.py
index ab99cbdd8..c20692132 100644
--- a/pylint/testutils/decorator.py
+++ b/pylint/testutils/decorator.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/testutils/functional/__init__.py b/pylint/testutils/functional/__init__.py
index 4840e1ba6..c1c1c5139 100644
--- a/pylint/testutils/functional/__init__.py
+++ b/pylint/testutils/functional/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
__all__ = [
"FunctionalTestFile",
diff --git a/pylint/testutils/functional/find_functional_tests.py b/pylint/testutils/functional/find_functional_tests.py
index 200cee7ec..f2e636687 100644
--- a/pylint/testutils/functional/find_functional_tests.py
+++ b/pylint/testutils/functional/find_functional_tests.py
@@ -1,18 +1,20 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import os
+from collections.abc import Iterator
from pathlib import Path
from pylint.testutils.functional.test_file import FunctionalTestFile
-REASONABLY_DISPLAYABLE_VERTICALLY = 48
-"""'Wet finger' number of files that are reasonable to display by an IDE."""
-SHOULD_BE_IN_THE_SAME_DIRECTORY = 5
-"""'Wet finger' as in 'in my settings there are precisely this many'."""
+REASONABLY_DISPLAYABLE_VERTICALLY = 49
+"""'Wet finger' number of files that are reasonable to display by an IDE.
+
+'Wet finger' as in 'in my settings there are precisely this many'.
+"""
IGNORED_PARENT_DIRS = {
"deprecated_relative_import",
@@ -32,11 +34,12 @@ IGNORED_PARENT_PARENT_DIRS = {
def get_functional_test_files_from_directory(
input_dir: Path | str,
+ max_file_per_directory: int = REASONABLY_DISPLAYABLE_VERTICALLY,
) -> list[FunctionalTestFile]:
"""Get all functional tests in the input_dir."""
suite = []
- _check_functional_tests_structure(Path(input_dir))
+ _check_functional_tests_structure(Path(input_dir), max_file_per_directory)
for dirpath, dirnames, filenames in os.walk(input_dir):
if dirpath.endswith("__pycache__"):
@@ -49,39 +52,88 @@ def get_functional_test_files_from_directory(
return suite
-def _check_functional_tests_structure(directory: Path) -> None:
- """Check if test directories follow correct file/folder structure."""
- # Ignore underscored directories
+def _check_functional_tests_structure(
+ directory: Path, max_file_per_directory: int
+) -> None:
+ """Check if test directories follow correct file/folder structure.
+
+ Ignore underscored directories or files.
+ """
if Path(directory).stem.startswith("_"):
return
files: set[Path] = set()
dirs: set[Path] = set()
+ def _get_files_from_dir(
+ path: Path, violations: list[tuple[Path, int]]
+ ) -> list[Path]:
+ """Return directories and files from a directory and handles violations."""
+ files_without_leading_underscore = list(
+ p for p in path.iterdir() if not p.stem.startswith("_")
+ )
+ if len(files_without_leading_underscore) > max_file_per_directory:
+ violations.append((path, len(files_without_leading_underscore)))
+ return files_without_leading_underscore
+
+ def walk(path: Path) -> Iterator[Path]:
+ violations: list[tuple[Path, int]] = []
+ violations_msgs: set[str] = set()
+ parent_dir_files = _get_files_from_dir(path, violations)
+ error_msg = (
+ "The following directory contains too many functional tests files:\n"
+ )
+ for _file_or_dir in parent_dir_files:
+ if _file_or_dir.is_dir():
+ _files = _get_files_from_dir(_file_or_dir, violations)
+ yield _file_or_dir.resolve()
+ try:
+ yield from walk(_file_or_dir)
+ except AssertionError as e:
+ violations_msgs.add(str(e).replace(error_msg, ""))
+ else:
+ yield _file_or_dir.resolve()
+ if violations or violations_msgs:
+ _msg = error_msg
+ for offending_file, number in violations:
+ _msg += f"- {offending_file}: {number} when the max is {max_file_per_directory}\n"
+ for error_msg in violations_msgs:
+ _msg += error_msg
+ raise AssertionError(_msg)
+
# Collect all sub-directories and files in directory
- for file_or_dir in directory.iterdir():
- if file_or_dir.is_file():
- if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
- files.add(file_or_dir)
- elif file_or_dir.is_dir():
+ for file_or_dir in walk(directory):
+ if file_or_dir.is_dir():
dirs.add(file_or_dir)
- _check_functional_tests_structure(file_or_dir)
-
- assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
- f"{directory} contains too many functional tests files "
- + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
- )
+ elif file_or_dir.suffix == ".py":
+ files.add(file_or_dir)
+ directory_does_not_exists: list[tuple[Path, Path]] = []
+ misplaced_file: list[Path] = []
for file in files:
possible_dir = file.parent / file.stem.split("_")[0]
- assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
-
+ if possible_dir.exists():
+ directory_does_not_exists.append((file, possible_dir))
# Exclude some directories as they follow a different structure
if (
not len(file.parent.stem) == 1 # First letter sub-directories
and file.parent.stem not in IGNORED_PARENT_DIRS
and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
):
- assert file.stem.startswith(
- file.parent.stem
- ), f"{file} should not go in {file.parent}"
+ if not file.stem.startswith(file.parent.stem):
+ misplaced_file.append(file)
+
+ if directory_does_not_exists or misplaced_file:
+ msg = "The following functional tests are disorganized:\n"
+ for file, possible_dir in directory_does_not_exists:
+ msg += (
+ f"- In '{directory}', '{file.relative_to(directory)}' "
+ f"should go in '{possible_dir.relative_to(directory)}'\n"
+ )
+ for file in misplaced_file:
+ msg += (
+ f"- In '{directory}', {file.relative_to(directory)} should go in a directory"
+ f" that starts with the first letters"
+ f" of '{file.stem}' (not '{file.parent.stem}')\n"
+ )
+ raise AssertionError(msg)
diff --git a/pylint/testutils/functional/lint_module_output_update.py b/pylint/testutils/functional/lint_module_output_update.py
index e4f88b3ef..8855fd1aa 100644
--- a/pylint/testutils/functional/lint_module_output_update.py
+++ b/pylint/testutils/functional/lint_module_output_update.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/testutils/functional/test_file.py b/pylint/testutils/functional/test_file.py
index 85a72daa9..16593b5c4 100644
--- a/pylint/testutils/functional/test_file.py
+++ b/pylint/testutils/functional/test_file.py
@@ -1,13 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import configparser
-import sys
from collections.abc import Callable
from os.path import basename, exists, join
+from typing import TypedDict
def parse_python_version(ver_str: str) -> tuple[int, ...]:
@@ -19,12 +19,6 @@ class NoFileError(Exception):
pass
-if sys.version_info >= (3, 8):
- from typing import TypedDict
-else:
- from typing_extensions import TypedDict
-
-
class TestFileOptions(TypedDict):
min_pyver: tuple[int, ...]
max_pyver: tuple[int, ...]
@@ -62,7 +56,7 @@ class FunctionalTestFile:
def __init__(self, directory: str, filename: str) -> None:
self._directory = directory
self.base = filename.replace(".py", "")
- # TODO: 2.x: Deprecate FunctionalTestFile.options and related code
+ # TODO: 3.0: Deprecate FunctionalTestFile.options and related code
# We should just parse these options like a normal configuration file.
self.options: TestFileOptions = {
"min_pyver": (2, 5),
diff --git a/pylint/testutils/functional_test_file.py b/pylint/testutils/functional_test_file.py
deleted file mode 100644
index e2bd7f59b..000000000
--- a/pylint/testutils/functional_test_file.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-__all__ = [
- "FunctionalTestFile",
- "NoFileError",
- "parse_python_version",
-]
-
-import warnings
-
-from pylint.testutils.functional import (
- FunctionalTestFile,
- NoFileError,
- parse_python_version,
-)
-
-warnings.warn(
- "'pylint.testutils.functional_test_file' will be accessible from"
- " the 'pylint.testutils.functional' namespace in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
-)
diff --git a/pylint/testutils/get_test_info.py b/pylint/testutils/get_test_info.py
index a91b1ecd2..eb2c78cfd 100644
--- a/pylint/testutils/get_test_info.py
+++ b/pylint/testutils/get_test_info.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/testutils/global_test_linter.py b/pylint/testutils/global_test_linter.py
index d1ffac599..2e0d3d170 100644
--- a/pylint/testutils/global_test_linter.py
+++ b/pylint/testutils/global_test_linter.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pylint import checkers
from pylint.lint import PyLinter
diff --git a/pylint/testutils/lint_module_test.py b/pylint/testutils/lint_module_test.py
index e139af12b..b578e3162 100644
--- a/pylint/testutils/lint_module_test.py
+++ b/pylint/testutils/lint_module_test.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -266,7 +266,7 @@ class LintModuleTest:
expected_messages: MessageCounter,
actual_output: list[OutputLine],
) -> str:
- msg = [f'Wrong results for file "{self._test_file.base}":']
+ msg = [f'Wrong message(s) raised for "{Path(self._test_file.source).name}":']
missing, unexpected = self.multiset_difference(
expected_messages, actual_messages
)
@@ -289,7 +289,7 @@ class LintModuleTest:
) -> str:
missing = set(expected_lines) - set(received_lines)
unexpected = set(received_lines) - set(expected_lines)
- error_msg = f"Wrong output for '{self._test_file.base}.txt':"
+ error_msg = f'Wrong output for "{Path(self._test_file.expected_output).name}":'
sort_by_line_number = operator.attrgetter("lineno")
if missing:
error_msg += "\n- Missing lines:\n"
diff --git a/pylint/testutils/output_line.py b/pylint/testutils/output_line.py
index 7465fce9d..95f24cc12 100644
--- a/pylint/testutils/output_line.py
+++ b/pylint/testutils/output_line.py
@@ -1,10 +1,9 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-import warnings
from collections.abc import Sequence
from typing import Any, NamedTuple, TypeVar
@@ -13,7 +12,6 @@ from astroid import nodes
from pylint.constants import PY38_PLUS
from pylint.interfaces import UNDEFINED, Confidence
from pylint.message.message import Message
-from pylint.testutils.constants import UPDATE_OPTION
_T = TypeVar("_T")
@@ -89,60 +87,22 @@ class OutputLine(NamedTuple):
"""
if isinstance(row, str):
row = row.split(",")
- # noinspection PyBroadException
- # pylint: disable = too-many-try-statements
try:
+ line = int(row[1])
column = cls._get_column(row[2])
- if len(row) == 5:
- warnings.warn(
- "In pylint 3.0 functional tests expected output should always include the "
- "expected confidence level, expected end_line and expected end_column. "
- "An OutputLine should thus have a length of 8.",
- DeprecationWarning,
- stacklevel=2,
- )
- return cls(
- row[0],
- int(row[1]),
- column,
- None,
- None,
- row[3],
- row[4],
- UNDEFINED.name,
- )
- if len(row) == 6:
- warnings.warn(
- "In pylint 3.0 functional tests expected output should always include the "
- "expected end_line and expected end_column. An OutputLine should thus have "
- "a length of 8.",
- DeprecationWarning,
- stacklevel=2,
- )
- return cls(
- row[0], int(row[1]), column, None, None, row[3], row[4], row[5]
- )
- if len(row) == 8:
- end_line = cls._get_py38_none_value(row[3], check_endline)
- end_column = cls._get_py38_none_value(row[4], check_endline)
- return cls(
- row[0],
- int(row[1]),
- column,
- cls._value_to_optional_int(end_line),
- cls._value_to_optional_int(end_column),
- row[5],
- row[6],
- row[7],
- )
- raise IndexError
- except Exception: # pylint: disable=broad-except
- warnings.warn(
- "Expected 'msg-symbolic-name:42:27:MyClass.my_function:The message:"
- f"CONFIDENCE' but we got '{':'.join(row)}'. Try updating the expected"
- f" output with:\npython tests/test_functional.py {UPDATE_OPTION}",
- UserWarning,
+ end_line = cls._value_to_optional_int(
+ cls._get_py38_none_value(row[3], check_endline)
+ )
+ end_column = cls._value_to_optional_int(
+ cls._get_py38_none_value(row[4], check_endline)
)
+ # symbol, line, column, end_line, end_column, node, msg, confidences
+ assert len(row) == 8
+ return cls(
+ row[0], line, column, end_line, end_column, row[5], row[6], row[7]
+ )
+ except Exception: # pylint: disable=broad-except
+ # We need this to not fail for the update script to work.
return cls("", 0, 0, None, None, "", "", "")
def to_csv(self) -> tuple[str, str, str, str, str, str, str, str]:
diff --git a/pylint/testutils/pyreverse.py b/pylint/testutils/pyreverse.py
index 20dce84dd..c621f9e7a 100644
--- a/pylint/testutils/pyreverse.py
+++ b/pylint/testutils/pyreverse.py
@@ -1,23 +1,17 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import argparse
import configparser
import shlex
-import sys
from pathlib import Path
-from typing import NamedTuple
+from typing import NamedTuple, TypedDict
from pylint.pyreverse.main import DEFAULT_COLOR_PALETTE
-if sys.version_info >= (3, 8):
- from typing import TypedDict
-else:
- from typing_extensions import TypedDict
-
# This class could and should be replaced with a simple dataclass when support for Python < 3.7 is dropped.
# A NamedTuple is not possible as some tests need to modify attributes during the test.
@@ -37,7 +31,9 @@ class PyreverseConfig(
all_ancestors: bool | None = None,
show_associated: int | None = None,
all_associated: bool | None = None,
+ no_standalone: bool = False,
show_builtin: bool = False,
+ show_stdlib: bool = False,
module_names: bool | None = None,
only_classnames: bool = False,
output_format: str = "dot",
@@ -58,7 +54,9 @@ class PyreverseConfig(
self.all_ancestors = all_ancestors
self.show_associated = show_associated
self.all_associated = all_associated
+ self.no_standalone = no_standalone
self.show_builtin = show_builtin
+ self.show_stdlib = show_stdlib
self.module_names = module_names
self.only_classnames = only_classnames
self.output_format = output_format
diff --git a/pylint/testutils/reporter_for_tests.py b/pylint/testutils/reporter_for_tests.py
index 62d70a38d..d3c06eecd 100644
--- a/pylint/testutils/reporter_for_tests.py
+++ b/pylint/testutils/reporter_for_tests.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -20,7 +20,7 @@ class GenericTestReporter(BaseReporter):
out: StringIO
- def __init__( # pylint: disable=super-init-not-called # See https://github.com/PyCQA/pylint/issues/4941
+ def __init__( # pylint: disable=super-init-not-called # See https://github.com/pylint-dev/pylint/issues/4941
self,
) -> None:
self.path_strip_prefix: str = getcwd() + sep
diff --git a/pylint/testutils/testing_pylintrc b/pylint/testutils/testing_pylintrc
index ba5318b51..9429b858f 100644
--- a/pylint/testutils/testing_pylintrc
+++ b/pylint/testutils/testing_pylintrc
@@ -7,3 +7,7 @@ disable=
suppressed-message,
locally-disabled,
useless-suppression,
+
+enable=
+ deprecated-pragma,
+ use-symbolic-message-instead,
diff --git a/pylint/testutils/tokenize_str.py b/pylint/testutils/tokenize_str.py
index 13295fe51..dc9ada72a 100644
--- a/pylint/testutils/tokenize_str.py
+++ b/pylint/testutils/tokenize_str.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/testutils/unittest_linter.py b/pylint/testutils/unittest_linter.py
index a519680f1..a19afec56 100644
--- a/pylint/testutils/unittest_linter.py
+++ b/pylint/testutils/unittest_linter.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=duplicate-code
from __future__ import annotations
-import sys
-from typing import Any
+from typing import Any, Literal
from astroid import nodes
@@ -15,11 +14,6 @@ from pylint.interfaces import UNDEFINED, Confidence
from pylint.lint import PyLinter
from pylint.testutils.output_line import MessageTest
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
class UnittestLinter(PyLinter):
"""A fake linter class to capture checker messages."""
diff --git a/pylint/testutils/utils.py b/pylint/testutils/utils.py
index 292e991c2..1ff999b28 100644
--- a/pylint/testutils/utils.py
+++ b/pylint/testutils/utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/typing.py b/pylint/typing.py
index d62618605..da11112b4 100644
--- a/pylint/typing.py
+++ b/pylint/typing.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""A collection of typing utilities."""
from __future__ import annotations
import argparse
-import sys
from pathlib import Path
from typing import (
TYPE_CHECKING,
@@ -15,19 +14,17 @@ from typing import (
Callable,
Dict,
Iterable,
+ Literal,
NamedTuple,
Optional,
Pattern,
+ Protocol,
Tuple,
Type,
+ TypedDict,
Union,
)
-if sys.version_info >= (3, 8):
- from typing import Literal, Protocol, TypedDict
-else:
- from typing_extensions import Literal, Protocol, TypedDict
-
if TYPE_CHECKING:
from pylint.config.callback_actions import _CallbackAction
from pylint.pyreverse.inspector import Project
diff --git a/pylint/utils/__init__.py b/pylint/utils/__init__.py
index bc5011db9..61833a598 100644
--- a/pylint/utils/__init__.py
+++ b/pylint/utils/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Some various utilities and helper classes, most of them used in the
main pylint class.
@@ -14,13 +14,11 @@ from pylint.utils.utils import (
HAS_ISORT_5,
IsortDriver,
_check_csv,
- _format_option_value,
_splitstrip,
_unquote,
decoding_stream,
diff_string,
format_section,
- get_global_option,
get_module_and_frameid,
get_rst_section,
get_rst_title,
@@ -34,14 +32,12 @@ __all__ = [
"HAS_ISORT_5",
"IsortDriver",
"_check_csv",
- "_format_option_value",
"_splitstrip",
"_unquote",
"decoding_stream",
"diff_string",
"FileState",
"format_section",
- "get_global_option",
"get_module_and_frameid",
"get_rst_section",
"get_rst_title",
diff --git a/pylint/utils/ast_walker.py b/pylint/utils/ast_walker.py
index cf0f13fd1..338caf57a 100644
--- a/pylint/utils/ast_walker.py
+++ b/pylint/utils/ast_walker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/utils/docs.py b/pylint/utils/docs.py
index ebd7cc8c3..ba592c4a4 100644
--- a/pylint/utils/docs.py
+++ b/pylint/utils/docs.py
@@ -1,13 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Various helper functions to create the docs of a linter object."""
from __future__ import annotations
import sys
-import warnings
from typing import TYPE_CHECKING, Any, TextIO
from pylint.constants import MAIN_CHECKER_NAME
@@ -25,20 +24,16 @@ def _get_checkers_infos(linter: PyLinter) -> dict[str, dict[str, Any]]:
if name != MAIN_CHECKER_NAME:
try:
by_checker[name]["checker"] = checker
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- by_checker[name]["options"] += checker.options_and_values()
+ by_checker[name]["options"] += checker._options_and_values()
by_checker[name]["msgs"].update(checker.msgs)
by_checker[name]["reports"] += checker.reports
except KeyError:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- by_checker[name] = {
- "checker": checker,
- "options": list(checker.options_and_values()),
- "msgs": dict(checker.msgs),
- "reports": list(checker.reports),
- }
+ by_checker[name] = {
+ "checker": checker,
+ "options": list(checker._options_and_values()),
+ "msgs": dict(checker.msgs),
+ "reports": list(checker.reports),
+ }
return by_checker
@@ -51,16 +46,14 @@ Pylint provides global options and switches.
"""
for checker in linter.get_checkers():
if checker.name == MAIN_CHECKER_NAME and checker.options:
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
- for section, options in checker.options_by_section():
- if section is None:
- title = "General options"
- else:
- title = f"{section.capitalize()} options"
- result += get_rst_title(title, "~")
- assert isinstance(options, list)
- result += f"{get_rst_section(None, options)}\n"
+ for section, options in checker._options_by_section():
+ if section is None:
+ title = "General options"
+ else:
+ title = f"{section.capitalize()} options"
+ result += get_rst_title(title, "~")
+ assert isinstance(options, list)
+ result += f"{get_rst_section(None, options)}\n"
return result
diff --git a/pylint/utils/file_state.py b/pylint/utils/file_state.py
index 19122b373..9ae5fb077 100644
--- a/pylint/utils/file_state.py
+++ b/pylint/utils/file_state.py
@@ -1,15 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import collections
-import sys
-import warnings
from collections import defaultdict
from collections.abc import Iterator
-from typing import TYPE_CHECKING, Dict
+from typing import TYPE_CHECKING, Dict, Literal
from astroid import nodes
@@ -19,11 +17,6 @@ from pylint.constants import (
WarningScope,
)
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
if TYPE_CHECKING:
from pylint.message import MessageDefinition, MessageDefinitionStore
@@ -36,26 +29,12 @@ class FileState:
def __init__(
self,
- modname: str | None = None,
- msg_store: MessageDefinitionStore | None = None,
+ modname: str,
+ msg_store: MessageDefinitionStore,
node: nodes.Module | None = None,
*,
is_base_filestate: bool = False,
) -> None:
- if modname is None:
- warnings.warn(
- "FileState needs a string as modname argument. "
- "This argument will be required in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
- if msg_store is None:
- warnings.warn(
- "FileState needs a 'MessageDefinitionStore' as msg_store argument. "
- "This argument will be required in pylint 3.0",
- DeprecationWarning,
- stacklevel=2,
- )
self.base_name = modname
self._module_msgs_state: MessageStateDict = {}
self._raw_module_msgs_state: MessageStateDict = {}
@@ -74,25 +53,6 @@ class FileState:
PyLinter.
"""
- def collect_block_lines(
- self, msgs_store: MessageDefinitionStore, module_node: nodes.Module
- ) -> None:
- """Walk the AST to collect block level options line numbers."""
- warnings.warn(
- "'collect_block_lines' has been deprecated and will be removed in pylint 3.0.",
- DeprecationWarning,
- stacklevel=2,
- )
- for msg, lines in self._module_msgs_state.items():
- self._raw_module_msgs_state[msg] = lines.copy()
- orig_state = self._module_msgs_state.copy()
- self._module_msgs_state = {}
- self._suppression_mapping = {}
- self._effective_max_line_number = module_node.tolineno
- for msgid, lines in orig_state.items():
- for msgdef in msgs_store.get_message_definitions(msgid):
- self._set_state_on_block_lines(msgs_store, module_node, msgdef, lines)
-
def _set_state_on_block_lines(
self,
msgs_store: MessageDefinitionStore,
@@ -230,10 +190,6 @@ class FileState:
) -> None:
"""Set status (enabled/disable) for a given message at a given line."""
assert line > 0
- assert self._module
- # TODO: 3.0: Remove unnecessary assertion
- assert self._msgs_store
-
if scope != "line":
# Expand the status to cover all relevant block lines
self._set_state_on_block_lines(
diff --git a/pylint/utils/linterstats.py b/pylint/utils/linterstats.py
index f9a6c6c3c..e7a088b7b 100644
--- a/pylint/utils/linterstats.py
+++ b/pylint/utils/linterstats.py
@@ -1,19 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-import sys
-from typing import cast
+from typing import Literal, TypedDict, cast
from pylint.typing import MessageTypesFullName
-if sys.version_info >= (3, 8):
- from typing import Literal, TypedDict
-else:
- from typing_extensions import Literal, TypedDict
-
class BadNames(TypedDict):
"""TypedDict to store counts of node types with bad names."""
diff --git a/pylint/utils/pragma_parser.py b/pylint/utils/pragma_parser.py
index df3627380..12513e284 100644
--- a/pylint/utils/pragma_parser.py
+++ b/pylint/utils/pragma_parser.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index 054d307bc..543d7cbb3 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -28,12 +28,12 @@ from typing import (
TYPE_CHECKING,
Any,
List,
+ Literal,
Pattern,
TextIO,
Tuple,
TypeVar,
Union,
- overload,
)
from astroid import Module, modutils, nodes
@@ -41,13 +41,7 @@ from astroid import Module, modutils, nodes
from pylint.constants import PY_EXTS
from pylint.typing import OptionDict
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
if TYPE_CHECKING:
- from pylint.checkers.base_checker import BaseChecker
from pylint.lint import PyLinter
DEFAULT_LINE_LENGTH = 79
@@ -215,77 +209,6 @@ def register_plugins(linter: PyLinter, directory: str) -> None:
imported[base] = 1
-@overload
-def get_global_option(
- checker: BaseChecker, option: GLOBAL_OPTION_BOOL, default: bool | None = ...
-) -> bool:
- ...
-
-
-@overload
-def get_global_option(
- checker: BaseChecker, option: GLOBAL_OPTION_INT, default: int | None = ...
-) -> int:
- ...
-
-
-@overload
-def get_global_option(
- checker: BaseChecker,
- option: GLOBAL_OPTION_LIST,
- default: list[str] | None = ...,
-) -> list[str]:
- ...
-
-
-@overload
-def get_global_option(
- checker: BaseChecker,
- option: GLOBAL_OPTION_PATTERN,
- default: Pattern[str] | None = ...,
-) -> Pattern[str]:
- ...
-
-
-@overload
-def get_global_option(
- checker: BaseChecker,
- option: GLOBAL_OPTION_PATTERN_LIST,
- default: list[Pattern[str]] | None = ...,
-) -> list[Pattern[str]]:
- ...
-
-
-@overload
-def get_global_option(
- checker: BaseChecker,
- option: GLOBAL_OPTION_TUPLE_INT,
- default: tuple[int, ...] | None = ...,
-) -> tuple[int, ...]:
- ...
-
-
-def get_global_option(
- checker: BaseChecker,
- option: GLOBAL_OPTION_NAMES,
- default: T_GlobalOptionReturnTypes | None = None, # pylint: disable=unused-argument
-) -> T_GlobalOptionReturnTypes | None | Any:
- """DEPRECATED: Retrieve an option defined by the given *checker* or
- by all known option providers.
-
- It will look in the list of all options providers
- until the given *option* will be found.
- If the option wasn't found, the *default* value will be returned.
- """
- warnings.warn(
- "get_global_option has been deprecated. You can use "
- "checker.linter.config to get all global options instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- return getattr(checker.linter.config, option.replace("-", "_"))
-
-
def _splitstrip(string: str, sep: str = ",") -> list[str]:
"""Return a list of stripped string by splitting the string given as
argument on `sep` (',' by default), empty strings are discarded.
@@ -340,7 +263,7 @@ def _comment(string: str) -> str:
def _format_option_value(optdict: OptionDict, value: Any) -> str:
"""Return the user input's value from a 'compiled' value.
- TODO: 3.0: Remove deprecated function
+ TODO: Refactor the code to not use this deprecated function
"""
if optdict.get("type", None) == "py_version":
value = ".".join(str(item) for item in value)
diff --git a/pylintrc b/pylintrc
index 791b16447..3896d4e35 100644
--- a/pylintrc
+++ b/pylintrc
@@ -54,7 +54,7 @@ unsafe-load-any-extension=no
extension-pkg-allow-list=
# Minimum supported python version
-py-version = 3.7.2
+py-version = 3.8.0
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
@@ -108,6 +108,7 @@ disable=
format,
# We anticipate #3512 where it will become optional
fixme,
+ consider-using-assignment-expr,
[REPORTS]
diff --git a/pyproject.toml b/pyproject.toml
index bd542646b..e4b63c660 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -20,7 +20,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
@@ -30,8 +29,9 @@ classifiers = [
"Topic :: Software Development :: Debuggers",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
+ "Typing :: Typed"
]
-requires-python = ">=3.7.2"
+requires-python = ">=3.8.0"
dependencies = [
"dill>=0.2;python_version<'3.11'",
"dill>=0.3.6;python_version>='3.11'",
@@ -39,7 +39,7 @@ dependencies = [
# Also upgrade requirements_test_min.txt.
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
# see https://github.com/pylint-dev/astroid/issues/1341
- "astroid>=2.15.4,<=2.17.0-dev0",
+ "astroid>=3.0.0a2,<=3.1.0-dev0",
"isort>=4.2.5,<6",
"mccabe>=0.6,<0.8",
"tomli>=1.1.0;python_version<'3.11'",
@@ -55,17 +55,16 @@ spelling = ["pyenchant~=3.2"]
[project.urls]
"Docs: User Guide" = "https://pylint.readthedocs.io/en/latest/"
-"Source Code" = "https://github.com/PyCQA/pylint"
-"homepage" = "https://github.com/PyCQA/pylint"
+"Source Code" = "https://github.com/pylint-dev/pylint"
+"homepage" = "https://github.com/pylint-dev/pylint"
"What's New" = "https://pylint.readthedocs.io/en/latest/whatsnew/2/"
-"Bug Tracker" = "https://github.com/PyCQA/pylint/issues"
+"Bug Tracker" = "https://github.com/pylint-dev/pylint/issues"
"Discord Server" = "https://discord.com/invite/Egy6P8AMB5"
"Docs: Contributor Guide" = "https://pylint.readthedocs.io/en/latest/development_guide/contributor_guide/index.html"
[project.scripts]
pylint = "pylint:run_pylint"
pylint-config = "pylint:_run_pylint_config"
-epylint = "pylint:run_epylint"
pyreverse = "pylint:run_pyreverse"
symilar = "pylint:run_symilar"
@@ -76,7 +75,7 @@ license-files = ["LICENSE", "CONTRIBUTORS.txt"] # Keep in sync with setup.cfg
include = ["pylint*"]
[tool.setuptools.package-data]
-pylint = ["testutils/testing_pylintrc"]
+pylint = ["testutils/testing_pylintrc", "py.typed"]
[tool.setuptools.dynamic]
version = {attr = "pylint.__pkginfo__.__version__"}
@@ -91,7 +90,6 @@ addopts = "--strict-markers"
filterwarnings = "error"
markers = [
"primer_stdlib: Checks for crashes and errors when running pylint on stdlib",
- "primer_external_batch_one: Checks for crashes and errors when running pylint on external libs (batch one)",
"benchmark: Baseline of pylint performance, if this regress something serious happened",
"timeout: Marks from pytest-timeout.",
"needs_two_cores: Checks that need 2 or more cores to be meaningful",
@@ -132,11 +130,29 @@ module = [
]
[tool.ruff]
-select = ["E", "F", "W", "B"]
-ignore = [
- "B905", # Not enforced previousely
-]
-fixable = ["E", "F", "W", "B"]
+
# ruff is less lenient than pylint and does not make any exceptions
# (for docstrings, strings and comments in particular).
line-length = 115
+
+select = [
+ "E", # pycodestyle
+ "F", # pyflakes
+ "W", # pycodestyle
+ "B", # bugbear
+ "I", # isort
+ "RUF", # ruff
+]
+
+ignore = [
+ "B905", # `zip()` without an explicit `strict=` parameter
+]
+
+fixable = [
+ "E", # pycodestyle
+ "F", # pyflakes
+ "W", # pycodestyle
+ "B", # bugbear
+ "I", # isort
+ "RUF", # ruff
+]
diff --git a/requirements_test_min.txt b/requirements_test_min.txt
index 499d287f6..834fc88f8 100644
--- a/requirements_test_min.txt
+++ b/requirements_test_min.txt
@@ -1,9 +1,9 @@
-e .[testutils,spelling]
# astroid dependency is also defined in pyproject.toml
-astroid==2.15.4 # Pinned to a specific version for tests
+astroid==3.0.0a2 # Pinned to a specific version for tests
typing-extensions~=4.5
py~=1.11.0
-pytest~=7.2
+pytest~=7.3
pytest-benchmark~=4.0
pytest-timeout~=2.1
towncrier~=22.12
diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt
index 8928a9acd..934ba863a 100644
--- a/requirements_test_pre_commit.txt
+++ b/requirements_test_pre_commit.txt
@@ -1,10 +1,10 @@
-# Everything in this file should reflect the pre-commit configuration
-# in .pre-commit-config.yaml
-pre-commit~=3.1;python_version>='3.8'
-bandit==1.7.4
-black==23.1.0
-flake8==6.0.0;python_version>='3.8'
+# This file is accurate as long as the version in pre-commit configuration
+# is the latest. We don't want to pin and have to upgrade all the time.
+pre-commit
+bandit
+black
+flake8
ruff
-flake8-typing-imports==1.14.0;python_version>='3.8'
-isort==5.12.0;python_version>='3.8'
-mypy==1.0.1
+flake8-typing-imports
+isort
+mypy
diff --git a/script/.contributors_aliases.json b/script/.contributors_aliases.json
index 7a3c4e04b..f77b993a7 100644
--- a/script/.contributors_aliases.json
+++ b/script/.contributors_aliases.json
@@ -634,6 +634,10 @@
"mails": ["lothiraldan@gmail.com"],
"name": "Boris Feld"
},
+ "lucas.cimon@gmail.com": {
+ "mails": ["lucas.cimon@gmail.com", "925560+Lucas-C@users.noreply.github.com"],
+ "name": "Lucas Cimon"
+ },
"lucristofolini@gmail.com": {
"comment": " (luigibertaco)",
"mails": ["luigi.cristofolini@q-ctrl.com", "lucristofolini@gmail.com"],
diff --git a/script/__init__.py b/script/__init__.py
index e8a8ff79f..cfd18ddd3 100644
--- a/script/__init__.py
+++ b/script/__init__.py
@@ -1,3 +1,3 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
diff --git a/script/bump_changelog.py b/script/bump_changelog.py
index 0963c7c60..3c04c4be5 100644
--- a/script/bump_changelog.py
+++ b/script/bump_changelog.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""This script updates towncrier.toml and creates a new newsfile and intermediate
folders if necessary.
diff --git a/script/check_newsfragments.py b/script/check_newsfragments.py
index b840d9da0..f5069a4bb 100644
--- a/script/check_newsfragments.py
+++ b/script/check_newsfragments.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Small script to check the formatting of news fragments for towncrier.
Used by pre-commit.
@@ -34,12 +34,13 @@ VALID_FILE_TYPE = frozenset(
"bugfix",
"other",
"internal",
+ "performance",
]
)
ISSUES_KEYWORDS = "|".join(VALID_ISSUES_KEYWORDS)
VALID_CHANGELOG_PATTERN = (
rf"(?P<description>(.*\n)*(.*\.\n))\n(?P<ref>({ISSUES_KEYWORDS})"
- r" (PyCQA/astroid)?#(?P<issue>\d+))"
+ r" (pylint-dev/astroid)?#(?P<issue>\d+))"
)
VALID_CHANGELOG_COMPILED_PATTERN: Pattern[str] = re.compile(
VALID_CHANGELOG_PATTERN, flags=re.MULTILINE
diff --git a/script/copyright.txt b/script/copyright.txt
index e8a8ff79f..cfd18ddd3 100644
--- a/script/copyright.txt
+++ b/script/copyright.txt
@@ -1,3 +1,3 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
diff --git a/script/create_contributor_list.py b/script/create_contributor_list.py
index 4502f824d..656902e91 100644
--- a/script/create_contributor_list.py
+++ b/script/create_contributor_list.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pathlib import Path
diff --git a/script/fix_documentation.py b/script/fix_documentation.py
deleted file mode 100644
index e8def2f73..000000000
--- a/script/fix_documentation.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Small script to fix various issues with the documentation. Used by pre-commit."""
-
-from __future__ import annotations
-
-import argparse
-import re
-import sys
-
-INVALID_CODE_BLOCK_PATTERN = (
- r"(?<=\s`)([\w\-\.\(\)\=]+\s{0,1}[\w\-\.\(\)\=]*)(?=`[,\.]{0,1}\s|$)"
-)
-
-# TODO: 2.16.0: Upgrade script for change in changelog
-DEFAULT_CHANGELOG = "ChangeLog"
-DEFAULT_SUBTITLE_PREFIX = "What's New in"
-
-
-def fix_inline_code_blocks(file_content: str) -> str:
- """Use double quotes for code blocks. RST style.
-
- Example:
- `hello-world` -> ``hello-world``
- """
- pattern = re.compile(INVALID_CODE_BLOCK_PATTERN)
- return pattern.sub(r"`\g<0>`", file_content)
-
-
-def changelog_insert_empty_lines(file_content: str, subtitle_text: str) -> str:
- """Insert up to two empty lines before `What's New` entry in ChangeLog."""
- lines = file_content.split("\n")
- subtitle_count = 0
- for i, line in enumerate(lines):
- if line.startswith(subtitle_text):
- subtitle_count += 1
- if subtitle_count == 1 or i < 2 or not lines[i - 1] and not lines[i - 2]:
- continue
- lines.insert(i, "")
- return "\n".join(lines)
-
-
-class CustomHelpFormatter(argparse.HelpFormatter):
- def __init__(
- self,
- prog: str,
- indent_increment: int = 2,
- max_help_position: int = 24,
- width: int | None = None,
- ) -> None:
- max_help_position = 40
- super().__init__(
- prog,
- indent_increment=indent_increment,
- max_help_position=max_help_position,
- width=width,
- )
-
-
-def main(argv: list[str] | None = None) -> int:
- argv = argv or sys.argv[1:]
- parser = argparse.ArgumentParser(formatter_class=CustomHelpFormatter)
- parser.add_argument(
- "--changelog",
- metavar="file",
- default=DEFAULT_CHANGELOG,
- help="Changelog filename (default: '%(default)s')",
- )
- parser.add_argument(
- "--subtitle-prefix",
- metavar="prefix",
- default=DEFAULT_SUBTITLE_PREFIX,
- help="Subtitle prefix (default: '%(default)s')",
- )
- parser.add_argument(
- "filenames",
- nargs="*",
- metavar="FILES",
- help="File names to modify",
- )
- args = parser.parse_args(argv)
-
- return_value: int = 0
- for file_name in args.filenames:
- with open(file_name, encoding="utf-8") as fp:
- original_content = fp.read()
- content = original_content
- # Modify files
- content = fix_inline_code_blocks(content)
- if file_name == args.changelog:
- content = changelog_insert_empty_lines(content, args.subtitle_prefix)
- # If modified, write changes and eventually return 1
- if original_content != content:
- with open(file_name, "w", encoding="utf-8") as fp:
- fp.write(content)
- return_value |= 1
- return return_value
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/script/get_unused_message_id_category.py b/script/get_unused_message_id_category.py
index 4ea8390ee..0e0e67d68 100644
--- a/script/get_unused_message_id_category.py
+++ b/script/get_unused_message_id_category.py
@@ -1,7 +1,7 @@
"""Small script to get a new unused message id category."""
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -13,7 +13,6 @@ from pylint.message._deleted_message_ids import DELETED_MSGID_PREFIXES
def register_all_checkers_and_plugins(linter: PyLinter) -> None:
"""Registers all checkers and plugins."""
- linter.cmdline_parser.set_conflict_handler("resolve")
initialize_checkers(linter)
initialize_extensions(linter)
diff --git a/tbump.toml b/tbump.toml
index d1d78074c..02c194c80 100644
--- a/tbump.toml
+++ b/tbump.toml
@@ -1,7 +1,7 @@
-github_url = "https://github.com/PyCQA/pylint"
+github_url = "https://github.com/pylint-dev/pylint"
[version]
-current = "2.17.4"
+current = "3.0.0b1"
regex = '''
^(?P<major>0|[1-9]\d*)
\.
diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py
index 42521b593..e663aa4b0 100644
--- a/tests/benchmark/test_baseline_benchmarks.py
+++ b/tests/benchmark/test_baseline_benchmarks.py
@@ -1,8 +1,8 @@
"""Profiles basic -jX functionality."""
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=missing-function-docstring
diff --git a/tests/checkers/base/unittest_base.py b/tests/checkers/base/unittest_base.py
index 99a8f659e..8e432bffb 100644
--- a/tests/checkers/base/unittest_base.py
+++ b/tests/checkers/base/unittest_base.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unittest for the base checker."""
diff --git a/tests/checkers/base/unittest_multi_naming_style.py b/tests/checkers/base/unittest_multi_naming_style.py
index 457913149..5e17e6411 100644
--- a/tests/checkers/base/unittest_multi_naming_style.py
+++ b/tests/checkers/base/unittest_multi_naming_style.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unittest for the NameChecker."""
diff --git a/tests/checkers/base/unittest_name_preset.py b/tests/checkers/base/unittest_name_preset.py
index 49a81deff..412e2ee8e 100644
--- a/tests/checkers/base/unittest_name_preset.py
+++ b/tests/checkers/base/unittest_name_preset.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unittest for the NameChecker."""
diff --git a/tests/checkers/conftest.py b/tests/checkers/conftest.py
index ac2a187d4..c91a97198 100644
--- a/tests/checkers/conftest.py
+++ b/tests/checkers/conftest.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pathlib import Path
diff --git a/tests/checkers/unittest_base_checker.py b/tests/checkers/unittest_base_checker.py
index 81a9c73d0..4c4b6d563 100644
--- a/tests/checkers/unittest_base_checker.py
+++ b/tests/checkers/unittest_base_checker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unittest for the BaseChecker class."""
@@ -132,16 +132,5 @@ def test_base_checker_ordering() -> None:
def test_base_checker_invalid_message() -> None:
linter = PyLinter()
-
with pytest.raises(InvalidMessageError):
linter.register_checker(MissingFieldsChecker(linter))
-
-
-def test_get_message_definition() -> None:
- checker = LessBasicChecker()
- with pytest.warns(DeprecationWarning):
- with pytest.raises(InvalidMessageError):
- checker.get_message_definition("W123")
-
- with pytest.warns(DeprecationWarning):
- assert checker.get_message_definition("W0001")
diff --git a/tests/checkers/unittest_deprecated.py b/tests/checkers/unittest_deprecated.py
index d34150247..a9efaa505 100644
--- a/tests/checkers/unittest_deprecated.py
+++ b/tests/checkers/unittest_deprecated.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/checkers/unittest_design.py b/tests/checkers/unittest_design.py
index f2ea09d2d..379fee559 100644
--- a/tests/checkers/unittest_design.py
+++ b/tests/checkers/unittest_design.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import astroid
diff --git a/tests/checkers/unittest_format.py b/tests/checkers/unittest_format.py
index fd0699daa..dfaf037b9 100644
--- a/tests/checkers/unittest_format.py
+++ b/tests/checkers/unittest_format.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Check format checker helper functions."""
@@ -148,9 +148,10 @@ class TestCheckSpace(CheckerTestCase):
encoding_token = tokenize.TokenInfo(
tokenize.ENCODING, "utf-8", (0, 0), (0, 0), ""
)
- tokens = [encoding_token] + _tokenize_str(
- "if (\n None):\n pass\n"
- )
+ tokens = [
+ encoding_token,
+ *_tokenize_str("if (\n None):\n pass\n"),
+ ]
self.checker.process_tokens(tokens)
diff --git a/tests/checkers/unittest_imports.py b/tests/checkers/unittest_imports.py
index d454c8161..4a8d6e553 100644
--- a/tests/checkers/unittest_imports.py
+++ b/tests/checkers/unittest_imports.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unit tests for the imports checker."""
diff --git a/tests/checkers/unittest_misc.py b/tests/checkers/unittest_misc.py
index e360d3bb6..2f292b81f 100644
--- a/tests/checkers/unittest_misc.py
+++ b/tests/checkers/unittest_misc.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Tests for the misc checker."""
diff --git a/tests/checkers/unittest_non_ascii_name.py b/tests/checkers/unittest_non_ascii_name.py
index 4f854dddc..0741a9fb0 100644
--- a/tests/checkers/unittest_non_ascii_name.py
+++ b/tests/checkers/unittest_non_ascii_name.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/checkers/unittest_refactoring.py b/tests/checkers/unittest_refactoring.py
index d40e0eb92..30b1dce2e 100644
--- a/tests/checkers/unittest_refactoring.py
+++ b/tests/checkers/unittest_refactoring.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import os
diff --git a/tests/checkers/unittest_similar.py b/tests/checkers/unittest_similar.py
index c0f0cdcbf..f5bfc6fb2 100644
--- a/tests/checkers/unittest_similar.py
+++ b/tests/checkers/unittest_similar.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from contextlib import redirect_stdout
from io import StringIO
diff --git a/tests/checkers/unittest_spelling.py b/tests/checkers/unittest_spelling.py
index b02cf73a8..08c1fa051 100644
--- a/tests/checkers/unittest_spelling.py
+++ b/tests/checkers/unittest_spelling.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unittest for the spelling checker."""
diff --git a/tests/checkers/unittest_stdlib.py b/tests/checkers/unittest_stdlib.py
index 66747deb9..df0bcfd51 100644
--- a/tests/checkers/unittest_stdlib.py
+++ b/tests/checkers/unittest_stdlib.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -48,7 +48,14 @@ class TestStdlibChecker(CheckerTestCase):
inner_node: nodes.Name,
context: InferenceContext | None = None, # pylint: disable=unused-argument
) -> Iterator[nodes.AssignAttr]:
- new_node = nodes.AssignAttr(attrname="alpha", parent=inner_node)
+ new_node = nodes.AssignAttr(
+ attrname="alpha",
+ parent=inner_node,
+ lineno=0,
+ col_offset=0,
+ end_lineno=0,
+ end_col_offset=0,
+ )
yield new_node
manager = astroid.MANAGER
diff --git a/tests/checkers/unittest_strings.py b/tests/checkers/unittest_strings.py
index 7927dcc49..6c93e0865 100644
--- a/tests/checkers/unittest_strings.py
+++ b/tests/checkers/unittest_strings.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pylint.checkers import strings
diff --git a/tests/checkers/unittest_typecheck.py b/tests/checkers/unittest_typecheck.py
index dba69eaf3..c944b863f 100644
--- a/tests/checkers/unittest_typecheck.py
+++ b/tests/checkers/unittest_typecheck.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import astroid
import pytest
diff --git a/tests/checkers/unittest_unicode/__init__.py b/tests/checkers/unittest_unicode/__init__.py
index 3f516f032..bb7a14a70 100644
--- a/tests/checkers/unittest_unicode/__init__.py
+++ b/tests/checkers/unittest_unicode/__init__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import io
from pathlib import Path
diff --git a/tests/checkers/unittest_unicode/unittest_bad_chars.py b/tests/checkers/unittest_unicode/unittest_bad_chars.py
index 7746ce4ae..e5cdcfe04 100644
--- a/tests/checkers/unittest_unicode/unittest_bad_chars.py
+++ b/tests/checkers/unittest_unicode/unittest_bad_chars.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
diff --git a/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py b/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py
index 6b11dcfef..95b2b4602 100644
--- a/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py
+++ b/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import itertools
import unicodedata
diff --git a/tests/checkers/unittest_unicode/unittest_functions.py b/tests/checkers/unittest_unicode/unittest_functions.py
index 0c809ccdc..09401fd64 100644
--- a/tests/checkers/unittest_unicode/unittest_functions.py
+++ b/tests/checkers/unittest_unicode/unittest_functions.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/checkers/unittest_unicode/unittest_invalid_encoding.py b/tests/checkers/unittest_unicode/unittest_invalid_encoding.py
index e8695a74f..34e344281 100644
--- a/tests/checkers/unittest_unicode/unittest_invalid_encoding.py
+++ b/tests/checkers/unittest_unicode/unittest_invalid_encoding.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/checkers/unittest_utils.py b/tests/checkers/unittest_utils.py
index ac328d7cd..9d90d4c01 100644
--- a/tests/checkers/unittest_utils.py
+++ b/tests/checkers/unittest_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Tests for the pylint.checkers.utils module."""
@@ -11,7 +11,6 @@ import pytest
from astroid import nodes
from pylint.checkers import utils
-from pylint.checkers.base_checker import BaseChecker
@pytest.mark.parametrize(
@@ -414,7 +413,6 @@ def test_if_sys_guard() -> None:
assert utils.is_sys_guard(code[2]) is False
-@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_if_typing_guard() -> None:
code = astroid.extract_node(
"""
@@ -422,30 +420,30 @@ def test_if_typing_guard() -> None:
import typing as t
from typing import TYPE_CHECKING
- if typing.TYPE_CHECKING: #@
- pass
+ if typing.TYPE_CHECKING:
+ pass #@
- if t.TYPE_CHECKING: #@
- pass
+ if t.TYPE_CHECKING:
+ pass #@
- if TYPE_CHECKING: #@
- pass
+ if TYPE_CHECKING:
+ pass #@
- if typing.SOME_OTHER_CONST: #@
- pass
+ if typing.SOME_OTHER_CONST:
+ pass #@
"""
)
assert isinstance(code, list) and len(code) == 4
- assert isinstance(code[0], nodes.If)
- assert utils.is_typing_guard(code[0]) is True
- assert isinstance(code[1], nodes.If)
- assert utils.is_typing_guard(code[1]) is True
- assert isinstance(code[2], nodes.If)
- assert utils.is_typing_guard(code[2]) is True
+ assert isinstance(code[0], nodes.Pass)
+ assert utils.in_type_checking_block(code[0]) is True
+ assert isinstance(code[1], nodes.Pass)
+ assert utils.in_type_checking_block(code[1]) is True
+ assert isinstance(code[2], nodes.Pass)
+ assert utils.in_type_checking_block(code[2]) is True
- assert isinstance(code[3], nodes.If)
- assert utils.is_typing_guard(code[3]) is False
+ assert isinstance(code[3], nodes.Pass)
+ assert utils.in_type_checking_block(code[3]) is False
def test_in_type_checking_block() -> None:
@@ -480,30 +478,6 @@ def test_is_empty_literal() -> None:
assert not utils.is_empty_str_literal(not_empty_string_node.value)
-def test_deprecation_is_inside_lambda() -> None:
- """Test that is_inside_lambda is throwing a DeprecationWarning."""
- with pytest.warns(DeprecationWarning) as records:
- utils.is_inside_lambda(nodes.NodeNG())
- assert len(records) == 1
-
-
-def test_deprecation_check_messages() -> None:
- with pytest.warns(DeprecationWarning) as records:
-
- class Checker(BaseChecker): # pylint: disable=unused-variable
- @utils.check_messages("my-message")
- def visit_assname(self, node: nodes.NodeNG) -> None:
- pass
-
- deprecationMessage = (
- "utils.check_messages will be removed in "
- "favour of calling utils.only_required_for_messages in pylint 3.0"
- )
-
- assert len(records) == 1
- assert records[0].message.args[0] == deprecationMessage
-
-
def test_is_typing_member() -> None:
code = astroid.extract_node(
"""
diff --git a/tests/checkers/unittest_variables.py b/tests/checkers/unittest_variables.py
index e3f013226..858873a36 100644
--- a/tests/checkers/unittest_variables.py
+++ b/tests/checkers/unittest_variables.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import os
import re
@@ -151,7 +151,7 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
# Undefined-method in class def
# Issue 1824
- # https://github.com/PyCQA/pylint/issues/1824
+ # https://github.com/pylint-dev/pylint/issues/1824
node = astroid.parse(
"""
class MyObject(object):
@@ -166,7 +166,7 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
"""Make sure variables from parent lambdas
aren't noted as undefined
- https://github.com/PyCQA/pylint/issues/760
+ https://github.com/pylint-dev/pylint/issues/760
"""
node = astroid.parse(
"""
diff --git a/tests/config/conftest.py b/tests/config/conftest.py
index 491b16267..a5f9a7125 100644
--- a/tests/config/conftest.py
+++ b/tests/config/conftest.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pathlib import Path
diff --git a/tests/config/file_to_lint.py b/tests/config/file_to_lint.py
index b6a8c14c8..174cc5609 100644
--- a/tests/config/file_to_lint.py
+++ b/tests/config/file_to_lint.py
@@ -1,5 +1,5 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Perfect module with only documentation for configuration tests."""
diff --git a/tests/config/functional/ini/pylintrc_with_deleted_message.8.out b/tests/config/functional/ini/pylintrc_with_deleted_message.8.out
index bb7bad8d9..61044918d 100644
--- a/tests/config/functional/ini/pylintrc_with_deleted_message.8.out
+++ b/tests/config/functional/ini/pylintrc_with_deleted_message.8.out
@@ -1,3 +1,3 @@
************* Module {abspath}
-{relpath}:1:0: R0022: Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942. (useless-option-value)
-{relpath}:1:0: R0022: Useless option value for '--enable', 'cmp-builtin' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942. (useless-option-value)
+{relpath}:1:0: R0022: Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value)
+{relpath}:1:0: R0022: Useless option value for '--enable', 'cmp-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value)
diff --git a/tests/config/functional/ini/pylintrc_with_deleted_message.ini b/tests/config/functional/ini/pylintrc_with_deleted_message.ini
index 51b821750..89eaa715e 100644
--- a/tests/config/functional/ini/pylintrc_with_deleted_message.ini
+++ b/tests/config/functional/ini/pylintrc_with_deleted_message.ini
@@ -1,5 +1,5 @@
# Check that we raise an informational when a deleted messages exists in a .pylintrc file
-# See https://github.com/PyCQA/pylint/issues/6794
+# See https://github.com/pylint-dev/pylint/issues/6794
[messages control]
disable = logging-not-lazy, buffer-builtin
enable = useless-option-value, locally-disabled, cmp-builtin
diff --git a/tests/config/functional/ini/pylintrc_with_missing_comma.ini b/tests/config/functional/ini/pylintrc_with_missing_comma.ini
index a30efed21..2242a23a1 100644
--- a/tests/config/functional/ini/pylintrc_with_missing_comma.ini
+++ b/tests/config/functional/ini/pylintrc_with_missing_comma.ini
@@ -1,5 +1,5 @@
# Check that we raise an warning when commas are missing in INI .pylintrc file
-# See https://github.com/PyCQA/pylint/issues/3122
+# See https://github.com/pylint-dev/pylint/issues/3122
[messages control]
disable = logging-not-lazylogging-format-interpolation
enable = locally-disabled
diff --git a/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini b/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini
index 015246d5a..e1cd6876a 100644
--- a/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini
+++ b/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini
@@ -1,4 +1,4 @@
-# Reported in https://github.com/PyCQA/pylint/issues/6888
+# Reported in https://github.com/pylint-dev/pylint/issues/6888
[MASTER]
init-hook=
try: import pylint_venv
diff --git a/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini b/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini
index 8b10877ed..415f57b0f 100644
--- a/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini
+++ b/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini
@@ -1,4 +1,4 @@
# Check that we support quoted init-hooks
-# See https://github.com/PyCQA/pylint/issues/7006
+# See https://github.com/pylint-dev/pylint/issues/7006
[MAIN]
init-hook='print("I should just print")'
diff --git a/tests/config/functional/setup_cfg/deprecate_master/setup.cfg b/tests/config/functional/setup_cfg/deprecate_master/setup.cfg
deleted file mode 100644
index fd6381646..000000000
--- a/tests/config/functional/setup_cfg/deprecate_master/setup.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-# Test the deprecation of MASTER
-[MASTER]
-persistent=no
diff --git a/tests/config/functional/setup_cfg/deprecate_master/setup.result.json b/tests/config/functional/setup_cfg/deprecate_master/setup.result.json
deleted file mode 100644
index b66b78598..000000000
--- a/tests/config/functional/setup_cfg/deprecate_master/setup.result.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "persistent": false
-}
diff --git a/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg
index 51a2c307b..042f53a83 100644
--- a/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg
+++ b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg
@@ -1,4 +1,4 @@
-# Test for the behavior of https://github.com/PyCQA/pylint/issues/4371
+# Test for the behavior of https://github.com/pylint-dev/pylint/issues/4371
[pylint.MAIN]
persistent=no
ignore = migrations
diff --git a/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg b/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg
index b045873c9..7a1d778c7 100644
--- a/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg
+++ b/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg
@@ -1,4 +1,4 @@
-# Test for the behaviour of https://github.com/PyCQA/pylint/issues/4272
+# Test for the behaviour of https://github.com/pylint-dev/pylint/issues/4272
[pylint.NOTMAIN]
load-plugins=pylint.extensions.bad_builtin
[pylint.MAIN]
diff --git a/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml b/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml
index da810e832..1c2ee3031 100644
--- a/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml
+++ b/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml
@@ -1,5 +1,5 @@
# Check that we raise an error when a comma is missing
-# See https://github.com/PyCQA/pylint/issues/3122
+# See https://github.com/pylint-dev/pylint/issues/3122
[tool.pylint."messages control"]
disable = "logging-not-lazylogging-format-interpolation,missing-docstring"
enable = "locally-disabledsuppressed-message,missing-module-docstring"
diff --git a/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml b/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml
index 4d3f753d0..7ef4de4bf 100644
--- a/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml
+++ b/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml
@@ -1,4 +1,4 @@
-# This crashed previously see https://github.com/PyCQA/pylint/issues/3181
+# This crashed previously see https://github.com/pylint-dev/pylint/issues/3181
[tool.pylint]
max-line-length = 120
disable = ["C0121"]
diff --git a/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml b/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml
index 691883527..65fe56090 100644
--- a/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml
+++ b/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml
@@ -1,5 +1,5 @@
# Check the behavior for unkonwn symbol/msgid
-# (Originally) reported in https://github.com/PyCQA/pylint/pull/6293
+# (Originally) reported in https://github.com/pylint-dev/pylint/pull/6293
[tool.pylint."messages control"]
disable = "logging-not-layzy,logging-format-interpolation"
diff --git a/tests/config/functional/tox/unrecognized_options/tox.ini b/tests/config/functional/tox/unrecognized_options/tox.ini
index 7bc38df51..e5db6d116 100644
--- a/tests/config/functional/tox/unrecognized_options/tox.ini
+++ b/tests/config/functional/tox/unrecognized_options/tox.ini
@@ -1,4 +1,4 @@
-; Test for https://github.com/PyCQA/pylint/issues/6800
+; Test for https://github.com/pylint-dev/pylint/issues/6800
[tox]
skipsdist = True
diff --git a/tests/config/pylint_config/test_pylint_config_generate.py b/tests/config/pylint_config/test_pylint_config_generate.py
index adf7129a5..61f158aef 100644
--- a/tests/config/pylint_config/test_pylint_config_generate.py
+++ b/tests/config/pylint_config/test_pylint_config_generate.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test for the 'pylint-config generate' command."""
diff --git a/tests/config/pylint_config/test_pylint_config_help.py b/tests/config/pylint_config/test_pylint_config_help.py
index fcd57894a..5393a28fb 100644
--- a/tests/config/pylint_config/test_pylint_config_help.py
+++ b/tests/config/pylint_config/test_pylint_config_help.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test for the 'pylint-config generate' command."""
diff --git a/tests/config/pylint_config/test_pylint_config_utils.py b/tests/config/pylint_config/test_pylint_config_utils.py
index d41afec1d..b68e331fd 100644
--- a/tests/config/pylint_config/test_pylint_config_utils.py
+++ b/tests/config/pylint_config/test_pylint_config_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test for the 'pylint-config' utils."""
diff --git a/tests/config/pylint_config/test_run_pylint_config.py b/tests/config/pylint_config/test_run_pylint_config.py
index 9795e2183..1d282ed86 100644
--- a/tests/config/pylint_config/test_run_pylint_config.py
+++ b/tests/config/pylint_config/test_run_pylint_config.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test for the 'pylint-config generate' command."""
diff --git a/tests/config/test_argparse_config.py b/tests/config/test_argparse_config.py
index a9d7f70c2..dfa0fd4dd 100644
--- a/tests/config/test_argparse_config.py
+++ b/tests/config/test_argparse_config.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test for the (new) implementation of option parsing with argparse"""
diff --git a/tests/config/test_config.py b/tests/config/test_config.py
index 5eab597fd..ff49d901e 100644
--- a/tests/config/test_config.py
+++ b/tests/config/test_config.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -155,7 +155,7 @@ def test_short_verbose(capsys: CaptureFixture) -> None:
def test_argument_separator() -> None:
"""Check that we support using '--' to separate argument types.
- Reported in https://github.com/PyCQA/pylint/issues/7003.
+ Reported in https://github.com/pylint-dev/pylint/issues/7003.
"""
runner = Run(["--", str(EMPTY_MODULE)], exit=False)
assert not runner.linter.stats.by_msg
diff --git a/tests/config/test_deprecations.py b/tests/config/test_deprecations.py
deleted file mode 100644
index 453a460d8..000000000
--- a/tests/config/test_deprecations.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Test for deprecation warnings in the config module."""
-
-
-import warnings
-
-import pytest
-
-from pylint.checkers import BaseChecker
-from pylint.lint import PyLinter
-from pylint.utils import get_global_option
-
-
-class SampleChecker(BaseChecker):
- options = (("test-opt", {"action": "store_true", "help": "help message"}),)
-
-
-class SampleCheckerTwo(BaseChecker):
- options = (
- ("test-opt-two", {"action": "store", "type": "string", "help": "help message"}),
- )
-
-
-class SampleCheckerThree(BaseChecker):
- options = (
- (
- "test-opt-three",
- {"action": "store_true", "level": 1, "help": "help message"},
- ),
- )
-
-
-class TestDeprecationArgumentsManager:
- """Tests for deprecation warnings in the ArgumentsManager class."""
-
- linter = PyLinter()
-
- @classmethod
- def setup_class(cls) -> None:
- checker = SampleChecker(cls.linter)
- cls.linter.register_checker(checker)
- with pytest.warns(DeprecationWarning):
- cls.linter.register_options_provider(checker)
-
- def test_load_configuration(self) -> None:
- """Test that load_configuration emits a DeprecationWarning."""
-
- with pytest.warns(DeprecationWarning):
- self.linter.load_configuration(test_opt=True)
-
- def test_load_configuration_from_config(self) -> None:
- """Test that load_configuration_from_config emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.load_configuration_from_config({"test_opt": True})
-
- def test_help_with_level(self) -> None:
- """Test that help with a level argument raises a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.help(1)
-
- with pytest.warns(DeprecationWarning):
- self.linter.help(level=1)
-
- with warnings.catch_warnings():
- warnings.simplefilter("error")
- self.linter.help()
-
- def test_register_options_provider_load_defaults(self) -> None:
- """Test that register_options_provider and load_defaults emits a DeprecationWarning."""
- checker = BaseChecker(self.linter)
- with pytest.warns(DeprecationWarning):
- self.linter.register_options_provider(checker)
- with pytest.warns(DeprecationWarning):
- self.linter.load_defaults()
-
- def test_get_global_option(self) -> None:
- """Test that get_global_option emits a DeprecationWarning."""
- checker = BaseChecker(self.linter)
- with pytest.warns(DeprecationWarning):
- get_global_option(checker, "test-opt") # type: ignore[call-overload]
-
- def test_read_config_file(self) -> None:
- """Test that read_config_file emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.read_config_file()
-
- def test_load_config_file(self) -> None:
- """Test that load_config_file emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.load_config_file()
-
- def test_load_command_line_configuration(self) -> None:
- """Test that load_command_line_configuration emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.load_command_line_configuration([])
-
- def test_cb_set_provider_option(self) -> None:
- """Test that cb_set_provider_option emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.cb_set_provider_option(None, "--test-opt", True, None)
-
- def test_level_attribute(self) -> None:
- """Test that the level attribute emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- self.linter.level = 1
-
- with pytest.warns(DeprecationWarning):
- assert self.linter.level is not None
-
- def test_no_default_in_optdict(self) -> None:
- """Test that not having a default value in a optiondict emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- SampleCheckerTwo(self.linter)
-
- def test_no_level_in_optdict(self) -> None:
- """Test that not having a level value in a optiondict emits a DeprecationWarning."""
- with pytest.warns(DeprecationWarning):
- SampleCheckerThree(self.linter)
diff --git a/tests/config/test_find_default_config_files.py b/tests/config/test_find_default_config_files.py
index 2fd66544d..0b513a3d5 100644
--- a/tests/config/test_find_default_config_files.py
+++ b/tests/config/test_find_default_config_files.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -130,6 +130,47 @@ def test_pylintrc_parentdir() -> None:
@pytest.mark.usefixtures("pop_pylintrc")
+def test_pyproject_toml_parentdir() -> None:
+ """Test the search of pyproject.toml file in parent directories"""
+ with tempdir() as chroot:
+ with fake_home():
+ chroot_path = Path(chroot)
+ files = [
+ "pyproject.toml",
+ "git/pyproject.toml",
+ "git/a/pyproject.toml",
+ "git/a/.git",
+ "git/a/b/c/__init__.py",
+ "hg/pyproject.toml",
+ "hg/a/pyproject.toml",
+ "hg/a/.hg",
+ "hg/a/b/c/__init__.py",
+ "none/sub/__init__.py",
+ ]
+ testutils.create_files(files)
+ for config_file in files:
+ if config_file.endswith("pyproject.toml"):
+ with open(config_file, "w", encoding="utf-8") as fd:
+ fd.write('[tool.pylint."messages control"]\n')
+ results = {
+ "": chroot_path / "pyproject.toml",
+ "git": chroot_path / "git" / "pyproject.toml",
+ "git/a": chroot_path / "git" / "a" / "pyproject.toml",
+ "git/a/b": chroot_path / "git" / "a" / "pyproject.toml",
+ "git/a/b/c": chroot_path / "git" / "a" / "pyproject.toml",
+ "hg": chroot_path / "hg" / "pyproject.toml",
+ "hg/a": chroot_path / "hg" / "a" / "pyproject.toml",
+ "hg/a/b": chroot_path / "hg" / "a" / "pyproject.toml",
+ "hg/a/b/c": chroot_path / "hg" / "a" / "pyproject.toml",
+ "none": chroot_path / "pyproject.toml",
+ "none/sub": chroot_path / "pyproject.toml",
+ }
+ for basedir, expected in results.items():
+ os.chdir(chroot_path / basedir)
+ assert next(config.find_default_config_files(), None) == expected
+
+
+@pytest.mark.usefixtures("pop_pylintrc")
def test_pylintrc_parentdir_no_package() -> None:
"""Test that we don't find a pylintrc in sub-packages."""
with tempdir() as chroot:
@@ -138,8 +179,6 @@ def test_pylintrc_parentdir_no_package() -> None:
testutils.create_files(
["a/pylintrc", "a/b/pylintrc", "a/b/c/d/__init__.py"]
)
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() is None
results = {
"a": chroot_path / "a" / "pylintrc",
"a/b": chroot_path / "a" / "b" / "pylintrc",
@@ -244,7 +283,7 @@ def test_cfg_has_config(content: str, expected: bool, tmp_path: Path) -> None:
def test_non_existent_home() -> None:
"""Test that we handle a non-existent home directory.
- Reported in https://github.com/PyCQA/pylint/issues/6802.
+ Reported in https://github.com/pylint-dev/pylint/issues/6802.
"""
with mock.patch("pathlib.Path.home", side_effect=RuntimeError):
current_dir = os.getcwd()
@@ -258,7 +297,7 @@ def test_non_existent_home() -> None:
def test_permission_error() -> None:
"""Test that we handle PermissionError correctly in find_default_config_files.
- Reported in https://github.com/PyCQA/pylint/issues/7169.
+ Reported in https://github.com/pylint-dev/pylint/issues/7169.
"""
with mock.patch("pathlib.Path.is_file", side_effect=PermissionError):
list(config.find_default_config_files())
diff --git a/tests/config/test_functional_config_loading.py b/tests/config/test_functional_config_loading.py
index d5a2ba7ca..0bbfe50ff 100644
--- a/tests/config/test_functional_config_loading.py
+++ b/tests/config/test_functional_config_loading.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""This launches the configuration functional tests. This permits to test configuration
files by providing a file with the appropriate extension in the ``tests/config/functional``
diff --git a/tests/config/test_per_directory_config.py b/tests/config/test_per_directory_config.py
index 85d918a21..b888dd405 100644
--- a/tests/config/test_per_directory_config.py
+++ b/tests/config/test_per_directory_config.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pathlib import Path
diff --git a/tests/config/unittest_config.py b/tests/config/unittest_config.py
deleted file mode 100644
index 343663602..000000000
--- a/tests/config/unittest_config.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Unit tests for the config module."""
-
-from __future__ import annotations
-
-import re
-
-import pytest
-
-from pylint import config
-from pylint.checkers import BaseChecker
-from pylint.testutils import CheckerTestCase, set_config
-from pylint.typing import MessageDefinitionTuple
-
-
-def test__regexp_validator_valid() -> None:
- result = config.option._regexp_validator(None, "", "test_.*")
- assert isinstance(result, re.Pattern)
- assert result.pattern == "test_.*"
-
-
-def test__regexp_validator_invalid() -> None:
- with pytest.raises(re.error):
- config.option._regexp_validator(None, "", "test_)")
-
-
-def test__csv_validator_no_spaces() -> None:
- values = ["One", "Two", "Three"]
- result = config.option._csv_validator(None, "", ",".join(values))
- assert isinstance(result, list)
- assert len(result) == 3
- for i, value in enumerate(values):
- assert result[i] == value
-
-
-def test__csv_validator_spaces() -> None:
- values = ["One", "Two", "Three"]
- result = config.option._csv_validator(None, "", ", ".join(values))
- assert isinstance(result, list)
- assert len(result) == 3
- for i, value in enumerate(values):
- assert result[i] == value
-
-
-def test__regexp_csv_validator_valid() -> None:
- pattern_strings = ["test_.*", "foo\\.bar", "^baz$"]
- result = config.option._regexp_csv_validator(None, "", ",".join(pattern_strings))
- for i, regex in enumerate(result):
- assert isinstance(regex, re.Pattern)
- assert regex.pattern == pattern_strings[i]
-
-
-def test__regexp_csv_validator_invalid() -> None:
- pattern_strings = ["test_.*", "foo\\.bar", "^baz)$"]
- with pytest.raises(re.error):
- config.option._regexp_csv_validator(None, "", ",".join(pattern_strings))
-
-
-class TestPyLinterOptionSetters(CheckerTestCase):
- """Class to check the set_config decorator for options declared in PyLinter."""
-
- class Checker(BaseChecker):
- name = "checker"
- msgs: dict[str, MessageDefinitionTuple] = {}
- options = (("test-opt", {"action": "store_true", "help": "help message"}),)
-
- CHECKER_CLASS: type = Checker
-
- @set_config(ignore_paths=".*/tests/.*,.*\\ignore\\.*")
- def test_ignore_paths_with_value(self) -> None:
- """Test ignore-paths option with value."""
- options = self.linter.config.ignore_paths
-
- assert any(i.match("dir/tests/file.py") for i in options)
- assert any(i.match("dir\\tests\\file.py") for i in options)
- assert any(i.match("dir/ignore/file.py") for i in options)
- assert any(i.match("dir\\ignore\\file.py") for i in options)
-
- def test_ignore_paths_with_no_value(self) -> None:
- """Test ignore-paths option with no value.
- Compare against actual list to see if validator works.
- """
- options = self.linter.config.ignore_paths
-
- assert options == []
diff --git a/tests/conftest.py b/tests/conftest.py
index a35e5cc14..a2512b414 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
@@ -85,12 +85,6 @@ def pytest_addoption(parser: pytest.Parser) -> None:
help="Run primer stdlib tests",
)
parser.addoption(
- "--primer-external",
- action="store_true",
- default=False,
- help="Run primer external tests",
- )
- parser.addoption(
"--minimal-messages-config",
action="store_true",
default=False,
@@ -107,15 +101,6 @@ def pytest_collection_modifyitems(
config: pytest.Config, items: list[pytest.Function]
) -> None:
"""Convert command line options to markers."""
- # Add skip_primer_external mark
- if not config.getoption("--primer-external"):
- skip_primer_external = pytest.mark.skip(
- reason="need --primer-external option to run"
- )
- for item in items:
- if "primer_external_batch_one" in item.keywords:
- item.add_marker(skip_primer_external)
-
# Add skip_primer_stdlib mark
if not config.getoption("--primer-stdlib"):
skip_primer_stdlib = pytest.mark.skip(
diff --git a/tests/data/clientmodule_test.py b/tests/data/clientmodule_test.py
index 35c39684b..7f7c83f46 100644
--- a/tests/data/clientmodule_test.py
+++ b/tests/data/clientmodule_test.py
@@ -3,7 +3,6 @@ from data.suppliermodule_test import Interface, DoNothing, DoNothing2
class Ancestor:
""" Ancestor method """
- __implements__ = (Interface,)
cls_member = DoNothing()
def __init__(self, value):
diff --git a/tests/extensions/__init__.py b/tests/extensions/__init__.py
index e8a8ff79f..cfd18ddd3 100644
--- a/tests/extensions/__init__.py
+++ b/tests/extensions/__init__.py
@@ -1,3 +1,3 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
diff --git a/tests/extensions/test_check_docs_utils.py b/tests/extensions/test_check_docs_utils.py
index 692c14859..a0902b673 100644
--- a/tests/extensions/test_check_docs_utils.py
+++ b/tests/extensions/test_check_docs_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unit tests for utils functions in :mod:`pylint.extensions._check_docs_utils`."""
diff --git a/tests/extensions/test_private_import.py b/tests/extensions/test_private_import.py
index c82f51a42..a10384eac 100644
--- a/tests/extensions/test_private_import.py
+++ b/tests/extensions/test_private_import.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Tests the local module directory comparison logic which requires mocking file directories"""
diff --git a/tests/functional/a/access/access_to_protected_members.py b/tests/functional/a/access/access_to_protected_members.py
index 9ca221628..334ec6a24 100644
--- a/tests/functional/a/access/access_to_protected_members.py
+++ b/tests/functional/a/access/access_to_protected_members.py
@@ -215,7 +215,7 @@ class Issue1159Subclass(Issue1159):
class Issue3066:
"""Test for GitHub issue 3066
Accessing of attributes/methods of inner and outer classes
- https://github.com/PyCQA/pylint/issues/3066"""
+ https://github.com/pylint-dev/pylint/issues/3066"""
attr = 0
_attr = 1
diff --git a/tests/functional/a/alternative/alternative_union_syntax_error.py b/tests/functional/a/alternative/alternative_union_syntax_error.py
index d998b7f00..5730e2e50 100644
--- a/tests/functional/a/alternative/alternative_union_syntax_error.py
+++ b/tests/functional/a/alternative/alternative_union_syntax_error.py
@@ -10,7 +10,7 @@ Testing only 3.8/3.9 to support TypedDict.
# pylint: disable=unnecessary-lambda-assignment
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import dataclasses
diff --git a/tests/functional/a/alternative/alternative_union_syntax_py37.py b/tests/functional/a/alternative/alternative_union_syntax_py37.py
index 41eb75ec6..b82a45153 100644
--- a/tests/functional/a/alternative/alternative_union_syntax_py37.py
+++ b/tests/functional/a/alternative/alternative_union_syntax_py37.py
@@ -9,7 +9,7 @@ Testing only 3.8/3.9 to support TypedDict.
# pylint: disable=inherit-non-class,too-few-public-methods,line-too-long,unnecessary-direct-lambda-call
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from __future__ import annotations
diff --git a/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py b/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py
index 8ec199958..6859e65a7 100644
--- a/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py
+++ b/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py
@@ -2,7 +2,7 @@
Syntax support was added in Python 3.10.
The code snipped should not raise any errors.
-https://github.com/PyCQA/pylint/issues/8119
+https://github.com/pylint-dev/pylint/issues/8119
"""
# pylint: disable=missing-docstring,too-few-public-methods
from typing import Generic, TypeVar
diff --git a/tests/functional/a/arguments.py b/tests/functional/a/arguments.py
index 6929b9850..29fdbd5ba 100644
--- a/tests/functional/a/arguments.py
+++ b/tests/functional/a/arguments.py
@@ -265,7 +265,7 @@ CALL = lambda *args: func(*args)
# Ensure `too-many-function-args` is not emitted when a function call is assigned
# to a class attribute inside the class where the function is defined.
-# Reference: https://github.com/PyCQA/pylint/issues/6592
+# Reference: https://github.com/pylint-dev/pylint/issues/6592
class FruitPicker:
def _pick_fruit(fruit):
def _print_selection(self):
diff --git a/tests/functional/a/arguments_differ.py b/tests/functional/a/arguments_differ.py
index f579f89a6..65e953d76 100644
--- a/tests/functional/a/arguments_differ.py
+++ b/tests/functional/a/arguments_differ.py
@@ -246,7 +246,7 @@ class ChildClass(ParentClass):
pass
-# https://github.com/PyCQA/pylint/issues/4443
+# https://github.com/pylint-dev/pylint/issues/4443
# Some valid overwrites with type annotations
import typing # pylint: disable=wrong-import-position
@@ -331,8 +331,8 @@ class Foo2(AbstractFoo):
# Adding arguments with default values to a child class is valid
# See:
-# https://github.com/PyCQA/pylint/issues/1556
-# https://github.com/PyCQA/pylint/issues/5338
+# https://github.com/pylint-dev/pylint/issues/1556
+# https://github.com/pylint-dev/pylint/issues/5338
class BaseClass:
diff --git a/tests/functional/a/arguments_differ_issue5371.py b/tests/functional/a/arguments_differ_issue5371.py
index a0cd39613..a93302fb8 100644
--- a/tests/functional/a/arguments_differ_issue5371.py
+++ b/tests/functional/a/arguments_differ_issue5371.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/5371"""
+"""https://github.com/pylint-dev/pylint/issues/5371"""
from enum import Enum
diff --git a/tests/functional/a/arguments_positional_only.py b/tests/functional/a/arguments_positional_only.py
new file mode 100644
index 000000000..eb03f1803
--- /dev/null
+++ b/tests/functional/a/arguments_positional_only.py
@@ -0,0 +1,15 @@
+"""Test `no-value-for-parameter` in the context of positional-only parameters"""
+
+# pylint: disable=missing-docstring, unused-argument
+
+
+def name1(param1, /, **kwargs): ...
+def name2(param1, /, param2, **kwargs): ...
+def name3(param1=True, /, **kwargs): ...
+def name4(param1, **kwargs): ...
+
+name1(param1=43) # [no-value-for-parameter]
+name1(43)
+name2(1, param2=False)
+name3()
+name4(param1=43)
diff --git a/tests/functional/s/singledispatch_method_py38.rc b/tests/functional/a/arguments_positional_only.rc
index 85fc502b3..85fc502b3 100644
--- a/tests/functional/s/singledispatch_method_py38.rc
+++ b/tests/functional/a/arguments_positional_only.rc
diff --git a/tests/functional/a/arguments_positional_only.txt b/tests/functional/a/arguments_positional_only.txt
new file mode 100644
index 000000000..7112e6880
--- /dev/null
+++ b/tests/functional/a/arguments_positional_only.txt
@@ -0,0 +1 @@
+no-value-for-parameter:11:0:11:16::No value for argument 'param1' in function call:UNDEFINED
diff --git a/tests/functional/a/arguments_renamed.py b/tests/functional/a/arguments_renamed.py
index 73105f824..9b120f474 100644
--- a/tests/functional/a/arguments_renamed.py
+++ b/tests/functional/a/arguments_renamed.py
@@ -74,7 +74,7 @@ class ChildDefaults(ParentDefaults):
print(f"arguments: {arg2}")
# Check for crash on method definitions not at top level of class
-# https://github.com/PyCQA/pylint/issues/5648
+# https://github.com/pylint-dev/pylint/issues/5648
class FruitConditional:
define_eat = True
diff --git a/tests/functional/a/assigning/assigning_non_slot.py b/tests/functional/a/assigning/assigning_non_slot.py
index 7b4322e62..e27af79ac 100644
--- a/tests/functional/a/assigning/assigning_non_slot.py
+++ b/tests/functional/a/assigning/assigning_non_slot.py
@@ -226,7 +226,7 @@ class MyDescriptor:
pass
-# Regression test from https://github.com/PyCQA/pylint/issues/6001
+# Regression test from https://github.com/pylint-dev/pylint/issues/6001
class Base:
__slots__ = ()
diff --git a/tests/functional/a/assigning/assigning_non_slot_4509.py b/tests/functional/a/assigning/assigning_non_slot_4509.py
index 797c6b083..bb1cde6de 100644
--- a/tests/functional/a/assigning/assigning_non_slot_4509.py
+++ b/tests/functional/a/assigning/assigning_non_slot_4509.py
@@ -1,8 +1,8 @@
# pylint: disable=invalid-name,missing-docstring,too-few-public-methods
# Slots with base that inherits from 'Generic'
-# https://github.com/PyCQA/pylint/issues/4509
-# https://github.com/PyCQA/astroid/issues/999
+# https://github.com/pylint-dev/pylint/issues/4509
+# https://github.com/pylint-dev/astroid/issues/999
from typing import Generic, TypeVar
T = TypeVar("T")
diff --git a/tests/functional/a/assignment/assignment_expression.py b/tests/functional/a/assignment/assignment_expression.py
index 0df18f3d6..bf6f8ebf0 100644
--- a/tests/functional/a/assignment/assignment_expression.py
+++ b/tests/functional/a/assignment/assignment_expression.py
@@ -28,11 +28,11 @@ values = (
)
-# https://github.com/PyCQA/pylint/issues/3347
+# https://github.com/pylint-dev/pylint/issues/3347
s = 'foo' if (fval := lambda: 1) is None else fval
-# https://github.com/PyCQA/pylint/issues/3953
+# https://github.com/pylint-dev/pylint/issues/3953
assert (n := 2) == 1, f"Expected 1, but got {n}"
dict({1: (o := 2)}, data=o)
assert (p := 2) == 1, \
@@ -42,7 +42,7 @@ FOO_PATT = re.compile("")
foo = m.group("foo") if (m := FOO_PATT.match("")) else False
-# https://github.com/PyCQA/pylint/issues/3865
+# https://github.com/pylint-dev/pylint/issues/3865
if (c := lambda: 2) and c():
print("ok")
@@ -50,7 +50,7 @@ def func():
print((d := lambda: 2) and d)
-# https://github.com/PyCQA/pylint/issues/3275
+# https://github.com/pylint-dev/pylint/issues/3275
values = (
e := 1,
f := e,
@@ -64,11 +64,11 @@ function = lambda: (
print(function())
-# https://github.com/PyCQA/pylint/issues/3763
+# https://github.com/pylint-dev/pylint/issues/3763
foo if (foo := 3 - 2) > 0 else 0
-# https://github.com/PyCQA/pylint/issues/4238
+# https://github.com/pylint-dev/pylint/issues/4238
l1 = f'The number {(count1 := 4)} ' \
f'is equal to {count1}'
l2: str = (
@@ -82,13 +82,13 @@ l3 += (
)
-# https://github.com/PyCQA/pylint/issues/4301
+# https://github.com/pylint-dev/pylint/issues/4301
def func2():
return f'The number {(count := 4)} ' \
f'is equal to {count}'
-# https://github.com/PyCQA/pylint/issues/4828
+# https://github.com/pylint-dev/pylint/issues/4828
def func3():
return bar if (bar := "") else ""
@@ -99,7 +99,7 @@ def func4():
# Crash related to assignment expression in nested if statements
-# See https://github.com/PyCQA/pylint/issues/5178
+# See https://github.com/pylint-dev/pylint/issues/5178
def func5(val):
variable = None
diff --git a/tests/functional/a/assignment/assignment_from_no_return.py b/tests/functional/a/assignment/assignment_from_no_return.py
index 673e5e467..7084beb2f 100644
--- a/tests/functional/a/assignment/assignment_from_no_return.py
+++ b/tests/functional/a/assignment/assignment_from_no_return.py
@@ -55,7 +55,7 @@ class Child(Parent):
return 42
-# Regression test for https://github.com/PyCQA/pylint/issues/4220
+# Regression test for https://github.com/pylint-dev/pylint/issues/4220
class A:
"""Parent class"""
def f(self):
diff --git a/tests/functional/b/bad_option_value.txt b/tests/functional/b/bad_option_value.txt
index ce7605691..51af412f7 100644
--- a/tests/functional/b/bad_option_value.txt
+++ b/tests/functional/b/bad_option_value.txt
@@ -1,17 +1,17 @@
unknown-option-value:4:0:None:None::Unknown option value for 'disable', expected a valid pylint message and got 'C05048':HIGH
-useless-option-value:6:0:None:None::"Useless option value for 'disable', 'execfile-builtin' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
+useless-option-value:6:0:None:None::"Useless option value for 'disable', 'execfile-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH
useless-option-value:8:0:None:None::"Useless option value for 'disable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH
-useless-option-value:10:0:None:None::"Useless option value for 'disable', 'W1656' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
+useless-option-value:10:0:None:None::"Useless option value for 'disable', 'W1656' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH
useless-option-value:12:0:None:None::"Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH
unknown-option-value:14:0:None:None::Unknown option value for 'disable-next', expected a valid pylint message and got 'R78948':HIGH
-useless-option-value:16:0:None:None::"Useless option value for 'disable-next', 'deprecated-types-field' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
-useless-option-value:18:0:None:None::"Useless option value for 'disable-next', 'W1634' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
+useless-option-value:16:0:None:None::"Useless option value for 'disable-next', 'deprecated-types-field' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH
+useless-option-value:18:0:None:None::"Useless option value for 'disable-next', 'W1634' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH
useless-option-value:20:0:None:None::"Useless option value for 'disable-next', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH
useless-option-value:22:0:None:None::"Useless option value for 'disable-next', 'R0201' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH
unknown-option-value:25:0:None:None::Unknown option value for 'enable', expected a valid pylint message and got 'W04044':HIGH
-useless-option-value:27:0:None:None::"Useless option value for 'enable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
+useless-option-value:27:0:None:None::"Useless option value for 'enable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH
useless-option-value:29:0:None:None::"Useless option value for 'enable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH
-useless-option-value:31:0:None:None::"Useless option value for 'enable', 'W1622' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
+useless-option-value:31:0:None:None::"Useless option value for 'enable', 'W1622' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH
useless-option-value:33:0:None:None::"Useless option value for 'enable', 'R0201' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH
-useless-option-value:36:0:None:None::"Useless option value for 'disable', 'no-space-after-operator' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3577.":HIGH
-useless-option-value:38:0:None:None::"Useless option value for 'disable', 'C0323' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3577.":HIGH
+useless-option-value:36:0:None:None::"Useless option value for 'disable', 'no-space-after-operator' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/3577.":HIGH
+useless-option-value:38:0:None:None::"Useless option value for 'disable', 'C0323' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/3577.":HIGH
diff --git a/tests/functional/b/bad_reversed_sequence_py37.py b/tests/functional/b/bad_reversed_sequence_py37.py
index 5a0b2124c..4f132d945 100644
--- a/tests/functional/b/bad_reversed_sequence_py37.py
+++ b/tests/functional/b/bad_reversed_sequence_py37.py
@@ -1,8 +1,8 @@
""" Dictionaries are reversible starting on python 3.8"""
-
# pylint: disable=missing-docstring
-reversed({'a': 1, 'b': 2}) # [bad-reversed-sequence]
+# This can't be detected since changes to locals aren't backported
+reversed({'a': 1, 'b': 2})
class InheritDict(dict):
diff --git a/tests/functional/b/bad_reversed_sequence_py37.rc b/tests/functional/b/bad_reversed_sequence_py37.rc
index 67a28a36a..77eb3be64 100644
--- a/tests/functional/b/bad_reversed_sequence_py37.rc
+++ b/tests/functional/b/bad_reversed_sequence_py37.rc
@@ -1,2 +1,2 @@
-[testoptions]
-max_pyver=3.8
+[main]
+py-version=3.7
diff --git a/tests/functional/b/bad_reversed_sequence_py37.txt b/tests/functional/b/bad_reversed_sequence_py37.txt
index 6fbbd2c59..da511347b 100644
--- a/tests/functional/b/bad_reversed_sequence_py37.txt
+++ b/tests/functional/b/bad_reversed_sequence_py37.txt
@@ -1,2 +1 @@
-bad-reversed-sequence:5:0:5:26::The first reversed() argument is not a sequence:UNDEFINED
bad-reversed-sequence:12:0:12:39::The first reversed() argument is not a sequence:UNDEFINED
diff --git a/tests/functional/c/cached_property.py b/tests/functional/c/cached_property.py
index 0b75f246b..85d271ab5 100644
--- a/tests/functional/c/cached_property.py
+++ b/tests/functional/c/cached_property.py
@@ -2,7 +2,7 @@
from functools import cached_property
-# https://github.com/PyCQA/pylint/issues/4023
+# https://github.com/pylint-dev/pylint/issues/4023
# False-positive 'invalid-overridden-method' with 'cached_property'
class Parent:
@property
diff --git a/tests/functional/c/cellvar_escaping_loop.py b/tests/functional/c/cellvar_escaping_loop.py
index 8781e6c5c..eb120ea79 100644
--- a/tests/functional/c/cellvar_escaping_loop.py
+++ b/tests/functional/c/cellvar_escaping_loop.py
@@ -95,7 +95,7 @@ def good_case_issue3107():
def good_case_issue_5012():
"""Eager binding of cell variable when used as the default value of a keyword-only argument.
- https://github.com/PyCQA/pylint/issues/5012
+ https://github.com/pylint-dev/pylint/issues/5012
"""
funs = []
for i in range(5):
diff --git a/tests/functional/c/class_protocol_ellipsis.py b/tests/functional/c/class_protocol_ellipsis.py
index ef5d3b34e..a6c0b0677 100644
--- a/tests/functional/c/class_protocol_ellipsis.py
+++ b/tests/functional/c/class_protocol_ellipsis.py
@@ -5,7 +5,7 @@ from typing import Any, Iterator
class MyClass:
"""The "invalid-*-returned" messages shouldn't be emitted for stub functions
- Original issue: https://github.com/PyCQA/pylint/issues/4736"""
+ Original issue: https://github.com/pylint-dev/pylint/issues/4736"""
def __len__(self) -> int:
...
diff --git a/tests/functional/c/comparison_with_callable_typing_constants.py b/tests/functional/c/comparison_with_callable_typing_constants.py
index 70aa9763f..487edc80f 100644
--- a/tests/functional/c/comparison_with_callable_typing_constants.py
+++ b/tests/functional/c/comparison_with_callable_typing_constants.py
@@ -6,7 +6,7 @@ from typing import Any, Optional
def check_any(type_) -> bool:
- """See https://github.com/PyCQA/pylint/issues/5557"""
+ """See https://github.com/pylint-dev/pylint/issues/5557"""
return type_ == Any
diff --git a/tests/functional/c/consider/consider_iterating_dictionary.py b/tests/functional/c/consider/consider_iterating_dictionary.py
index 91402bf77..507e7c0c9 100644
--- a/tests/functional/c/consider/consider_iterating_dictionary.py
+++ b/tests/functional/c/consider/consider_iterating_dictionary.py
@@ -68,7 +68,7 @@ VAR = 1 in dict()
VAR = [1, 2] == {}.keys() in {False}
# Additional membership checks
-# See: https://github.com/PyCQA/pylint/issues/5323
+# See: https://github.com/pylint-dev/pylint/issues/5323
metadata = {}
if "a" not in list(metadata.keys()): # [consider-iterating-dictionary]
print(1)
diff --git a/tests/functional/c/consider/consider_using_dict_items.py b/tests/functional/c/consider/consider_using_dict_items.py
index 7ffea608f..7fd74814f 100644
--- a/tests/functional/c/consider/consider_using_dict_items.py
+++ b/tests/functional/c/consider/consider_using_dict_items.py
@@ -86,7 +86,7 @@ val = any(True for k8 in Foo.c_dict if c_dict[k8])
val = any(True for k8 in Foo.c_dict.keys() if Foo.c_dict[k8]) # [consider-iterating-dictionary,consider-using-dict-items]
# Test false positive described in #4630
-# (https://github.com/PyCQA/pylint/issues/4630)
+# (https://github.com/pylint-dev/pylint/issues/4630)
d = {'key': 'value'}
diff --git a/tests/functional/c/consider/consider_using_enumerate.py b/tests/functional/c/consider/consider_using_enumerate.py
index 352669f6a..1b8bb4c6b 100644
--- a/tests/functional/c/consider/consider_using_enumerate.py
+++ b/tests/functional/c/consider/consider_using_enumerate.py
@@ -73,7 +73,7 @@ def does_not_crash_on_range_without_args():
print(elem)
# False negative described in #3657
-# https://github.com/PyCQA/pylint/issues/3657
+# https://github.com/pylint-dev/pylint/issues/3657
class MyClass:
def __init__(self):
self.my_list = []
diff --git a/tests/functional/c/consider/consider_using_f_string.py b/tests/functional/c/consider/consider_using_f_string.py
index e961c44f7..e0a4831cf 100644
--- a/tests/functional/c/consider/consider_using_f_string.py
+++ b/tests/functional/c/consider/consider_using_f_string.py
@@ -1,4 +1,4 @@
-"""Test to see if a f-string would be possible and consider-using-f-string should be raised"""
+"""Test to see if an f-string would be possible and consider-using-f-string should be raised"""
# pylint: disable=unused-variable, invalid-name, missing-function-docstring, pointless-statement
# pylint: disable=expression-not-assigned, repeated-keyword, too-many-locals
diff --git a/tests/functional/c/consider/consider_using_f_string.txt b/tests/functional/c/consider/consider_using_f_string.txt
index 1d68e947b..e7785bae6 100644
--- a/tests/functional/c/consider/consider_using_f_string.txt
+++ b/tests/functional/c/consider/consider_using_f_string.txt
@@ -1,30 +1,30 @@
-consider-using-f-string:45:10:45:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:46:10:46:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:47:10:47:28:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:48:10:48:17:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:49:10:49:26:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:50:10:50:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:51:10:51:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:52:10:52:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:53:10:53:24:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:54:10:54:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:80:4:80:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:81:4:81:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:82:4:82:22:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:83:4:83:11:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:84:4:84:20:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:85:4:85:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:86:4:86:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:87:4:87:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:88:4:88:18:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:89:4:89:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:112:8:112:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:113:8:113:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:114:8:114:26:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:115:8:115:15:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:116:8:116:24:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:117:8:117:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:118:8:118:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:119:8:119:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:120:8:120:22:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
-consider-using-f-string:121:8:121:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED
+consider-using-f-string:45:10:45:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:46:10:46:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:47:10:47:28:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:48:10:48:17:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:49:10:49:26:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:50:10:50:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:51:10:51:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:52:10:52:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:53:10:53:24:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:54:10:54:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:80:4:80:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:81:4:81:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:82:4:82:22:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:83:4:83:11:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:84:4:84:20:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:85:4:85:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:86:4:86:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:87:4:87:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:88:4:88:18:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:89:4:89:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:112:8:112:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:113:8:113:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:114:8:114:26:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:115:8:115:15:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:116:8:116:24:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:117:8:117:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:118:8:118:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:119:8:119:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:120:8:120:22:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
+consider-using-f-string:121:8:121:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED
diff --git a/tests/functional/c/consider/consider_using_generator.py b/tests/functional/c/consider/consider_using_generator.py
index ee561a7e9..af5700373 100644
--- a/tests/functional/c/consider/consider_using_generator.py
+++ b/tests/functional/c/consider/consider_using_generator.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring, invalid-name
-# https://github.com/PyCQA/pylint/issues/3165
+# https://github.com/pylint-dev/pylint/issues/3165
list([])
tuple([])
diff --git a/tests/functional/c/consider/consider_using_min_max_builtin.py b/tests/functional/c/consider/consider_using_min_max_builtin.py
index 6e7c7b886..e33394c47 100644
--- a/tests/functional/c/consider/consider_using_min_max_builtin.py
+++ b/tests/functional/c/consider/consider_using_min_max_builtin.py
@@ -97,7 +97,7 @@ else:
value = 3
-# https://github.com/PyCQA/pylint/issues/4379
+# https://github.com/pylint-dev/pylint/issues/4379
var = 1
if var == -1:
var = None
diff --git a/tests/functional/c/consider/consider_using_with.py b/tests/functional/c/consider/consider_using_with.py
index 1c87582ee..e8e162337 100644
--- a/tests/functional/c/consider/consider_using_with.py
+++ b/tests/functional/c/consider/consider_using_with.py
@@ -230,7 +230,7 @@ with used_pool:
def test_subscript_assignment():
"""
- Regression test for issue https://github.com/PyCQA/pylint/issues/4732.
+ Regression test for issue https://github.com/pylint-dev/pylint/issues/4732.
If a context manager is assigned to a list or dict, we are not able to
tell if / how the context manager is used later on, as it is not assigned
to a variable or attribute directly.
diff --git a/tests/functional/d/dataclass/dataclass_typecheck.py b/tests/functional/d/dataclass/dataclass_typecheck.py
index fbd770704..e66755640 100644
--- a/tests/functional/d/dataclass/dataclass_typecheck.py
+++ b/tests/functional/d/dataclass/dataclass_typecheck.py
@@ -1,12 +1,12 @@
"""Tests for dataclass attributes with basic type annotations.
-Tests for regressions from https://github.com/PyCQA/astroid/pull/1126
+Tests for regressions from https://github.com/pylint-dev/astroid/pull/1126
"""
# pylint: disable=missing-docstring,too-few-public-methods,pointless-statement,redefined-builtin, fixme
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from dataclasses import dataclass
diff --git a/tests/functional/d/dataclass/dataclass_with_default_factory.py b/tests/functional/d/dataclass/dataclass_with_default_factory.py
index db392d8b7..809c3304b 100644
--- a/tests/functional/d/dataclass/dataclass_with_default_factory.py
+++ b/tests/functional/d/dataclass/dataclass_with_default_factory.py
@@ -1,7 +1,7 @@
"""Various regression tests for dataclasses."""
# See issues:
-# - https://github.com/PyCQA/pylint/issues/2605
-# - https://github.com/PyCQA/pylint/issues/2698
+# - https://github.com/pylint-dev/pylint/issues/2605
+# - https://github.com/pylint-dev/pylint/issues/2698
from dataclasses import dataclass, field
import dataclasses as dc
from typing import cast
diff --git a/tests/functional/d/dataclass/dataclass_with_field.py b/tests/functional/d/dataclass/dataclass_with_field.py
index 9a807becb..04a186c72 100644
--- a/tests/functional/d/dataclass/dataclass_with_field.py
+++ b/tests/functional/d/dataclass/dataclass_with_field.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/4899"""
+"""Regression test for https://github.com/pylint-dev/pylint/issues/4899"""
# pylint: disable=missing-docstring,too-few-public-methods
diff --git a/tests/functional/d/disabled_msgid_in_pylintrc.py b/tests/functional/d/disabled_msgid_in_pylintrc.py
index 91cb155e1..7ad701de9 100644
--- a/tests/functional/d/disabled_msgid_in_pylintrc.py
+++ b/tests/functional/d/disabled_msgid_in_pylintrc.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/4265"""
+"""https://github.com/pylint-dev/pylint/issues/4265"""
try:
f = open('test', encoding="utf-8")
diff --git a/tests/functional/e/.#emacs_file_lock.py b/tests/functional/e/.#emacs_file_lock.py
index e2ed09d7c..a21e28482 100644
--- a/tests/functional/e/.#emacs_file_lock.py
+++ b/tests/functional/e/.#emacs_file_lock.py
@@ -1,4 +1,4 @@
# The name is invalid, but we should not analyse this file
# Because its filename reseambles an Emacs file lock ignored by default
# https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html
-# See https://github.com/PyCQA/pylint/issues/367
+# See https://github.com/pylint-dev/pylint/issues/367
diff --git a/tests/functional/e/.#emacs_file_lock_by_conf.py b/tests/functional/e/.#emacs_file_lock_by_conf.py
index a7247f609..af875582c 100644
--- a/tests/functional/e/.#emacs_file_lock_by_conf.py
+++ b/tests/functional/e/.#emacs_file_lock_by_conf.py
@@ -1,3 +1,3 @@
# The name is invalid, but we should not analyse this file
# Because it resembles an Emacs file lock and is ignored by the configuration
-# See https://github.com/PyCQA/pylint/issues/367
+# See https://github.com/pylint-dev/pylint/issues/367
diff --git a/tests/functional/e/enum_self_defined_member_5138.py b/tests/functional/e/enum_self_defined_member_5138.py
index 4a49903c6..d9a6c105e 100644
--- a/tests/functional/e/enum_self_defined_member_5138.py
+++ b/tests/functional/e/enum_self_defined_member_5138.py
@@ -1,4 +1,4 @@
-"""Tests for self-defined Enum members (https://github.com/PyCQA/pylint/issues/5138)"""
+"""Tests for self-defined Enum members (https://github.com/pylint-dev/pylint/issues/5138)"""
# pylint: disable=missing-docstring
from enum import IntEnum, Enum
diff --git a/tests/functional/e/enum_self_defined_member_6805.py b/tests/functional/e/enum_self_defined_member_6805.py
index bcf0c8e10..1b70bbe82 100644
--- a/tests/functional/e/enum_self_defined_member_6805.py
+++ b/tests/functional/e/enum_self_defined_member_6805.py
@@ -1,4 +1,4 @@
-"""Tests for self-defined Enum members (https://github.com/PyCQA/pylint/issues/6805)"""
+"""Tests for self-defined Enum members (https://github.com/pylint-dev/pylint/issues/6805)"""
# pylint: disable=missing-docstring
# pylint: disable=too-few-public-methods
from enum import IntEnum
diff --git a/tests/functional/e/enum_subclasses.py b/tests/functional/e/enum_subclasses.py
index 6ad453a4b..eb6e1bebb 100644
--- a/tests/functional/e/enum_subclasses.py
+++ b/tests/functional/e/enum_subclasses.py
@@ -3,7 +3,7 @@ from enum import Enum, Flag, IntEnum, auto
class Issue1932(IntEnum):
- """https://github.com/PyCQA/pylint/issues/1932"""
+ """https://github.com/pylint-dev/pylint/issues/1932"""
FOO = 1
@@ -12,7 +12,7 @@ class Issue1932(IntEnum):
class Issue2062(Enum):
- """https://github.com/PyCQA/pylint/issues/2062"""
+ """https://github.com/pylint-dev/pylint/issues/2062"""
FOO = 1
BAR = 2
@@ -81,7 +81,7 @@ assert test_enum.hello_pylint() == test_enum.name
# Check combinations of Flag members using the bitwise operators (&, |, ^, ~)
-# https://github.com/PyCQA/pylint/issues/7381
+# https://github.com/pylint-dev/pylint/issues/7381
class Colour(Flag):
NONE = 0
RED = 2
diff --git a/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py b/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py
index 417bc5c0b..ab3acfe27 100644
--- a/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py
+++ b/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py
@@ -121,7 +121,7 @@ x = x <= 3
x = 3 <= x
-# https://github.com/PyCQA/pylint/issues/8086
+# https://github.com/pylint-dev/pylint/issues/8086
# consider-using-augmented-assign should only be flagged
# if names attribute names match exactly.
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.py b/tests/functional/ext/comparetozero/compare_to_zero.py
deleted file mode 100644
index 6a14b8bc9..000000000
--- a/tests/functional/ext/comparetozero/compare_to_zero.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# pylint: disable=literal-comparison,missing-docstring, singleton-comparison
-
-X = 123
-Y = len('test')
-
-if X is 0: # [compare-to-zero]
- pass
-
-if X is False:
- pass
-
-if Y is not 0: # [compare-to-zero]
- pass
-
-if Y is not False:
- pass
-
-if X == 0: # [compare-to-zero]
- pass
-
-if X == False:
- pass
-
-if 0 == Y: # [compare-to-zero]
- pass
-
-if Y != 0: # [compare-to-zero]
- pass
-
-if 0 != X: # [compare-to-zero]
- pass
-
-if Y != False:
- pass
-
-if X > 0:
- pass
-
-if X < 0:
- pass
-
-if 0 < X:
- pass
-
-if 0 > X:
- pass
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.rc b/tests/functional/ext/comparetozero/compare_to_zero.rc
deleted file mode 100644
index 70c6171b5..000000000
--- a/tests/functional/ext/comparetozero/compare_to_zero.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-[MAIN]
-load-plugins=pylint.extensions.comparetozero,
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.txt b/tests/functional/ext/comparetozero/compare_to_zero.txt
deleted file mode 100644
index a413a3268..000000000
--- a/tests/functional/ext/comparetozero/compare_to_zero.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-compare-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
-compare-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
-compare-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
-compare-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"" as 0 is falsey":HIGH
-compare-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
-compare-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"" as 0 is falsey":HIGH
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py
index 92646a87f..917841581 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py
@@ -12,7 +12,7 @@ https://google.github.io/styleguide/pyguide.html#doc-function-args
def test_multi_line_parameters(param: int) -> None:
"""Checks that multi line parameters lists are checked correctly
- See https://github.com/PyCQA/pylint/issues/5452
+ See https://github.com/pylint-dev/pylint/issues/5452
Args:
param:
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
index 5626ad385..794f4c2f6 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
@@ -394,7 +394,7 @@ def test_ignores_optional_specifier_numpy(param, param2="all"):
def test_with_list_of_default_values(arg, option, option2):
- """Reported in https://github.com/PyCQA/pylint/issues/4035.
+ """Reported in https://github.com/pylint-dev/pylint/issues/4035.
Parameters
----------
@@ -412,7 +412,7 @@ def test_with_list_of_default_values(arg, option, option2):
def test_with_descriptions_instead_of_typing(arg, axis, option):
"""We choose to accept description in place of typing as well.
- See: https://github.com/PyCQA/pylint/pull/7398.
+ See: https://github.com/pylint-dev/pylint/pull/7398.
Parameters
----------
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py
index a2a2f7c92..36f3aed1f 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py
@@ -220,7 +220,7 @@ def test_finds_args_without_type_sphinx( # [inconsistent-return-statements]
):
r"""The Sphinx docstring
In Sphinx docstrings asterisks should be escaped.
- See https://github.com/PyCQA/pylint/issues/5406
+ See https://github.com/pylint-dev/pylint/issues/5406
:param named_arg: Returned
:type named_arg: object
@@ -239,7 +239,7 @@ def test_finds_kwargs_without_type_sphinx( # [inconsistent-return-statements]
):
r"""The Sphinx docstring
In Sphinx docstrings asterisks should be escaped.
- See https://github.com/PyCQA/pylint/issues/5406
+ See https://github.com/pylint-dev/pylint/issues/5406
:param named_arg: Returned
:type named_arg: object
diff --git a/tests/functional/ext/docparams/raise/missing_raises_doc_options.py b/tests/functional/ext/docparams/raise/missing_raises_doc_options.py
index eb3cd3ac3..5f1ef3969 100644
--- a/tests/functional/ext/docparams/raise/missing_raises_doc_options.py
+++ b/tests/functional/ext/docparams/raise/missing_raises_doc_options.py
@@ -3,7 +3,7 @@ accept-no-raise-doc option is set to True.
Requires at least one matching section (`Docstring.matching_sections`).
-Taken from https://github.com/PyCQA/pylint/issues/7208
+Taken from https://github.com/pylint-dev/pylint/issues/7208
"""
diff --git a/tests/functional/ext/emptystring/empty_string_comparison.py b/tests/functional/ext/emptystring/empty_string_comparison.py
deleted file mode 100644
index b61caeff6..000000000
--- a/tests/functional/ext/emptystring/empty_string_comparison.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# pylint: disable=literal-comparison,missing-docstring
-
-X = ''
-Y = 'test'
-
-if X is '': # [compare-to-empty-string]
- pass
-
-if Y is not "": # [compare-to-empty-string]
- pass
-
-if X == "": # [compare-to-empty-string]
- pass
-
-if Y != '': # [compare-to-empty-string]
- pass
-
-if "" == Y: # [compare-to-empty-string]
- pass
-
-if '' != X: # [compare-to-empty-string]
- pass
diff --git a/tests/functional/ext/emptystring/empty_string_comparison.rc b/tests/functional/ext/emptystring/empty_string_comparison.rc
deleted file mode 100644
index d2826befa..000000000
--- a/tests/functional/ext/emptystring/empty_string_comparison.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-[MAIN]
-load-plugins=pylint.extensions.emptystring,
diff --git a/tests/functional/ext/emptystring/empty_string_comparison.txt b/tests/functional/ext/emptystring/empty_string_comparison.txt
deleted file mode 100644
index be9c91bc5..000000000
--- a/tests/functional/ext/emptystring/empty_string_comparison.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-compare-to-empty-string:6:3:6:10::"""X is ''"" can be simplified to ""not X"" as an empty string is falsey":HIGH
-compare-to-empty-string:9:3:9:14::"""Y is not ''"" can be simplified to ""Y"" as an empty string is falsey":HIGH
-compare-to-empty-string:12:3:12:10::"""X == ''"" can be simplified to ""not X"" as an empty string is falsey":HIGH
-compare-to-empty-string:15:3:15:10::"""Y != ''"" can be simplified to ""Y"" as an empty string is falsey":HIGH
-compare-to-empty-string:18:3:18:10::"""'' == Y"" can be simplified to ""not Y"" as an empty string is falsey":HIGH
-compare-to-empty-string:21:3:21:10::"""'' != X"" can be simplified to ""X"" as an empty string is falsey":HIGH
diff --git a/tests/functional/ext/for_any_all/for_any_all.py b/tests/functional/ext/for_any_all/for_any_all.py
index 649739c37..fb09e491b 100644
--- a/tests/functional/ext/for_any_all/for_any_all.py
+++ b/tests/functional/ext/for_any_all/for_any_all.py
@@ -147,7 +147,7 @@ def is_from_decorator(node):
return False
def optimized_any_with_break(split_lines, max_chars):
- """False negative found in https://github.com/PyCQA/pylint/pull/7697"""
+ """False negative found in https://github.com/pylint-dev/pylint/pull/7697"""
potential_line_length_warning = False
for line in split_lines: # [consider-using-any-or-all]
if len(line) > max_chars:
diff --git a/tests/functional/ext/redefined_loop_name/redefined_loop_name.py b/tests/functional/ext/redefined_loop_name/redefined_loop_name.py
index 0af49f9bf..ed4efcffe 100644
--- a/tests/functional/ext/redefined_loop_name/redefined_loop_name.py
+++ b/tests/functional/ext/redefined_loop_name/redefined_loop_name.py
@@ -1,6 +1,6 @@
"""Tests for redefinitions of loop variables inside the loop body.
-See: https://github.com/PyCQA/pylint/issues/5608
+See: https://github.com/pylint-dev/pylint/issues/5608
"""
# pylint: disable=invalid-name
diff --git a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py
index 1d31bc968..e642ad520 100644
--- a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py
+++ b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py
@@ -86,7 +86,7 @@ def func2(x):
# Test that ``redefined-variable-type`` is not emitted
-# https://github.com/PyCQA/pylint/issues/8120
+# https://github.com/pylint-dev/pylint/issues/8120
async def test_a():
data = [
diff --git a/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py b/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py
index 1e3cb2808..d06bf4751 100644
--- a/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py
+++ b/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py
@@ -1,5 +1,5 @@
"""Regression test for issue 5770: NewType created with f-string
-See: https://github.com/PyCQA/pylint/issues/5770
+See: https://github.com/pylint-dev/pylint/issues/5770
"""
from typing import NewType
diff --git a/tests/functional/ext/typing/typing_consider_using_alias.py b/tests/functional/ext/typing/typing_consider_using_alias.py
index 8fe3b5918..070451cf0 100644
--- a/tests/functional/ext/typing/typing_consider_using_alias.py
+++ b/tests/functional/ext/typing/typing_consider_using_alias.py
@@ -7,7 +7,7 @@ With 'from __future__ import annotations' present.
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unnecessary-direct-lambda-call
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from __future__ import annotations
diff --git a/tests/functional/ext/typing/typing_consider_using_alias_without_future.py b/tests/functional/ext/typing/typing_consider_using_alias_without_future.py
index 943a16188..b597e955e 100644
--- a/tests/functional/ext/typing/typing_consider_using_alias_without_future.py
+++ b/tests/functional/ext/typing/typing_consider_using_alias_without_future.py
@@ -7,7 +7,7 @@
# pylint: disable=unnecessary-direct-lambda-call
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import collections
diff --git a/tests/functional/ext/typing/typing_consider_using_union.py b/tests/functional/ext/typing/typing_consider_using_union.py
index 780a96100..64918175e 100644
--- a/tests/functional/ext/typing/typing_consider_using_union.py
+++ b/tests/functional/ext/typing/typing_consider_using_union.py
@@ -8,7 +8,7 @@ With 'from __future__ import annotations' present.
# pylint: disable=consider-using-alias,unnecessary-direct-lambda-call
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from __future__ import annotations
diff --git a/tests/functional/ext/typing/typing_consider_using_union_without_future.py b/tests/functional/ext/typing/typing_consider_using_union_without_future.py
index d29ba306e..3cad6cb74 100644
--- a/tests/functional/ext/typing/typing_consider_using_union_without_future.py
+++ b/tests/functional/ext/typing/typing_consider_using_union_without_future.py
@@ -7,7 +7,7 @@
# pylint: disable=consider-using-alias
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from dataclasses import dataclass
diff --git a/tests/functional/g/generated_members.py b/tests/functional/g/generated_members.py
index ffb3de631..25afa7598 100644
--- a/tests/functional/g/generated_members.py
+++ b/tests/functional/g/generated_members.py
@@ -20,7 +20,7 @@ session.rollback()
SESSION.rollback()
-# https://github.com/PyCQA/pylint/issues/6594
+# https://github.com/pylint-dev/pylint/issues/6594
# Don't emit no-member inside type annotations
# with PEP 563 'from __future__ import annotations'
print(Klass.X) # [no-member]
diff --git a/tests/functional/g/globals.py b/tests/functional/g/globals.py
index f7a634a3e..7f4e3077e 100644
--- a/tests/functional/g/globals.py
+++ b/tests/functional/g/globals.py
@@ -105,7 +105,7 @@ def init_connection_state(alias):
# Prevent emitting `invalid-name` for the line on which `global` is declared
-# https://github.com/PyCQA/pylint/issues/8307
+# https://github.com/pylint-dev/pylint/issues/8307
_foo: str = "tomato"
def setup_shared_foo():
diff --git a/tests/functional/i/import_error.py b/tests/functional/i/import_error.py
index 12f56f9ea..474a53b5a 100644
--- a/tests/functional/i/import_error.py
+++ b/tests/functional/i/import_error.py
@@ -80,8 +80,14 @@ import foo, bar # [multiple-imports]
import foo
import bar
+import mymodule_ignored
+import mymodule.something_ignored
+from mymodule.something_ignored import anything
+import sys.something_ignored
+from sys.something_ignored import anything
+
# Issues with contextlib.suppress reported in
-# https://github.com/PyCQA/pylint/issues/7270
+# https://github.com/pylint-dev/pylint/issues/7270
import contextlib
with contextlib.suppress(ImportError):
import foo2
diff --git a/tests/functional/i/import_error.rc b/tests/functional/i/import_error.rc
index d8f2b25e2..7278ff8f1 100644
--- a/tests/functional/i/import_error.rc
+++ b/tests/functional/i/import_error.rc
@@ -3,7 +3,7 @@ disable=C,R,W
enable=multiple-imports
[TYPECHECK]
-ignored-modules=external_module,fake_module.submodule,foo,bar
+ignored-modules=external_module,fake_module.submodule,foo,bar,*_ignored
[testoptions]
# TODO: PY3.9: This does pass on PyPy 3.9
diff --git a/tests/functional/i/import_error.txt b/tests/functional/i/import_error.txt
index 80a5732f0..49cc0a673 100644
--- a/tests/functional/i/import_error.txt
+++ b/tests/functional/i/import_error.txt
@@ -3,4 +3,4 @@ import-error:21:4:21:26::Unable to import 'maybe_missing_2':UNDEFINED
no-name-in-module:33:0:33:49::No name 'syntax_error' in module 'functional.s.syntax':UNDEFINED
syntax-error:33:0:None:None::Cannot import 'functional.s.syntax.syntax_error' due to 'invalid syntax (<unknown>, line 1)':HIGH
multiple-imports:78:0:78:15::Multiple imports on one line (foo, bar):UNDEFINED
-import-error:90:4:90:15::Unable to import 'foo2':UNDEFINED
+import-error:96:4:96:15::Unable to import 'foo2':UNDEFINED
diff --git a/tests/functional/i/inconsistent/inconsistent_returns.py b/tests/functional/i/inconsistent/inconsistent_returns.py
index 4e9a68377..bcdfd76e5 100644
--- a/tests/functional/i/inconsistent/inconsistent_returns.py
+++ b/tests/functional/i/inconsistent/inconsistent_returns.py
@@ -336,7 +336,7 @@ def bug_pylint_3873_2():
nothing_to_do()
return False
-# https://github.com/PyCQA/pylint/issues/4019
+# https://github.com/pylint-dev/pylint/issues/4019
def bug_pylint_4019(x):
"""
assert False is equivalent to a return
@@ -355,7 +355,7 @@ def bug_pylint_4019_wrong(x): # [inconsistent-return-statements]
assert True
-# https://github.com/PyCQA/pylint/issues/8280
+# https://github.com/pylint-dev/pylint/issues/8280
class A:
def get_the_answer(self): # [inconsistent-return-statements]
while self.is_running:
diff --git a/tests/functional/i/inference_crash_4692.py b/tests/functional/i/inference_crash_4692.py
index 5e990aaa7..d41ac7a84 100644
--- a/tests/functional/i/inference_crash_4692.py
+++ b/tests/functional/i/inference_crash_4692.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/4692."""
+"""Regression test for https://github.com/pylint-dev/pylint/issues/4692."""
# We can't use click like in the issue because the crash
# does not appear if click is installed (astroid can analyse it)
diff --git a/tests/functional/i/init_not_called.py b/tests/functional/i/init_not_called.py
index ee8c4f5a1..db677dc4b 100644
--- a/tests/functional/i/init_not_called.py
+++ b/tests/functional/i/init_not_called.py
@@ -86,7 +86,7 @@ class Child(Parent):
super().__init__(round(num))
-# https://github.com/PyCQA/pylint/issues/7742
+# https://github.com/pylint-dev/pylint/issues/7742
# Crash when parent class has a class attribute named `__init__`
class NoInitMethod:
__init__ = 42
diff --git a/tests/functional/i/invalid/invalid_all_format.py b/tests/functional/i/invalid/invalid_all/invalid_all_format.py
index 10537c6fb..10537c6fb 100644
--- a/tests/functional/i/invalid/invalid_all_format.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format.py
diff --git a/tests/functional/i/invalid/invalid_all_format.txt b/tests/functional/i/invalid/invalid_all/invalid_all_format.txt
index 2f6ac363b..2f6ac363b 100644
--- a/tests/functional/i/invalid/invalid_all_format.txt
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format.txt
diff --git a/tests/functional/i/invalid/invalid_all_format_valid_1.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_1.py
index f3d8b4361..f3d8b4361 100644
--- a/tests/functional/i/invalid/invalid_all_format_valid_1.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_1.py
diff --git a/tests/functional/i/invalid/invalid_all_format_valid_2.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_2.py
index aa243c65b..aa243c65b 100644
--- a/tests/functional/i/invalid/invalid_all_format_valid_2.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_2.py
diff --git a/tests/functional/i/invalid/invalid_all_format_valid_3.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_3.py
index 3725d055e..3725d055e 100644
--- a/tests/functional/i/invalid/invalid_all_format_valid_3.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_3.py
diff --git a/tests/functional/i/invalid/invalid_all_format_valid_4.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_4.py
index 65a8c384b..65a8c384b 100644
--- a/tests/functional/i/invalid/invalid_all_format_valid_4.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_4.py
diff --git a/tests/functional/i/invalid/invalid_all_format_valid_5.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_5.py
index aa0e4dbf3..aa0e4dbf3 100644
--- a/tests/functional/i/invalid/invalid_all_format_valid_5.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_5.py
diff --git a/tests/functional/i/invalid/invalid_all_format_valid_6.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_6.py
index 64ac46bb7..64ac46bb7 100644
--- a/tests/functional/i/invalid/invalid_all_format_valid_6.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_6.py
diff --git a/tests/functional/i/invalid/invalid_all_object.py b/tests/functional/i/invalid/invalid_all/invalid_all_object.py
index 4468c987b..4468c987b 100644
--- a/tests/functional/i/invalid/invalid_all_object.py
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_object.py
diff --git a/tests/functional/i/invalid/invalid_all_object.txt b/tests/functional/i/invalid/invalid_all/invalid_all_object.txt
index 172fc974c..172fc974c 100644
--- a/tests/functional/i/invalid/invalid_all_object.txt
+++ b/tests/functional/i/invalid/invalid_all/invalid_all_object.txt
diff --git a/tests/functional/i/invalid/invalid_class_object.py b/tests/functional/i/invalid/invalid_class_object.py
index b7363e9c8..8233a3633 100644
--- a/tests/functional/i/invalid/invalid_class_object.py
+++ b/tests/functional/i/invalid/invalid_class_object.py
@@ -40,7 +40,7 @@ class AnotherClass:
class Pylint7429Good:
- """See https://github.com/PyCQA/pylint/issues/7467"""
+ """See https://github.com/pylint-dev/pylint/issues/7467"""
def class_defining_function_good(self):
self.__class__, myvar = AnotherClass, "myvalue"
diff --git a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py
index a0b5ad39f..aa37a4530 100644
--- a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py
+++ b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py
@@ -99,7 +99,7 @@ def reusing_same_name_picks_the_latest_raised_value():
try:
raise ValueError
except exceptions as exc: # pylint: disable=catching-non-exception
- # https://github.com/PyCQA/pylint/issues/1756
+ # https://github.com/pylint-dev/pylint/issues/1756
exc = Error(exc)
if exc:
raise exc
diff --git a/tests/functional/i/invalid/invalid_metaclass.py b/tests/functional/i/invalid/invalid_metaclass.py
index 3b264d693..aba4e6fb1 100644
--- a/tests/functional/i/invalid/invalid_metaclass.py
+++ b/tests/functional/i/invalid/invalid_metaclass.py
@@ -1,7 +1,7 @@
# pylint: disable=missing-docstring, too-few-public-methods, import-error,unused-argument
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import abc
diff --git a/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py b/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py
index f6074eebb..3d3be3180 100644
--- a/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py
+++ b/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py
@@ -2,5 +2,5 @@
"""Regression test for disabling of invalid-name for module names.
-See https://github.com/PyCQA/pylint/issues/3973.
+See https://github.com/pylint-dev/pylint/issues/3973.
"""
diff --git a/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py b/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py
index 9b0dd37cd..678aaf076 100644
--- a/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py
+++ b/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py
@@ -1,4 +1,4 @@
-""" Regression test for https://github.com/PyCQA/pylint/issues/3405. """
+""" Regression test for https://github.com/pylint-dev/pylint/issues/3405. """
import dataclasses
from typing import ClassVar
diff --git a/tests/functional/i/invalid/invalid_overridden_method.py b/tests/functional/i/invalid/invalid_overridden_method.py
index 69af42a0a..d81a7882b 100644
--- a/tests/functional/i/invalid/invalid_overridden_method.py
+++ b/tests/functional/i/invalid/invalid_overridden_method.py
@@ -78,7 +78,7 @@ class AbstractProperty:
return
-# https://github.com/PyCQA/pylint/issues/4368
+# https://github.com/pylint-dev/pylint/issues/4368
# Decrator functions with a nested property decorator should still be
# inferred as property.
diff --git a/tests/functional/i/invalid/invalid_sequence_index.py b/tests/functional/i/invalid/invalid_sequence_index.py
index 56ade211b..e2a3abc7e 100644
--- a/tests/functional/i/invalid/invalid_sequence_index.py
+++ b/tests/functional/i/invalid/invalid_sequence_index.py
@@ -1,7 +1,7 @@
# pylint: disable=too-few-public-methods, import-error, missing-docstring, unnecessary-pass
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import six
diff --git a/tests/functional/i/iterable_context.py b/tests/functional/i/iterable_context.py
index fb035c4df..b36710f28 100644
--- a/tests/functional/i/iterable_context.py
+++ b/tests/functional/i/iterable_context.py
@@ -192,5 +192,5 @@ for elem in HasDynamicGetattr():
pass
-# Regression test for https://github.com/PyCQA/pylint/issues/6372
+# Regression test for https://github.com/pylint-dev/pylint/issues/6372
string_twos = "".join(str(*y) for _, *y in [[1, 2], [1, 2]])
diff --git a/tests/functional/m/member/member_checks_inference_improvements.py b/tests/functional/m/member/member_checks_inference_improvements.py
index 6eefa7958..099048ba0 100644
--- a/tests/functional/m/member/member_checks_inference_improvements.py
+++ b/tests/functional/m/member/member_checks_inference_improvements.py
@@ -2,7 +2,7 @@
def test_oserror_has_strerror():
- # https://github.com/PyCQA/pylint/issues/2553
+ # https://github.com/pylint-dev/pylint/issues/2553
try:
raise OSError()
except OSError as exc:
diff --git a/tests/functional/m/modified_iterating.py b/tests/functional/m/modified_iterating.py
index f17c34b6e..2dae6c106 100644
--- a/tests/functional/m/modified_iterating.py
+++ b/tests/functional/m/modified_iterating.py
@@ -97,7 +97,7 @@ def update_existing_key():
class MyClass:
- """Regression test for https://github.com/PyCQA/pylint/issues/7380"""
+ """Regression test for https://github.com/pylint-dev/pylint/issues/7380"""
def __init__(self) -> None:
self.attribute = [1, 2, 3]
@@ -109,7 +109,7 @@ class MyClass:
class MyClass2:
- """Regression test for https://github.com/PyCQA/pylint/issues/7461"""
+ """Regression test for https://github.com/pylint-dev/pylint/issues/7461"""
def __init__(self) -> None:
self.attribute = {}
diff --git a/tests/functional/n/no/no_member.py b/tests/functional/n/no/no_member.py
index 1db70cde5..a36fc359e 100644
--- a/tests/functional/n/no/no_member.py
+++ b/tests/functional/n/no/no_member.py
@@ -1,7 +1,7 @@
# pylint: disable=missing-docstring, unused-argument, wrong-import-position, invalid-name
from pathlib import Path
-# Regression test for https://github.com/PyCQA/pylint/issues/400
+# Regression test for https://github.com/pylint-dev/pylint/issues/400
class TestListener:
def __init__(self):
self._latest = None
@@ -19,7 +19,7 @@ listener = TestListener()
broker = listener.wait(3).get_domain() # No error here
-# Regression test for https://github.com/PyCQA/pylint/issues/4377
+# Regression test for https://github.com/pylint-dev/pylint/issues/4377
from urllib import parse
url = 'http://www.google.com'
@@ -31,7 +31,7 @@ new_parsed_url = parse.ParseResult._replace(parsed_url, query=sorted_query)
new_url = new_parsed_url.geturl() # No error here
-# Regression test for https://github.com/PyCQA/pylint/issues/3803
+# Regression test for https://github.com/pylint-dev/pylint/issues/3803
# pylint: disable=too-few-public-methods
class Base:
label: str
@@ -44,5 +44,5 @@ class Derived(Base):
print(Derived.label)
-# Regression test for https://github.com/PyCQA/pylint/issues/5832
+# Regression test for https://github.com/pylint-dev/pylint/issues/5832
starter_path = Path(__file__).parents[3].resolve()
diff --git a/tests/functional/n/no/no_member_assign_same_line.py b/tests/functional/n/no/no_member_assign_same_line.py
index 45138d933..230b08109 100644
--- a/tests/functional/n/no/no_member_assign_same_line.py
+++ b/tests/functional/n/no/no_member_assign_same_line.py
@@ -1,5 +1,5 @@
"""Tests for no-member for self-referencing instance attributes
-See https://github.com/PyCQA/pylint/issues/1555
+See https://github.com/pylint-dev/pylint/issues/1555
"""
# pylint: disable=too-few-public-methods
diff --git a/tests/functional/n/no/no_member_augassign.py b/tests/functional/n/no/no_member_augassign.py
index 1ffd9a168..8954861e3 100644
--- a/tests/functional/n/no/no_member_augassign.py
+++ b/tests/functional/n/no/no_member_augassign.py
@@ -1,7 +1,7 @@
"""Tests for no-member in relation to AugAssign operations."""
# pylint: disable=missing-module-docstring, too-few-public-methods, missing-class-docstring, invalid-name
-# Test for: https://github.com/PyCQA/pylint/issues/4562
+# Test for: https://github.com/pylint-dev/pylint/issues/4562
class A:
value: int
diff --git a/tests/functional/n/no/no_member_binary_operations.py b/tests/functional/n/no/no_member_binary_operations.py
index e998932eb..1a15fa2d4 100644
--- a/tests/functional/n/no/no_member_binary_operations.py
+++ b/tests/functional/n/no/no_member_binary_operations.py
@@ -1,7 +1,7 @@
"""Tests for no-member in relation to binary operations."""
# pylint: disable=too-few-public-methods, missing-class-docstring, missing-function-docstring
-# Test for: https://github.com/PyCQA/pylint/issues/4826
+# Test for: https://github.com/pylint-dev/pylint/issues/4826
class MyClass:
def __init__(self):
self.a_list = []
diff --git a/tests/functional/n/no/no_member_dataclasses.py b/tests/functional/n/no/no_member_dataclasses.py
index 97528e698..5f799bf84 100644
--- a/tests/functional/n/no/no_member_dataclasses.py
+++ b/tests/functional/n/no/no_member_dataclasses.py
@@ -3,7 +3,7 @@
# pylint: disable=missing-docstring, too-few-public-methods
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from abc import ABCMeta, abstractmethod
@@ -11,7 +11,7 @@ from dataclasses import asdict, dataclass, field
from typing import Any, Dict
-# https://github.com/PyCQA/pylint/issues/3754
+# https://github.com/pylint-dev/pylint/issues/3754
@dataclass(frozen=True)
class DeploymentState(metaclass=ABCMeta):
type: str
@@ -52,7 +52,7 @@ class DeploymentStateLambda(DeploymentState):
}
-# https://github.com/PyCQA/pylint/issues/2600
+# https://github.com/pylint-dev/pylint/issues/2600
@dataclass
class TestClass:
attr1: str
diff --git a/tests/functional/n/no/no_member_if_statements.py b/tests/functional/n/no/no_member_if_statements.py
index d26c5c483..220d0215a 100644
--- a/tests/functional/n/no/no_member_if_statements.py
+++ b/tests/functional/n/no/no_member_if_statements.py
@@ -40,7 +40,7 @@ class Base:
return str(state)
-# https://github.com/PyCQA/pylint/issues/1990
+# https://github.com/pylint-dev/pylint/issues/1990
# Attribute access after 'isinstance' should not cause 'no-member' error
import subprocess # pylint: disable=wrong-import-position # noqa: E402
@@ -54,7 +54,7 @@ except Exception as err:
raise
-# https://github.com/PyCQA/pylint/issues/4168
+# https://github.com/pylint-dev/pylint/issues/4168
# 'encode' for 'arg' should not cause 'no-member' error
mixed_tuple = (b"a", b"b", b"c", b"d")
byte_tuple = [arg.encode('utf8') if isinstance(arg, str) else arg for arg in mixed_tuple]
@@ -66,7 +66,7 @@ for arg in mixed_tuple:
print(arg)
-# https://github.com/PyCQA/pylint/issues/1162
+# https://github.com/pylint-dev/pylint/issues/1162
# Attribute access after 'isinstance' should not cause 'no-member' error
class FoobarException(Exception):
foobar = None
diff --git a/tests/functional/n/no/no_member_subclassed_dataclasses.py b/tests/functional/n/no/no_member_subclassed_dataclasses.py
index 0dee10840..d121eae36 100644
--- a/tests/functional/n/no/no_member_subclassed_dataclasses.py
+++ b/tests/functional/n/no/no_member_subclassed_dataclasses.py
@@ -2,7 +2,7 @@
# pylint: disable=too-few-public-methods
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from abc import ABCMeta, abstractmethod
diff --git a/tests/functional/n/no/no_name_in_module.py b/tests/functional/n/no/no_name_in_module.py
index 26c0079b6..ef9fb03d1 100644
--- a/tests/functional/n/no/no_name_in_module.py
+++ b/tests/functional/n/no/no_name_in_module.py
@@ -80,7 +80,7 @@ from .no_self_argument.bla import lala1 # [no-name-in-module]
from argparse import THIS_does_not_EXIST
-# This captures the original failure in https://github.com/PyCQA/pylint/issues/6497
+# This captures the original failure in https://github.com/pylint-dev/pylint/issues/6497
# only if numpy is installed. We are not installing numpy on CI (for now)
from numpy.distutils.misc_util import is_sequence
from pydantic import BaseModel
diff --git a/tests/functional/n/none_dunder_protocols.py b/tests/functional/n/none_dunder_protocols.py
index 4f4628634..085615910 100644
--- a/tests/functional/n/none_dunder_protocols.py
+++ b/tests/functional/n/none_dunder_protocols.py
@@ -30,7 +30,7 @@ class MultipleAssignmentNonesClass(metaclass=MetaContainer):
class MultipleAssignmentLambdasClass(metaclass=MetaContainer):
- """https://github.com/PyCQA/pylint/issues/6366"""
+ """https://github.com/pylint-dev/pylint/issues/6366"""
__len__, __iter__ = [lambda x: x] * 2
diff --git a/tests/functional/n/nonlocal_without_binding.py b/tests/functional/n/nonlocal_without_binding.py
index c05a012b1..277c7f7eb 100644
--- a/tests/functional/n/nonlocal_without_binding.py
+++ b/tests/functional/n/nonlocal_without_binding.py
@@ -30,7 +30,7 @@ def func():
# Case where `nonlocal-without-binding` was not emitted when
# the nonlocal name was assigned later in the same scope.
- # https://github.com/PyCQA/pylint/issues/6883
+ # https://github.com/pylint-dev/pylint/issues/6883
def other_func2():
nonlocal c # [nonlocal-without-binding]
c = 1
diff --git a/tests/functional/n/not_callable.py b/tests/functional/n/not_callable.py
index c5015e65f..a0411d39e 100644
--- a/tests/functional/n/not_callable.py
+++ b/tests/functional/n/not_callable.py
@@ -128,7 +128,7 @@ UnknownBaseCallable()()
# Regression test for #4426
# If property is inferable we shouldn't double emit the message
-# See: https://github.com/PyCQA/pylint/issues/4426
+# See: https://github.com/pylint-dev/pylint/issues/4426
class ClassWithProperty:
@property
def value(self):
@@ -137,15 +137,15 @@ class ClassWithProperty:
CLASS_WITH_PROP = ClassWithProperty().value() # [not-callable]
# Test typing.Namedtuple is callable
-# See: https://github.com/PyCQA/pylint/issues/1295
+# See: https://github.com/pylint-dev/pylint/issues/1295
import typing
Named = typing.NamedTuple("Named", [("foo", int), ("bar", int)])
named = Named(1, 2)
-# NamedTuple is callable, even if it aliased to a attribute
-# See https://github.com/PyCQA/pylint/issues/1730
+# NamedTuple is callable, even if it aliased to an attribute
+# See https://github.com/pylint-dev/pylint/issues/1730
class TestNamedTuple:
def __init__(self, field: str) -> None:
self.my_tuple = typing.NamedTuple("Tuple", [(field, int)])
@@ -178,7 +178,7 @@ AggregateCls().a()
# pylint needs to ignore not-callable for them
# right now
-# Test for https://github.com/PyCQA/pylint/issues/1699
+# Test for https://github.com/pylint-dev/pylint/issues/1699
import multiprocessing
@@ -226,7 +226,7 @@ obj2 = Klass2()
obj2.something()
-# Regression test for https://github.com/PyCQA/pylint/issues/7109
+# Regression test for https://github.com/pylint-dev/pylint/issues/7109
instance_or_cls = MyClass # pylint:disable=invalid-name
instance_or_cls = MyClass()
if not isinstance(instance_or_cls, MyClass):
@@ -234,7 +234,7 @@ if not isinstance(instance_or_cls, MyClass):
new()
-# Regression test for https://github.com/PyCQA/pylint/issues/5113.
+# Regression test for https://github.com/pylint-dev/pylint/issues/5113.
# Do not emit `not-callable`.
ATTRIBUTES = {
'DOMAIN': ("domain", str),
diff --git a/tests/functional/o/overridden_final_method_py38.py b/tests/functional/o/overridden_final_method_py38.py
index 252ea3c01..d92b6adc2 100644
--- a/tests/functional/o/overridden_final_method_py38.py
+++ b/tests/functional/o/overridden_final_method_py38.py
@@ -16,7 +16,7 @@ class Subclass(Base):
pass
# Check for crash on method definitions not at top level of class
-# https://github.com/PyCQA/pylint/issues/5648
+# https://github.com/pylint-dev/pylint/issues/5648
class BaseConditional:
create_final_method = True
diff --git a/tests/functional/p/postponed_evaluation_activated.py b/tests/functional/p/postponed/postponed_evaluation_activated.py
index 3492fe5c2..3492fe5c2 100644
--- a/tests/functional/p/postponed_evaluation_activated.py
+++ b/tests/functional/p/postponed/postponed_evaluation_activated.py
diff --git a/tests/functional/p/postponed_evaluation_activated.rc b/tests/functional/p/postponed/postponed_evaluation_activated.rc
index a17bb22da..a17bb22da 100644
--- a/tests/functional/p/postponed_evaluation_activated.rc
+++ b/tests/functional/p/postponed/postponed_evaluation_activated.rc
diff --git a/tests/functional/p/postponed_evaluation_activated_with_alias.py b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.py
index f9899f34a..f9899f34a 100644
--- a/tests/functional/p/postponed_evaluation_activated_with_alias.py
+++ b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.py
diff --git a/tests/functional/p/postponed_evaluation_activated_with_alias.rc b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.rc
index a17bb22da..a17bb22da 100644
--- a/tests/functional/p/postponed_evaluation_activated_with_alias.rc
+++ b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.rc
diff --git a/tests/functional/p/postponed_evaluation_not_activated.py b/tests/functional/p/postponed/postponed_evaluation_not_activated.py
index 76e564a9a..76e564a9a 100644
--- a/tests/functional/p/postponed_evaluation_not_activated.py
+++ b/tests/functional/p/postponed/postponed_evaluation_not_activated.py
diff --git a/tests/functional/p/postponed_evaluation_not_activated.rc b/tests/functional/p/postponed/postponed_evaluation_not_activated.rc
index a17bb22da..a17bb22da 100644
--- a/tests/functional/p/postponed_evaluation_not_activated.rc
+++ b/tests/functional/p/postponed/postponed_evaluation_not_activated.rc
diff --git a/tests/functional/p/postponed_evaluation_not_activated.txt b/tests/functional/p/postponed/postponed_evaluation_not_activated.txt
index 8d9630e04..8d9630e04 100644
--- a/tests/functional/p/postponed_evaluation_not_activated.txt
+++ b/tests/functional/p/postponed/postponed_evaluation_not_activated.txt
diff --git a/tests/functional/p/postponed_evaluation_pep585.py b/tests/functional/p/postponed/postponed_evaluation_pep585.py
index 1d539126d..2317228e5 100644
--- a/tests/functional/p/postponed_evaluation_pep585.py
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585.py
@@ -9,7 +9,7 @@ Testing with 3.8 only, to support TypedDict.
# pylint: disable=unused-variable,unnecessary-direct-lambda-call
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from __future__ import annotations
diff --git a/tests/functional/p/postponed_evaluation_pep585.rc b/tests/functional/p/postponed/postponed_evaluation_pep585.rc
index 35b185fdb..35b185fdb 100644
--- a/tests/functional/p/postponed_evaluation_pep585.rc
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585.rc
diff --git a/tests/functional/p/postponed_evaluation_pep585.txt b/tests/functional/p/postponed/postponed_evaluation_pep585.txt
index 899dc5977..899dc5977 100644
--- a/tests/functional/p/postponed_evaluation_pep585.txt
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585.txt
diff --git a/tests/functional/p/postponed_evaluation_pep585_error.py b/tests/functional/p/postponed/postponed_evaluation_pep585_error.py
index 19153105e..9810c0c14 100644
--- a/tests/functional/p/postponed_evaluation_pep585_error.py
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.py
@@ -9,7 +9,7 @@ Testing with 3.8 only, to support TypedDict.
# pylint: disable=unused-variable,line-too-long,unnecessary-direct-lambda-call
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import collections
diff --git a/tests/functional/p/postponed_evaluation_pep585_error.rc b/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc
index 35b185fdb..35b185fdb 100644
--- a/tests/functional/p/postponed_evaluation_pep585_error.rc
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc
diff --git a/tests/functional/p/postponed_evaluation_pep585_error.txt b/tests/functional/p/postponed/postponed_evaluation_pep585_error.txt
index 406081dfa..406081dfa 100644
--- a/tests/functional/p/postponed_evaluation_pep585_error.txt
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.txt
diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.py b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.py
index 5354e081f..5354e081f 100644
--- a/tests/functional/p/postponed_evaluation_pep585_py39.py
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.py
diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.rc b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.rc
index 16b75eea7..16b75eea7 100644
--- a/tests/functional/p/postponed_evaluation_pep585_py39.rc
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.rc
diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.txt b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.txt
index 127e252a5..127e252a5 100644
--- a/tests/functional/p/postponed_evaluation_pep585_py39.txt
+++ b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.txt
diff --git a/tests/functional/r/recursion/recursion_error_2667.py b/tests/functional/r/recursion/recursion_error_2667.py
index 585cf7f2f..62868c3c6 100644
--- a/tests/functional/r/recursion/recursion_error_2667.py
+++ b/tests/functional/r/recursion/recursion_error_2667.py
@@ -1,4 +1,4 @@
-"""Add regression test for https://github.com/PyCQA/pylint/issues/2667"""
+"""Add regression test for https://github.com/pylint-dev/pylint/issues/2667"""
# pylint: disable=missing-docstring, too-few-public-methods
class MyClass:
diff --git a/tests/functional/r/recursion/recursion_error_2906.py b/tests/functional/r/recursion/recursion_error_2906.py
index 6b4b08d5f..b18d27315 100644
--- a/tests/functional/r/recursion/recursion_error_2906.py
+++ b/tests/functional/r/recursion/recursion_error_2906.py
@@ -1,4 +1,4 @@
-"""Recursion error for https://github.com/PyCQA/pylint/issues/2906"""
+"""Recursion error for https://github.com/pylint-dev/pylint/issues/2906"""
# pylint: disable=disallowed-name,global-statement,invalid-name,missing-docstring
lst = []
diff --git a/tests/functional/r/recursion/recursion_error_3159.py b/tests/functional/r/recursion/recursion_error_3159.py
index 086cce769..d905ad862 100644
--- a/tests/functional/r/recursion/recursion_error_3159.py
+++ b/tests/functional/r/recursion/recursion_error_3159.py
@@ -1,6 +1,6 @@
"""Check that we do not crash with a recursion error
-https://github.com/PyCQA/pylint/issues/3159
+https://github.com/pylint-dev/pylint/issues/3159
"""
# pylint: disable=missing-docstring
from setuptools import Command, find_packages, setup
diff --git a/tests/functional/r/recursion/recursion_error_crash.py b/tests/functional/r/recursion/recursion_error_crash.py
index 208bc2e7a..5500428b4 100644
--- a/tests/functional/r/recursion/recursion_error_crash.py
+++ b/tests/functional/r/recursion/recursion_error_crash.py
@@ -1,6 +1,6 @@
"""Test that a recursion error does not happen
-https://github.com/PyCQA/pylint/issues/2463
+https://github.com/pylint-dev/pylint/issues/2463
"""
import os
diff --git a/tests/functional/r/recursion/recursion_error_crash_2683.py b/tests/functional/r/recursion/recursion_error_crash_2683.py
index 05978a355..17335de2b 100644
--- a/tests/functional/r/recursion/recursion_error_crash_2683.py
+++ b/tests/functional/r/recursion/recursion_error_crash_2683.py
@@ -1,4 +1,4 @@
-"""Test for https://github.com/PyCQA/pylint/issues/2683"""
+"""Test for https://github.com/pylint-dev/pylint/issues/2683"""
# pylint: disable=missing-docstring,too-few-public-methods
class Cls:
diff --git a/tests/functional/r/recursion/recursion_error_crash_astroid_623.py b/tests/functional/r/recursion/recursion_error_crash_astroid_623.py
index 662da6145..e73ff42c5 100644
--- a/tests/functional/r/recursion/recursion_error_crash_astroid_623.py
+++ b/tests/functional/r/recursion/recursion_error_crash_astroid_623.py
@@ -1,6 +1,6 @@
"""Test that a recursion error does not happen
-https://github.com/PyCQA/astroid/issues/623
+https://github.com/pylint-dev/astroid/issues/623
"""
from os import path
diff --git a/tests/functional/r/redefined/redefined_except_handler.py b/tests/functional/r/redefined/redefined_except_handler.py
index 47591034a..b774e32f2 100644
--- a/tests/functional/r/redefined/redefined_except_handler.py
+++ b/tests/functional/r/redefined/redefined_except_handler.py
@@ -1,6 +1,6 @@
"""Tests for except handlers that shadow outer except handlers or exceptions.
-See: https://github.com/PyCQA/pylint/issues/5370
+See: https://github.com/pylint-dev/pylint/issues/5370
"""
try:
@@ -60,7 +60,7 @@ except ImportError as err:
class CustomException(Exception):
- """https://github.com/PyCQA/pylint/issues/4434"""
+ """https://github.com/pylint-dev/pylint/issues/4434"""
def func():
diff --git a/tests/functional/r/redefined/redefined_slots.py b/tests/functional/r/redefined/redefined_slots.py
index 28f05fbfd..fbeda46e1 100644
--- a/tests/functional/r/redefined/redefined_slots.py
+++ b/tests/functional/r/redefined/redefined_slots.py
@@ -33,7 +33,7 @@ class Subclass3(Base, Base2):
__slots__ = ("a", "b", "c", "i", "j", "k", "l", "m", "n") # [redefined-slots-in-subclass]
-# https://github.com/PyCQA/pylint/issues/6100
+# https://github.com/pylint-dev/pylint/issues/6100
class MyClass:
"""No crash when the type of the slot is not a Const or a str"""
__slots__ = [str]
diff --git a/tests/functional/r/redundant_unittest_assert.py b/tests/functional/r/redundant_unittest_assert.py
index aa4120831..0bc2d69dd 100644
--- a/tests/functional/r/redundant_unittest_assert.py
+++ b/tests/functional/r/redundant_unittest_assert.py
@@ -7,7 +7,7 @@ a warning message.
# pylint: disable=missing-docstring,too-few-public-methods
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import unittest
diff --git a/tests/functional/r/regression/regression_3416_unused_argument_raise.py b/tests/functional/r/regression/regression_3416_unused_argument_raise.py
index 9bc761701..175afaf3d 100644
--- a/tests/functional/r/regression/regression_3416_unused_argument_raise.py
+++ b/tests/functional/r/regression/regression_3416_unused_argument_raise.py
@@ -1,6 +1,6 @@
"""Test that we emit unused-argument when a function uses `raise
-https://github.com/PyCQA/pylint/issues/3416
+https://github.com/pylint-dev/pylint/issues/3416
"""
# pylint:disable=raise-missing-from
diff --git a/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py b/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py
index 4dba85545..c55b460ce 100644
--- a/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py
+++ b/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py
@@ -1,5 +1,5 @@
"""
-https://github.com/PyCQA/pylint/issues/3507
+https://github.com/pylint-dev/pylint/issues/3507
False-positive 'isinstance-second-argument-not-valid-type'
for typing aliases in 'isinstance' calls.
"""
diff --git a/tests/functional/r/regression/regression_3535_double_enum_inherit.py b/tests/functional/r/regression/regression_3535_double_enum_inherit.py
index 374b5f860..7b5f40348 100644
--- a/tests/functional/r/regression/regression_3535_double_enum_inherit.py
+++ b/tests/functional/r/regression/regression_3535_double_enum_inherit.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,invalid-name
-# https://github.com/PyCQA/pylint/issues/3535
+# https://github.com/pylint-dev/pylint/issues/3535
import enum
diff --git a/tests/functional/r/regression/regression_3595_notcallable_collections.py b/tests/functional/r/regression/regression_3595_notcallable_collections.py
index 120b26a04..4c50d1f18 100644
--- a/tests/functional/r/regression/regression_3595_notcallable_collections.py
+++ b/tests/functional/r/regression/regression_3595_notcallable_collections.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,unused-import
-# https://github.com/PyCQA/pylint/issues/3595
+# https://github.com/pylint-dev/pylint/issues/3595
import collections
diff --git a/tests/functional/r/regression/regression_4221_object_instanceattr.py b/tests/functional/r/regression/regression_4221_object_instanceattr.py
index 4c346b145..6599bf249 100644
--- a/tests/functional/r/regression/regression_4221_object_instanceattr.py
+++ b/tests/functional/r/regression/regression_4221_object_instanceattr.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring
-# https://github.com/PyCQA/pylint/issues/4221
+# https://github.com/pylint-dev/pylint/issues/4221
import random
o = object()
diff --git a/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py b/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py
index 63a9d7749..9f3b6d4b6 100644
--- a/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py
+++ b/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py
@@ -1,5 +1,5 @@
# pylint: disable=pointless-statement,missing-docstring
-# https://github.com/PyCQA/pylint/issues/4358
+# https://github.com/pylint-dev/pylint/issues/4358
from enum import Enum
diff --git a/tests/functional/r/regression/regression_4439.py b/tests/functional/r/regression/regression_4439.py
index dd9c39253..3dc60cf9c 100644
--- a/tests/functional/r/regression/regression_4439.py
+++ b/tests/functional/r/regression/regression_4439.py
@@ -2,7 +2,7 @@
# pylint: disable=missing-docstring
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from typing import Optional
diff --git a/tests/functional/r/regression/regression_6531_crash_index_error.py b/tests/functional/r/regression/regression_6531_crash_index_error.py
index 6cdc96617..cfcfd8e60 100644
--- a/tests/functional/r/regression/regression_6531_crash_index_error.py
+++ b/tests/functional/r/regression/regression_6531_crash_index_error.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/6531."""
+"""Regression test for https://github.com/pylint-dev/pylint/issues/6531."""
# pylint: disable=missing-docstring, redefined-outer-name
diff --git a/tests/functional/r/regression/regression_issue_4633.py b/tests/functional/r/regression/regression_issue_4633.py
index 0bd48ad54..b2a8f7c90 100644
--- a/tests/functional/r/regression/regression_issue_4633.py
+++ b/tests/functional/r/regression/regression_issue_4633.py
@@ -1,7 +1,7 @@
# pylint: disable=missing-docstring,too-few-public-methods
"""
-Regression tests for https://github.com/PyCQA/pylint/issues/4633
+Regression tests for https://github.com/pylint-dev/pylint/issues/4633
"""
from queue import Queue
diff --git a/tests/functional/r/regression/regression_no_member_1078.py b/tests/functional/r/regression/regression_no_member_1078.py
index b7be27d3c..191ba7751 100644
--- a/tests/functional/r/regression/regression_no_member_1078.py
+++ b/tests/functional/r/regression/regression_no_member_1078.py
@@ -1,6 +1,6 @@
"""Make sure no-member is not emitted when modifying __doc__ via augmented assignment
-https://github.com/PyCQA/pylint/issues/1078
+https://github.com/pylint-dev/pylint/issues/1078
"""
# pylint: disable=too-few-public-methods,missing-class-docstring
class Cls:
diff --git a/tests/functional/r/regression/regression_property_no_member_2641.py b/tests/functional/r/regression/regression_property_no_member_2641.py
index 083f78bdc..dd87726e6 100644
--- a/tests/functional/r/regression/regression_property_no_member_2641.py
+++ b/tests/functional/r/regression/regression_property_no_member_2641.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,unused-argument,too-few-public-methods
-# https://github.com/PyCQA/pylint/issues/2641
+# https://github.com/pylint-dev/pylint/issues/2641
from abc import ABCMeta, abstractmethod
diff --git a/tests/functional/r/regression/regression_property_no_member_844.py b/tests/functional/r/regression/regression_property_no_member_844.py
index 759b7bfe3..279d7b250 100644
--- a/tests/functional/r/regression/regression_property_no_member_844.py
+++ b/tests/functional/r/regression/regression_property_no_member_844.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,too-few-public-methods,invalid-overridden-method
-# https://github.com/PyCQA/pylint/issues/844
+# https://github.com/pylint-dev/pylint/issues/844
class Parent:
def __init__(self):
self.__thing = 'foo'
diff --git a/tests/functional/r/regression/regression_property_no_member_870.py b/tests/functional/r/regression/regression_property_no_member_870.py
index e89ae169e..500b217f9 100644
--- a/tests/functional/r/regression/regression_property_no_member_870.py
+++ b/tests/functional/r/regression/regression_property_no_member_870.py
@@ -1,5 +1,5 @@
# pylint: disable=too-few-public-methods,invalid-name,missing-docstring
-# https://github.com/PyCQA/pylint/issues/870
+# https://github.com/pylint-dev/pylint/issues/870
class X:
def __init__(self, val=None):
diff --git a/tests/functional/r/regression_02/regression_2567.py b/tests/functional/r/regression_02/regression_2567.py
index fe5c3f25a..7de293bfb 100644
--- a/tests/functional/r/regression_02/regression_2567.py
+++ b/tests/functional/r/regression_02/regression_2567.py
@@ -1,6 +1,6 @@
"""
Regression test for `no-member`.
-See: https://github.com/PyCQA/pylint/issues/2567
+See: https://github.com/pylint-dev/pylint/issues/2567
"""
# pylint: disable=missing-docstring,too-few-public-methods
diff --git a/tests/functional/r/regression_02/regression_2964.py b/tests/functional/r/regression_02/regression_2964.py
index 66235fc09..ad8433091 100644
--- a/tests/functional/r/regression_02/regression_2964.py
+++ b/tests/functional/r/regression_02/regression_2964.py
@@ -1,6 +1,6 @@
"""
Regression test for `no-member`.
-See: https://github.com/PyCQA/pylint/issues/2964
+See: https://github.com/pylint-dev/pylint/issues/2964
"""
# pylint: disable=missing-class-docstring,too-few-public-methods
diff --git a/tests/functional/r/regression_02/regression_3976.py b/tests/functional/r/regression_02/regression_3976.py
index 3610e9e30..27c119d47 100644
--- a/tests/functional/r/regression_02/regression_3976.py
+++ b/tests/functional/r/regression_02/regression_3976.py
@@ -1,5 +1,5 @@
"""
-Regression test for https://github.com/PyCQA/pylint/issues/3976
+Regression test for https://github.com/pylint-dev/pylint/issues/3976
E1123: Unexpected keyword argument 'include_extras' in function call (unexpected-keyword-arg)
"""
diff --git a/tests/functional/r/regression_02/regression_3979.py b/tests/functional/r/regression_02/regression_3979.py
index 7cc74a4f5..e14c5edb5 100644
--- a/tests/functional/r/regression_02/regression_3979.py
+++ b/tests/functional/r/regression_02/regression_3979.py
@@ -1,5 +1,5 @@
"""
-Regression test for https://github.com/PyCQA/pylint/issues/3979
+Regression test for https://github.com/pylint-dev/pylint/issues/3979
"""
import os
diff --git a/tests/functional/r/regression_02/regression_4660.py b/tests/functional/r/regression_02/regression_4660.py
index 872ed6ca2..b3dee058f 100644
--- a/tests/functional/r/regression_02/regression_4660.py
+++ b/tests/functional/r/regression_02/regression_4660.py
@@ -1,4 +1,4 @@
-"""Regression tests for https://github.com/PyCQA/pylint/issues/4660"""
+"""Regression tests for https://github.com/pylint-dev/pylint/issues/4660"""
# pylint: disable=useless-return, unused-argument
# pylint: disable=missing-docstring, too-few-public-methods, invalid-name
diff --git a/tests/functional/r/regression_02/regression_4982.py b/tests/functional/r/regression_02/regression_4982.py
index a6cef6f9e..27e8d08a1 100644
--- a/tests/functional/r/regression_02/regression_4982.py
+++ b/tests/functional/r/regression_02/regression_4982.py
@@ -1,4 +1,4 @@
-"""Regression test for a crash reported in https://github.com/PyCQA/pylint/issues/4982"""
+"""Regression test for a crash reported in https://github.com/pylint-dev/pylint/issues/4982"""
# pylint: disable=too-few-public-methods
class Base:
diff --git a/tests/functional/r/regression_02/regression_5030.py b/tests/functional/r/regression_02/regression_5030.py
index 8aa22f879..46842dc68 100644
--- a/tests/functional/r/regression_02/regression_5030.py
+++ b/tests/functional/r/regression_02/regression_5030.py
@@ -1,11 +1,11 @@
"""Regression in astroid on ClassDef inference with two test cases.
-Fixed in https://github.com/PyCQA/astroid/pull/1181"""
+Fixed in https://github.com/pylint-dev/astroid/pull/1181"""
from typing import Tuple, Type
from typing import Dict, List, Any
from dataclasses import dataclass, field
-# https://github.com/PyCQA/pylint/issues/5030
+# https://github.com/pylint-dev/pylint/issues/5030
def is_type_list(f_type: Type) -> bool:
"""just here to show the issue"""
return f_type == list
@@ -13,7 +13,7 @@ def is_type_list(f_type: Type) -> bool:
assert not is_type_list(Tuple)
-# https://github.com/PyCQA/pylint/issues/5036
+# https://github.com/pylint-dev/pylint/issues/5036
@dataclass
class SomeData:
"""A dataclass."""
diff --git a/tests/functional/r/regression_02/regression_5048.py b/tests/functional/r/regression_02/regression_5048.py
index 08ff55fb2..9cf11baf7 100644
--- a/tests/functional/r/regression_02/regression_5048.py
+++ b/tests/functional/r/regression_02/regression_5048.py
@@ -1,9 +1,9 @@
"""Crash regression in astroid on Compare node inference
-Fixed in https://github.com/PyCQA/astroid/pull/1185"""
+Fixed in https://github.com/pylint-dev/astroid/pull/1185"""
# pylint: disable=missing-docstring, broad-exception-raised
-# Reported at https://github.com/PyCQA/pylint/issues/5048
+# Reported at https://github.com/pylint-dev/pylint/issues/5048
def func(parameter):
if tuple() + (parameter[1],) in set():
raise Exception()
diff --git a/tests/functional/r/regression_02/regression_5244.py b/tests/functional/r/regression_02/regression_5244.py
index 248c4a4a1..1bc811ca5 100644
--- a/tests/functional/r/regression_02/regression_5244.py
+++ b/tests/functional/r/regression_02/regression_5244.py
@@ -1,5 +1,5 @@
"""Test for the regression on inference of self referential __len__
-Reported in https://github.com/PyCQA/pylint/issues/5244
+Reported in https://github.com/pylint-dev/pylint/issues/5244
"""
# pylint: disable=missing-class-docstring, missing-function-docstring
diff --git a/tests/functional/r/regression_02/regression_5408.py b/tests/functional/r/regression_02/regression_5408.py
index b9bcdb9e8..93dcc81e1 100644
--- a/tests/functional/r/regression_02/regression_5408.py
+++ b/tests/functional/r/regression_02/regression_5408.py
@@ -1,7 +1,7 @@
"""Regression test for issue 5408.
Recursion error for self-referencing class attribute.
-See: https://github.com/PyCQA/pylint/issues/5408
+See: https://github.com/pylint-dev/pylint/issues/5408
"""
# pylint: disable=missing-docstring, too-few-public-methods, invalid-name, inherit-non-class
diff --git a/tests/functional/r/regression_02/regression_5461.py b/tests/functional/r/regression_02/regression_5461.py
index 39daf7b9b..9344782c0 100644
--- a/tests/functional/r/regression_02/regression_5461.py
+++ b/tests/functional/r/regression_02/regression_5461.py
@@ -1,6 +1,6 @@
"""Regression test for issue 5461
Crash on list comprehension with it used `type` as variable name
-See: https://github.com/PyCQA/pylint/issues/5461
+See: https://github.com/pylint-dev/pylint/issues/5461
"""
var = [type for type in [] if type["id"]]
diff --git a/tests/functional/r/regression_02/regression_5479.py b/tests/functional/r/regression_02/regression_5479.py
index adc20f26c..9955ea680 100644
--- a/tests/functional/r/regression_02/regression_5479.py
+++ b/tests/functional/r/regression_02/regression_5479.py
@@ -1,5 +1,5 @@
"""Test for a regression on slots and annotated assignments.
-Reported in https://github.com/PyCQA/pylint/issues/5479
+Reported in https://github.com/pylint-dev/pylint/issues/5479
"""
# pylint: disable=too-few-public-methods, unused-private-member, missing-class-docstring, missing-function-docstring
diff --git a/tests/functional/r/regression_02/regression_5776.py b/tests/functional/r/regression_02/regression_5776.py
index 5e8342511..00be9ad46 100644
--- a/tests/functional/r/regression_02/regression_5776.py
+++ b/tests/functional/r/regression_02/regression_5776.py
@@ -1,6 +1,6 @@
"""Test for a regression with Enums not being recognized when imported with an alias.
-Reported in https://github.com/PyCQA/pylint/issues/5776
+Reported in https://github.com/pylint-dev/pylint/issues/5776
"""
from enum import Enum as PyEnum
diff --git a/tests/functional/r/regression_02/regression_5801.py b/tests/functional/r/regression_02/regression_5801.py
index 8c08ec675..8b6c18ec8 100644
--- a/tests/functional/r/regression_02/regression_5801.py
+++ b/tests/functional/r/regression_02/regression_5801.py
@@ -1,4 +1,4 @@
-# https://github.com/PyCQA/pylint/issues/5801
+# https://github.com/pylint-dev/pylint/issues/5801
# pylint: disable=missing-docstring
import struct
diff --git a/tests/functional/r/regression_02/regression_8109.py b/tests/functional/r/regression_02/regression_8109.py
index f5cf8b142..69af0356a 100644
--- a/tests/functional/r/regression_02/regression_8109.py
+++ b/tests/functional/r/regression_02/regression_8109.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/8109."""
+"""Regression test for https://github.com/pylint-dev/pylint/issues/8109."""
# pylint: disable=missing-docstring, unsupported-binary-operation
diff --git a/tests/functional/r/regression_02/regression_8109.txt b/tests/functional/r/regression_02/regression_8109.txt
index 161925b7d..b3166d608 100644
--- a/tests/functional/r/regression_02/regression_8109.txt
+++ b/tests/functional/r/regression_02/regression_8109.txt
@@ -1 +1 @@
-consider-using-f-string:14:24:14:34:Number.__str__:Formatting a regular string which could be a f-string:UNDEFINED
+consider-using-f-string:14:24:14:34:Number.__str__:Formatting a regular string which could be an f-string:UNDEFINED
diff --git a/tests/functional/r/regression_02/regression_distutil_import_error_73.py b/tests/functional/r/regression_02/regression_distutil_import_error_73.py
index d40c0973f..ddd96b65e 100644
--- a/tests/functional/r/regression_02/regression_distutil_import_error_73.py
+++ b/tests/functional/r/regression_02/regression_distutil_import_error_73.py
@@ -1,10 +1,10 @@
"""
Regression test to check that distutils can be imported
-See https://github.com/PyCQA/pylint/issues/73
+See https://github.com/pylint-dev/pylint/issues/73
See also:
-https://github.com/PyCQA/pylint/issues/2955
-https://github.com/PyCQA/astroid/pull/1321
+https://github.com/pylint-dev/pylint/issues/2955
+https://github.com/pylint-dev/astroid/pull/1321
"""
# pylint: disable=unused-import, deprecated-module
diff --git a/tests/functional/r/regression_02/regression_enum_1734.py b/tests/functional/r/regression_02/regression_enum_1734.py
index 06759c7d3..128ab81e5 100644
--- a/tests/functional/r/regression_02/regression_enum_1734.py
+++ b/tests/functional/r/regression_02/regression_enum_1734.py
@@ -1,6 +1,6 @@
-# Regression test for https://github.com/PyCQA/astroid/pull/1734
+# Regression test for https://github.com/pylint-dev/astroid/pull/1734
# The following should lint just fine
-# Fixed in https://github.com/PyCQA/astroid/pull/1743
+# Fixed in https://github.com/pylint-dev/astroid/pull/1743
# pylint: disable=missing-docstring,invalid-name
diff --git a/tests/functional/r/regression_02/regression_no_member_7631.py b/tests/functional/r/regression_02/regression_no_member_7631.py
index 758aad057..6329187f7 100644
--- a/tests/functional/r/regression_02/regression_no_member_7631.py
+++ b/tests/functional/r/regression_02/regression_no_member_7631.py
@@ -1,4 +1,4 @@
-"""Regression test from https://github.com/PyCQA/pylint/issues/7631
+"""Regression test from https://github.com/pylint-dev/pylint/issues/7631
The following code should NOT raise no-member.
"""
# pylint: disable=missing-docstring,too-few-public-methods
diff --git a/tests/functional/r/regression_02/regression_node_statement_two.py b/tests/functional/r/regression_02/regression_node_statement_two.py
index b54ed99bb..ad4afd947 100644
--- a/tests/functional/r/regression_02/regression_node_statement_two.py
+++ b/tests/functional/r/regression_02/regression_node_statement_two.py
@@ -1,6 +1,6 @@
"""Test to see we don't crash on this code in pandas.
See: https://github.com/pandas-dev/pandas/blob/master/pandas/core/indexes/period.py
-Reported in https://github.com/PyCQA/pylint/issues/5382
+Reported in https://github.com/pylint-dev/pylint/issues/5382
"""
# pylint: disable=missing-function-docstring, missing-class-docstring, unused-argument
# pylint: disable=too-few-public-methods, no-method-argument, invalid-name
diff --git a/tests/functional/r/regression/regression_property_slots_2439.py b/tests/functional/r/regression_02/regression_property_slots_2439.py
index 91cf86cfd..43882b3ac 100644
--- a/tests/functional/r/regression/regression_property_slots_2439.py
+++ b/tests/functional/r/regression_02/regression_property_slots_2439.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
-# https://github.com/PyCQA/pylint/issues/2439
+# https://github.com/pylint-dev/pylint/issues/2439
class TestClass:
__slots__ = ["_i"]
diff --git a/tests/functional/r/regression_02/regression_too_many_arguments_2335.py b/tests/functional/r/regression_02/regression_too_many_arguments_2335.py
index 55aa87308..896bb320e 100644
--- a/tests/functional/r/regression_02/regression_too_many_arguments_2335.py
+++ b/tests/functional/r/regression_02/regression_too_many_arguments_2335.py
@@ -1,6 +1,6 @@
"""Test that `abc.ABCMeta.__new__` does not trigger too-many-function-arguments when referred
-https://github.com/PyCQA/pylint/issues/2335
+https://github.com/pylint-dev/pylint/issues/2335
"""
# pylint: disable=missing-class-docstring,unused-argument,arguments-differ
from abc import ABCMeta
diff --git a/tests/functional/s/singledispatch_functions.py b/tests/functional/s/singledispatch/singledispatch_functions.py
index 931bfd30d..931bfd30d 100644
--- a/tests/functional/s/singledispatch_functions.py
+++ b/tests/functional/s/singledispatch/singledispatch_functions.py
diff --git a/tests/functional/s/singledispatch_functions.txt b/tests/functional/s/singledispatch/singledispatch_functions.txt
index 93fc30496..93fc30496 100644
--- a/tests/functional/s/singledispatch_functions.txt
+++ b/tests/functional/s/singledispatch/singledispatch_functions.txt
diff --git a/tests/functional/s/singledispatch_method.txt b/tests/functional/s/singledispatch/singledispatch_method.txt
index c747fb6a8..c747fb6a8 100644
--- a/tests/functional/s/singledispatch_method.txt
+++ b/tests/functional/s/singledispatch/singledispatch_method.txt
diff --git a/tests/functional/s/singledispatch_method_py37.py b/tests/functional/s/singledispatch/singledispatch_method_py37.py
index c9269f7bf..c9269f7bf 100644
--- a/tests/functional/s/singledispatch_method_py37.py
+++ b/tests/functional/s/singledispatch/singledispatch_method_py37.py
diff --git a/tests/functional/s/singledispatch/singledispatch_method_py37.rc b/tests/functional/s/singledispatch/singledispatch_method_py37.rc
new file mode 100644
index 000000000..77eb3be64
--- /dev/null
+++ b/tests/functional/s/singledispatch/singledispatch_method_py37.rc
@@ -0,0 +1,2 @@
+[main]
+py-version=3.7
diff --git a/tests/functional/s/singledispatch_method_py37.txt b/tests/functional/s/singledispatch/singledispatch_method_py37.txt
index 111bc4722..111bc4722 100644
--- a/tests/functional/s/singledispatch_method_py37.txt
+++ b/tests/functional/s/singledispatch/singledispatch_method_py37.txt
diff --git a/tests/functional/s/singledispatch_method_py38.py b/tests/functional/s/singledispatch/singledispatch_method_py38.py
index ad8eea1dd..ad8eea1dd 100644
--- a/tests/functional/s/singledispatch_method_py38.py
+++ b/tests/functional/s/singledispatch/singledispatch_method_py38.py
diff --git a/tests/functional/s/singledispatchmethod_function_py38.rc b/tests/functional/s/singledispatch/singledispatch_method_py38.rc
index 85fc502b3..85fc502b3 100644
--- a/tests/functional/s/singledispatchmethod_function_py38.rc
+++ b/tests/functional/s/singledispatch/singledispatch_method_py38.rc
diff --git a/tests/functional/s/singledispatch_method_py38.txt b/tests/functional/s/singledispatch/singledispatch_method_py38.txt
index c747fb6a8..c747fb6a8 100644
--- a/tests/functional/s/singledispatch_method_py38.txt
+++ b/tests/functional/s/singledispatch/singledispatch_method_py38.txt
diff --git a/tests/functional/s/singledispatchmethod_function_py38.py b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.py
index ef44f71c1..ef44f71c1 100644
--- a/tests/functional/s/singledispatchmethod_function_py38.py
+++ b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.py
diff --git a/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc
new file mode 100644
index 000000000..85fc502b3
--- /dev/null
+++ b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc
@@ -0,0 +1,2 @@
+[testoptions]
+min_pyver=3.8
diff --git a/tests/functional/s/singledispatchmethod_function_py38.txt b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.txt
index 4c236b346..4c236b346 100644
--- a/tests/functional/s/singledispatchmethod_function_py38.txt
+++ b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.txt
diff --git a/tests/functional/s/singledispatch_method_py37.rc b/tests/functional/s/singledispatch_method_py37.rc
deleted file mode 100644
index 67a28a36a..000000000
--- a/tests/functional/s/singledispatch_method_py37.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-[testoptions]
-max_pyver=3.8
diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.rc b/tests/functional/s/star/star_needs_assignment_target_py37.rc
deleted file mode 100644
index 67a28a36a..000000000
--- a/tests/functional/s/star/star_needs_assignment_target_py37.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-[testoptions]
-max_pyver=3.8
diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.py b/tests/functional/s/star/star_needs_assignment_target_py38.py
index fb5eea86a..fb5eea86a 100644
--- a/tests/functional/s/star/star_needs_assignment_target_py37.py
+++ b/tests/functional/s/star/star_needs_assignment_target_py38.py
diff --git a/tests/functional/s/star/star_needs_assignment_target_py38.rc b/tests/functional/s/star/star_needs_assignment_target_py38.rc
new file mode 100644
index 000000000..d584aa959
--- /dev/null
+++ b/tests/functional/s/star/star_needs_assignment_target_py38.rc
@@ -0,0 +1,2 @@
+[testoptions]
+max_pyver=3.9
diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.txt b/tests/functional/s/star/star_needs_assignment_target_py38.txt
index fb5a5faa6..fb5a5faa6 100644
--- a/tests/functional/s/star/star_needs_assignment_target_py37.txt
+++ b/tests/functional/s/star/star_needs_assignment_target_py38.txt
diff --git a/tests/functional/s/stop_iteration_inside_generator.py b/tests/functional/s/stop_iteration_inside_generator.py
index efde61a77..fcd20a683 100644
--- a/tests/functional/s/stop_iteration_inside_generator.py
+++ b/tests/functional/s/stop_iteration_inside_generator.py
@@ -100,25 +100,25 @@ def gen_dont_crash_on_no_exception():
def gen_dont_crash_on_uninferable():
- # https://github.com/PyCQA/pylint/issues/1779
+ # https://github.com/pylint-dev/pylint/issues/1779
yield from iter()
raise asyncio.TimeoutError()
-# https://github.com/PyCQA/pylint/issues/1830
+# https://github.com/pylint-dev/pylint/issues/1830
def gen_next_with_sentinel():
yield next([], 42) # No bad return
from itertools import count, cycle
-# https://github.com/PyCQA/pylint/issues/2158
+# https://github.com/pylint-dev/pylint/issues/2158
def generator_using_next():
counter = count()
number = next(counter)
yield number * 2
-# https://github.com/PyCQA/pylint/issues/7765
+# https://github.com/pylint-dev/pylint/issues/7765
def infinite_iterator_itertools_cycle():
counter = cycle('ABCD')
val = next(counter)
@@ -179,7 +179,7 @@ def other_safeiter(it):
def data(filename):
"""
Ensure pylint doesn't crash if `next` is incorrectly called without args
- See https://github.com/PyCQA/pylint/issues/7828
+ See https://github.com/pylint-dev/pylint/issues/7828
"""
with open(filename, encoding="utf8") as file:
next() # attempt to skip header but this is incorrect code
diff --git a/tests/functional/s/subclassed_final_class_py38.py b/tests/functional/s/subclassed_final_class_py38.py
index a4621d532..76f4d617e 100644
--- a/tests/functional/s/subclassed_final_class_py38.py
+++ b/tests/functional/s/subclassed_final_class_py38.py
@@ -4,7 +4,7 @@ subclassed."""
# pylint: disable=missing-docstring, too-few-public-methods
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from typing import final
diff --git a/tests/functional/s/super/super_checks.py b/tests/functional/s/super/super_checks.py
index 050fd3c81..2c8515b12 100644
--- a/tests/functional/s/super/super_checks.py
+++ b/tests/functional/s/super/super_checks.py
@@ -99,7 +99,7 @@ class InvalidSuperChecks(BaseClass):
-# Regression for PyCQA/pylint/issues/773
+# Regression for pylint-dev/pylint/issues/773
import subprocess
# The problem was related to astroid not filtering statements
@@ -125,7 +125,7 @@ class SuperWithSelfClass:
super(self.__class__, self).__init__() # [bad-super-call]
-# Reported in https://github.com/PyCQA/pylint/issues/2903
+# Reported in https://github.com/pylint-dev/pylint/issues/2903
class Parent:
def method(self):
print()
@@ -149,7 +149,7 @@ class GrandChild(Child):
super(Niece, self).method() # [bad-super-call]
-# Reported in https://github.com/PyCQA/pylint/issues/4922
+# Reported in https://github.com/pylint-dev/pylint/issues/4922
class AlabamaCousin(Child, Niece):
def method(self):
print("AlabamaCousin")
diff --git a/tests/functional/s/super/super_init_not_called.py b/tests/functional/s/super/super_init_not_called.py
index f0bfe0329..03bfd3b43 100644
--- a/tests/functional/s/super/super_init_not_called.py
+++ b/tests/functional/s/super/super_init_not_called.py
@@ -52,14 +52,14 @@ class ChildThree(ParentWithoutInit):
# Regression test as reported in
-# https://github.com/PyCQA/pylint/issues/6027
+# https://github.com/pylint-dev/pylint/issues/6027
class MyUnion(ctypes.Union):
def __init__(self):
pass
# Should not be called on abstract __init__ methods
-# https://github.com/PyCQA/pylint/issues/3975
+# https://github.com/pylint-dev/pylint/issues/3975
class Base:
def __init__(self, param: int, param_two: str) -> None:
raise NotImplementedError()
diff --git a/tests/functional/s/sys_stream_regression_1004.py b/tests/functional/s/sys_stream_regression_1004.py
index c0391859d..546552af9 100644
--- a/tests/functional/s/sys_stream_regression_1004.py
+++ b/tests/functional/s/sys_stream_regression_1004.py
@@ -1,4 +1,4 @@
-'''Regression for issue https://github.com/PyCQA/pylint/issues/1004'''
+'''Regression for issue https://github.com/pylint-dev/pylint/issues/1004'''
# pylint: disable=missing-docstring, pointless-statement
import sys
diff --git a/tests/functional/t/too/too_few_public_methods_37.py b/tests/functional/t/too/too_few_public_methods_37.py
index 3b63a8fec..db9c9f171 100644
--- a/tests/functional/t/too/too_few_public_methods_37.py
+++ b/tests/functional/t/too/too_few_public_methods_37.py
@@ -1,7 +1,7 @@
# pylint: disable=missing-docstring
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
import dataclasses
diff --git a/tests/functional/t/too/too_many_ancestors.py b/tests/functional/t/too/too_many_ancestors.py
index a460e4f16..cd83492b3 100644
--- a/tests/functional/t/too/too_many_ancestors.py
+++ b/tests/functional/t/too/too_many_ancestors.py
@@ -25,8 +25,8 @@ class Jjjj(Iiii): # [too-many-ancestors]
pass
-# https://github.com/PyCQA/pylint/issues/4166
-# https://github.com/PyCQA/pylint/issues/4415
+# https://github.com/pylint-dev/pylint/issues/4166
+# https://github.com/pylint-dev/pylint/issues/4415
class ItemSequence(MutableSequence):
"""Minimal MutableSequence."""
def __getitem__(self, key):
diff --git a/tests/functional/t/too/too_many_arguments.py b/tests/functional/t/too/too_many_arguments.py
index 8d26902af..f4a668f53 100644
--- a/tests/functional/t/too/too_many_arguments.py
+++ b/tests/functional/t/too/too_many_arguments.py
@@ -26,7 +26,7 @@ def root_function(first, second, third):
def func_call():
- """Test we don't emit a FP for https://github.com/PyCQA/pylint/issues/2588"""
+ """Test we don't emit a FP for https://github.com/pylint-dev/pylint/issues/2588"""
partial_func = partial(root_function, 1, 2, 3)
partial_func()
return root_function(1, 2, 3)
diff --git a/tests/functional/t/too/too_many_function_args.py b/tests/functional/t/too/too_many_function_args.py
index c5ca4f78e..9ba49565e 100644
--- a/tests/functional/t/too/too_many_function_args.py
+++ b/tests/functional/t/too/too_many_function_args.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/3675"""
+"""https://github.com/pylint-dev/pylint/issues/3675"""
def noop(x): # pylint: disable=invalid-name
diff --git a/tests/functional/t/too/too_many_instance_attributes.py b/tests/functional/t/too/too_many_instance_attributes.py
index 3177dc8aa..a41f3ea88 100644
--- a/tests/functional/t/too/too_many_instance_attributes.py
+++ b/tests/functional/t/too/too_many_instance_attributes.py
@@ -1,7 +1,7 @@
# pylint: disable=missing-docstring, too-few-public-methods
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
diff --git a/tests/functional/t/too/too_many_instance_attributes_py37.py b/tests/functional/t/too/too_many_instance_attributes_py37.py
index 152bb1ca2..1ab262b87 100644
--- a/tests/functional/t/too/too_many_instance_attributes_py37.py
+++ b/tests/functional/t/too/too_many_instance_attributes_py37.py
@@ -6,7 +6,7 @@ Default max_instance_attributes is 7
# pylint: disable=missing-docstring, too-few-public-methods
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from dataclasses import dataclass, InitVar
diff --git a/tests/functional/t/trailing_whitespaces.py b/tests/functional/t/trailing_whitespaces.py
index c88b7ea62..9866398ee 100644
--- a/tests/functional/t/trailing_whitespaces.py
+++ b/tests/functional/t/trailing_whitespaces.py
@@ -9,7 +9,7 @@ print('windows line ends are ok')
# +1: [trailing-whitespace]
print('but trailing whitespace on win is not')
-# Regression test for https://github.com/PyCQA/pylint/issues/6936
+# Regression test for https://github.com/pylint-dev/pylint/issues/6936
# +2: [trailing-whitespace]
""" This module has the Board class.
"""
@@ -19,7 +19,7 @@ print('but trailing whitespace on win is not')
It's a very nice Board.
"""
-# Regression test for https://github.com/PyCQA/pylint/issues/3822
+# Regression test for https://github.com/pylint-dev/pylint/issues/3822
def example(*args):
"""Example function."""
print(*args)
diff --git a/tests/functional/t/typealias_naming_style_default.py b/tests/functional/t/typealias_naming_style_default.py
index 8baabb49c..6a2c81569 100644
--- a/tests/functional/t/typealias_naming_style_default.py
+++ b/tests/functional/t/typealias_naming_style_default.py
@@ -31,3 +31,14 @@ x: Union[str, int] = 42
y: Union[str, int]
# But the following, using a good TypeAlias name, is:
GoodTypeAliasToUnion: TypeAlias = Union[str, int]
+
+
+def my_function():
+ """My doc."""
+ LocalGoodName: TypeAlias = int
+ local_bad_name: TypeAlias = int # [invalid-name]
+ local_declaration: Union[str, int]
+ LocalTypeAliasToUnion: TypeAlias = Union[str, int]
+ local_declaration = 1
+ del local_declaration
+ del LocalGoodName, local_bad_name, LocalTypeAliasToUnion
diff --git a/tests/functional/t/typealias_naming_style_default.txt b/tests/functional/t/typealias_naming_style_default.txt
index 455cbc213..24090841f 100644
--- a/tests/functional/t/typealias_naming_style_default.txt
+++ b/tests/functional/t/typealias_naming_style_default.txt
@@ -9,3 +9,4 @@ invalid-name:23:0:23:9::"Type alias name ""_BAD_NAME"" doesn't conform to predef
invalid-name:24:0:24:10::"Type alias name ""__BAD_NAME"" doesn't conform to predefined naming style":HIGH
invalid-name:25:0:25:9::"Type alias name ""_1BadName"" doesn't conform to predefined naming style":HIGH
invalid-name:26:0:26:14::"Type alias name ""ANOTHERBADNAME"" doesn't conform to predefined naming style":HIGH
+invalid-name:39:4:39:18:my_function:"Type alias name ""local_bad_name"" doesn't conform to predefined naming style":HIGH
diff --git a/tests/functional/t/typedDict.py b/tests/functional/t/typedDict.py
index 3ce96b256..31cad0b28 100644
--- a/tests/functional/t/typedDict.py
+++ b/tests/functional/t/typedDict.py
@@ -25,7 +25,7 @@ my_dict["var"]
my_dict["var"] = 2
-# https://github.com/PyCQA/pylint/issues/4715
+# https://github.com/pylint-dev/pylint/issues/4715
# Instance of TypedDict should be callable
Link = TypedDict("Link", {"href": str})
Link(href="foo")
diff --git a/tests/functional/t/typing_generic.py b/tests/functional/t/typing_generic.py
index 4b2985e0d..66b8ce4fc 100644
--- a/tests/functional/t/typing_generic.py
+++ b/tests/functional/t/typing_generic.py
@@ -1,6 +1,6 @@
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
-# https://github.com/PyCQA/pylint/issues/2822
+# https://github.com/pylint-dev/pylint/issues/2822
# Base should be subscriptable, even with ABCMeta as metaclass
from abc import ABC, ABCMeta
from typing import Generic, TypeVar
@@ -14,7 +14,7 @@ class Impl(Base[str]):
"""Impl"""
-# https://github.com/PyCQA/astroid/issues/942
+# https://github.com/pylint-dev/astroid/issues/942
Anything = TypeVar("Anything")
MoreSpecific = TypeVar("MoreSpecific", str, int)
diff --git a/tests/functional/u/unbalanced_dict_unpacking.py b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.py
index 2c4d3b103..2c4d3b103 100644
--- a/tests/functional/u/unbalanced_dict_unpacking.py
+++ b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.py
diff --git a/tests/functional/u/unbalanced_dict_unpacking.txt b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt
index b31d89b40..b31d89b40 100644
--- a/tests/functional/u/unbalanced_dict_unpacking.txt
+++ b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt
diff --git a/tests/functional/u/unbalanced_tuple_unpacking.py b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py
index 226748933..21e497be8 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking.py
+++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py
@@ -158,5 +158,5 @@ a, b = my_function("12") # [unbalanced-tuple-unpacking]
c = my_function("12")
d, *_ = my_function("12")
-# https://github.com/PyCQA/pylint/issues/5998
+# https://github.com/pylint-dev/pylint/issues/5998
x, y, z = (1, 2) # [unbalanced-tuple-unpacking]
diff --git a/tests/functional/u/unbalanced_tuple_unpacking.txt b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt
index 651e09840..651e09840 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking.txt
+++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt
diff --git a/tests/functional/u/unbalanced_tuple_unpacking_py30.py b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py
index c45cccdd1..c45cccdd1 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking_py30.py
+++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py
diff --git a/tests/functional/u/undefined/undefined_loop_variable.py b/tests/functional/u/undefined/undefined_loop_variable.py
index 9d5cf4111..10d6dc60b 100644
--- a/tests/functional/u/undefined/undefined_loop_variable.py
+++ b/tests/functional/u/undefined/undefined_loop_variable.py
@@ -1,11 +1,6 @@
# pylint: disable=missing-docstring,redefined-builtin, consider-using-f-string, unnecessary-direct-lambda-call, broad-exception-raised
-import sys
-
-if sys.version_info >= (3, 8):
- from typing import NoReturn
-else:
- from typing_extensions import NoReturn
+from typing import NoReturn
def do_stuff(some_random_list):
@@ -84,7 +79,7 @@ def do_stuff_with_redefined_range():
def test(content):
- # https://github.com/PyCQA/pylint/issues/3711
+ # https://github.com/pylint-dev/pylint/issues/3711
def handle_line(layne):
if "X" in layne:
layne = layne.replace("X", "Y")
@@ -160,7 +155,7 @@ bigger = [
def lambda_in_first_of_two_loops():
- """https://github.com/PyCQA/pylint/issues/6419"""
+ """https://github.com/pylint-dev/pylint/issues/6419"""
my_list = []
for thing in my_list:
print_it = lambda: print(thing) # pylint: disable=cell-var-from-loop, unnecessary-lambda-assignment
@@ -180,21 +175,21 @@ def variable_name_assigned_in_body_of_second_loop():
def use_enumerate():
- """https://github.com/PyCQA/pylint/issues/6593"""
+ """https://github.com/pylint-dev/pylint/issues/6593"""
for i, num in enumerate(range(3)):
pass
print(i, num)
def use_enumerate_in_ternary_expression():
- """https://github.com/PyCQA/pylint/issues/7131"""
+ """https://github.com/pylint-dev/pylint/issues/7131"""
for i, num in enumerate(range(3)) if __revision__ else enumerate(range(4)):
pass
print(i, num)
def find_even_number(container):
- """https://github.com/PyCQA/pylint/pull/6923#discussion_r895134495"""
+ """https://github.com/pylint-dev/pylint/pull/6923#discussion_r895134495"""
for something in container:
if something % 2 == 0:
break
diff --git a/tests/functional/u/undefined/undefined_loop_variable.txt b/tests/functional/u/undefined/undefined_loop_variable.txt
index e10c9e002..78dc602ed 100644
--- a/tests/functional/u/undefined/undefined_loop_variable.txt
+++ b/tests/functional/u/undefined/undefined_loop_variable.txt
@@ -1,4 +1,4 @@
-undefined-loop-variable:14:11:14:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED
-undefined-loop-variable:33:7:33:11::Using possibly undefined loop variable 'var1':UNDEFINED
-undefined-loop-variable:83:11:83:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED
-undefined-loop-variable:201:11:201:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED
+undefined-loop-variable:9:11:9:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED
+undefined-loop-variable:28:7:28:11::Using possibly undefined loop variable 'var1':UNDEFINED
+undefined-loop-variable:78:11:78:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED
+undefined-loop-variable:196:11:196:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED
diff --git a/tests/functional/u/undefined/undefined_loop_variable_py38.py b/tests/functional/u/undefined/undefined_loop_variable_py38.py
index 5778df7d2..f9bd06f62 100644
--- a/tests/functional/u/undefined/undefined_loop_variable_py38.py
+++ b/tests/functional/u/undefined/undefined_loop_variable_py38.py
@@ -2,7 +2,7 @@
def walrus_in_comprehension_test(container):
- """https://github.com/PyCQA/pylint/issues/7222"""
+ """https://github.com/pylint-dev/pylint/issues/7222"""
for something in container:
print(something)
print([my_test for something in container if (my_test := something)])
diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py
index 78a32dacc..e1b66910f 100644
--- a/tests/functional/u/undefined/undefined_variable.py
+++ b/tests/functional/u/undefined/undefined_variable.py
@@ -203,7 +203,7 @@ def dec(inp):
# referencing parent class do not raise undefined variable
# because at the time of their calling, the class name will
# be populated
-# See https://github.com/PyCQA/pylint/issues/704
+# See https://github.com/pylint-dev/pylint/issues/704
class LambdaClass:
myattr = 1
mylambda = lambda: LambdaClass.myattr
@@ -346,7 +346,7 @@ def decorated4(x):
print(x)
-# https://github.com/PyCQA/pylint/issues/5111
+# https://github.com/pylint-dev/pylint/issues/5111
# AssignAttr in orelse block of 'TYPE_CHECKING' shouldn't crash
# Name being assigned must be imported in orelse block
if TYPE_CHECKING:
diff --git a/tests/functional/u/undefined/undefined_variable.txt b/tests/functional/u/undefined/undefined_variable.txt
index ab1a00420..b41f9ae46 100644
--- a/tests/functional/u/undefined/undefined_variable.txt
+++ b/tests/functional/u/undefined/undefined_variable.txt
@@ -27,7 +27,7 @@ undefined-variable:166:4:166:13::Undefined variable 'unicode_2':UNDEFINED
undefined-variable:171:4:171:13::Undefined variable 'unicode_3':UNDEFINED
undefined-variable:226:25:226:37:LambdaClass4.<lambda>:Undefined variable 'LambdaClass4':UNDEFINED
undefined-variable:234:25:234:37:LambdaClass5.<lambda>:Undefined variable 'LambdaClass5':UNDEFINED
-used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:HIGH
+used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:CONTROL_FLOW
undefined-variable:291:18:291:24:not_using_loop_variable_accordingly:Undefined variable 'iteree':UNDEFINED
undefined-variable:308:27:308:28:undefined_annotation:Undefined variable 'x':UNDEFINED
used-before-assignment:309:7:309:8:undefined_annotation:Using variable 'x' before assignment:HIGH
diff --git a/tests/functional/u/undefined/undefined_variable_classes.py b/tests/functional/u/undefined/undefined_variable_classes.py
index 364e24942..64d0007a5 100644
--- a/tests/functional/u/undefined/undefined_variable_classes.py
+++ b/tests/functional/u/undefined/undefined_variable_classes.py
@@ -2,7 +2,7 @@
# pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods
# Test that list comprehensions in base classes are scoped correctly
-# Regression reported in https://github.com/PyCQA/pylint/issues/3434
+# Regression reported in https://github.com/pylint-dev/pylint/issues/3434
import collections
@@ -14,7 +14,7 @@ class Foo(collections.namedtuple("Foo", [x + "_foo" for x in l])):
# Test that class attributes are in scope for return type annotations.
-# Regression reported in https://github.com/PyCQA/pylint/issues/1976
+# Regression reported in https://github.com/pylint-dev/pylint/issues/1976
class MyObject:
class MyType:
pass
diff --git a/tests/functional/u/undefined/undefined_variable_decorators.py b/tests/functional/u/undefined/undefined_variable_decorators.py
index 359737289..77c0b1229 100644
--- a/tests/functional/u/undefined/undefined_variable_decorators.py
+++ b/tests/functional/u/undefined/undefined_variable_decorators.py
@@ -3,7 +3,7 @@
# pylint: disable=unnecessary-comprehension
# Test that class attributes are in scope for listcomp in decorator.
-# Regression reported in https://github.com/PyCQA/pylint/issues/511
+# Regression reported in https://github.com/pylint-dev/pylint/issues/511
def dec(inp):
def inner(func):
diff --git a/tests/functional/u/undefined/undefined_variable_py30.py b/tests/functional/u/undefined/undefined_variable_py30.py
index ff77aaf8e..723e275a0 100644
--- a/tests/functional/u/undefined/undefined_variable_py30.py
+++ b/tests/functional/u/undefined/undefined_variable_py30.py
@@ -87,7 +87,7 @@ def used_before_assignment(*, arg): return arg + 1
# Test for #4021
-# https://github.com/PyCQA/pylint/issues/4021
+# https://github.com/pylint-dev/pylint/issues/4021
class MetaClass(type):
def __new__(mcs, *args, parameter=None, **kwargs):
print(parameter)
@@ -99,7 +99,7 @@ class InheritingClass(metaclass=MetaClass, parameter=variable): # [undefined-va
# Test for #4031
-# https://github.com/PyCQA/pylint/issues/4031
+# https://github.com/pylint-dev/pylint/issues/4031
class Inheritor(metaclass=DefinedTooLate ): # [undefined-variable]
pass
diff --git a/tests/functional/u/undefined/undefined_variable_py38.py b/tests/functional/u/undefined/undefined_variable_py38.py
index 6fb543e80..1f69a18a8 100644
--- a/tests/functional/u/undefined/undefined_variable_py38.py
+++ b/tests/functional/u/undefined/undefined_variable_py38.py
@@ -120,7 +120,7 @@ sorted_things = sorted(
# Tests for type annotation reused in comprehension
def type_annotation_used_after_comprehension():
- """https://github.com/PyCQA/pylint/issues/5326#issuecomment-982635371"""
+ """https://github.com/pylint-dev/pylint/issues/5326#issuecomment-982635371"""
my_int: int
ints = [my_int + 1 for my_int in range(5)]
@@ -129,13 +129,13 @@ def type_annotation_used_after_comprehension():
def type_annotation_unused_after_comprehension():
- """https://github.com/PyCQA/pylint/issues/5326"""
+ """https://github.com/pylint-dev/pylint/issues/5326"""
my_int: int
_ = [print(sep=my_int, end=my_int) for my_int in range(10)]
def type_annotation_used_improperly_after_comprehension():
- """https://github.com/PyCQA/pylint/issues/5654"""
+ """https://github.com/pylint-dev/pylint/issues/5654"""
my_int: int
_ = [print(sep=my_int, end=my_int) for my_int in range(10)]
print(my_int) # [used-before-assignment]
diff --git a/tests/functional/u/undefined/undefined_variable_typing.py b/tests/functional/u/undefined/undefined_variable_typing.py
index 7ef4d8599..fda65ceca 100644
--- a/tests/functional/u/undefined/undefined_variable_typing.py
+++ b/tests/functional/u/undefined/undefined_variable_typing.py
@@ -2,7 +2,7 @@
# pylint: disable=invalid-name, import-error
# Ensure attribute lookups in type comments are accounted for.
-# Reported in https://github.com/PyCQA/pylint/issues/4603
+# Reported in https://github.com/pylint-dev/pylint/issues/4603
from typing import TYPE_CHECKING, Any, Dict
@@ -16,12 +16,12 @@ c = ... # type: Bar.Boo
if TYPE_CHECKING:
__additional_builtin__: Dict[str, Any]
- # For why this would emit redefined-builtin: https://github.com/PyCQA/pylint/pull/3643
+ # For why this would emit redefined-builtin: https://github.com/pylint-dev/pylint/pull/3643
# pylint: disable-next=redefined-builtin
repr: Any
def run():
- """https://github.com/PyCQA/pylint/issues/6388"""
+ """https://github.com/pylint-dev/pylint/issues/6388"""
print(repr)
return __additional_builtin__["test"]
diff --git a/tests/functional/u/unexpected_special_method_signature.py b/tests/functional/u/unexpected_special_method_signature.py
index e2ae33857..146308b03 100644
--- a/tests/functional/u/unexpected_special_method_signature.py
+++ b/tests/functional/u/unexpected_special_method_signature.py
@@ -128,7 +128,7 @@ class ThirdGoodContextManager:
# unexpected-special-method-signature
-# https://github.com/PyCQA/pylint/issues/6644
+# https://github.com/pylint-dev/pylint/issues/6644
class Philosopher:
def __init_subclass__(cls, default_name, **kwargs):
super().__init_subclass__(**kwargs)
diff --git a/tests/functional/u/ungrouped_imports.py b/tests/functional/u/ungrouped_imports.py
index ace3a8e3f..b94fbeef9 100644
--- a/tests/functional/u/ungrouped_imports.py
+++ b/tests/functional/u/ungrouped_imports.py
@@ -26,7 +26,7 @@ from unittest import TestCase
from unittest.mock import MagicMock
-# https://github.com/PyCQA/pylint/issues/3382
+# https://github.com/pylint-dev/pylint/issues/3382
# Imports in a `if TYPE_CHECKING` block should not trigger `ungrouped-imports`
from typing import TYPE_CHECKING
if TYPE_CHECKING:
diff --git a/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py
index 74bf4e611..e02df87e3 100644
--- a/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py
+++ b/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py
@@ -73,7 +73,7 @@ for item in d.items():
# Test false positive described in #4630
-# (https://github.com/PyCQA/pylint/issues/4630)
+# (https://github.com/pylint-dev/pylint/issues/4630)
d = {'key': 'value'}
@@ -90,7 +90,7 @@ for k, _ in d.items():
# Test false positive described in #4716
# Should not be emitted for del
-# (https://github.com/PyCQA/pylint/issues/4716)
+# (https://github.com/pylint-dev/pylint/issues/4716)
d = {}
for key, val in d.items():
del d[key]
@@ -107,25 +107,25 @@ for key, val in outer_dict.items():
break
# Test partial unpacking of items
-# https://github.com/PyCQA/pylint/issues/5504
+# https://github.com/pylint-dev/pylint/issues/5504
d = {}
for key, in d.items():
print(d[key])
# Test subscripting an attribute
-# https://github.com/PyCQA/pylint/issues/6557
+# https://github.com/pylint-dev/pylint/issues/6557
f = Foo()
for input_output in d.items():
f.input_output = input_output # pylint: disable=attribute-defined-outside-init
print(d[f.input_output[0]])
-# Regression test for https://github.com/PyCQA/pylint/issues/6788
+# Regression test for https://github.com/pylint-dev/pylint/issues/6788
d = {'a': 1, 'b': 2, 'c': 3}
for key, val in d.items():
([d[key], x], y) = ([1, 2], 3)
-# Regression test for https://github.com/PyCQA/pylint/issues/6818
+# Regression test for https://github.com/pylint-dev/pylint/issues/6818
d = {'a': 1, 'b': 2, 'c': 3}
for key, val in d.items():
while d[key] > 0:
diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
index c46fd323a..081c4beda 100644
--- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py
+++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
@@ -123,7 +123,7 @@ def func1(val1, _):
def func2(val1, val2):
"""Ignore if ellipsis is used on comparisons.
- See https://github.com/PyCQA/pylint/issues/6071."""
+ See https://github.com/pylint-dev/pylint/issues/6071."""
if val1 is not ... and val2:
pass
diff --git a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py
index ec5ee22c2..9e99388d8 100644
--- a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py
+++ b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py
@@ -45,16 +45,16 @@ result = [val for idx, val in enumerate(my_list) if idx > 0 and my_list[idx - 1]
result = [val for idx, val in enumerate(my_list) if other_list[idx] == 'a']
result = [my_list[idx] for idx, val in enumerate(my_list)] # [unnecessary-list-index-lookup]
-# Regression test for https://github.com/PyCQA/pylint/issues/6049
+# Regression test for https://github.com/pylint-dev/pylint/issues/6049
pairs = [(0, 0)]
for i, (a, b) in enumerate(pairs):
print(pairs[i][0])
-# Regression test for https://github.com/PyCQA/pylint/issues/6603
+# Regression test for https://github.com/pylint-dev/pylint/issues/6603
for i, num in enumerate(): # raises TypeError, but shouldn't crash pylint
pass
-# Regression test for https://github.com/PyCQA/pylint/issues/6788
+# Regression test for https://github.com/pylint-dev/pylint/issues/6788
num_list = [1, 2, 3]
for a, b in enumerate(num_list):
num_list[a], _ = (2, 1)
@@ -63,7 +63,7 @@ num_list = [1, 2, 3]
for a, b in enumerate(num_list):
([x, num_list[a]], _) = ([5, 6], 1)
-# Regression test for https://github.com/PyCQA/pylint/issues/6818
+# Regression test for https://github.com/pylint-dev/pylint/issues/6818
updated_list = [1, 2, 3]
for idx, val in enumerate(updated_list):
while updated_list[idx] > 0:
@@ -75,14 +75,14 @@ for idx, val in enumerate(updated_list):
updated_list[idx] -= 1
print(updated_list[idx])
-# Regression test for https://github.com/PyCQA/pylint/issues/6896
+# Regression test for https://github.com/pylint-dev/pylint/issues/6896
parts = ["a", "b", "c", "d"]
for i, part in enumerate(parts):
if i == 3: # more complex condition actually
parts.insert(i, "X")
print(part, parts[i])
-# regression tests for https://github.com/PyCQA/pylint/issues/7682
+# regression tests for https://github.com/pylint-dev/pylint/issues/7682
series = [1, 2, 3, 4, 5]
output_list = [
(item, series[index])
diff --git a/tests/functional/u/unpacking/unpacking_non_sequence_py37.py b/tests/functional/u/unpacking/unpacking_non_sequence_py37.py
index 13ab35b9a..3a1e3700a 100644
--- a/tests/functional/u/unpacking/unpacking_non_sequence_py37.py
+++ b/tests/functional/u/unpacking/unpacking_non_sequence_py37.py
@@ -1,11 +1,11 @@
"""
-https://github.com/PyCQA/pylint/issues/4895
+https://github.com/pylint-dev/pylint/issues/4895
"""
# pylint: disable=missing-docstring
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from __future__ import annotations
diff --git a/tests/functional/u/unreachable.py b/tests/functional/u/unreachable.py
index 0211a6136..e59ad218f 100644
--- a/tests/functional/u/unreachable.py
+++ b/tests/functional/u/unreachable.py
@@ -25,7 +25,7 @@ def func4():
return 1 / 0 # [unreachable]
-# https://github.com/PyCQA/pylint/issues/4698
+# https://github.com/pylint-dev/pylint/issues/4698
def func5():
"""Empty generator functions should be allowed."""
return
diff --git a/tests/functional/u/unspecified_encoding_py38.py b/tests/functional/u/unspecified_encoding_py38.py
index 66b8523f4..6afdab92a 100644
--- a/tests/functional/u/unspecified_encoding_py38.py
+++ b/tests/functional/u/unspecified_encoding_py38.py
@@ -87,7 +87,7 @@ Path(FILENAME).open("w", encoding=LOCALE_ENCODING)
# Tests for storing data about open calls.
# Most of these are regression tests for a crash
-# reported in https://github.com/PyCQA/pylint/issues/5321
+# reported in https://github.com/pylint-dev/pylint/issues/5321
# -- Constants
MODE = "wb"
@@ -126,7 +126,7 @@ open(FILENAME, mode=IOData.mode)
open(FILENAME, mode=IOData().my_mode)
open(FILENAME, mode=IOData().my_mode_method())
open(FILENAME, mode=IOData().my_mode_method_returner("wb"))
-# Invalid value but shouldn't crash, reported in https://github.com/PyCQA/pylint/issues/5321
+# Invalid value but shouldn't crash, reported in https://github.com/pylint-dev/pylint/issues/5321
open(FILENAME, mode=IOData)
@@ -141,7 +141,7 @@ class IOArgs:
args_good_one = IOArgs(encoding=None, mode="wb")
-# Test for crash reported in https://github.com/PyCQA/pylint/issues/5321
+# Test for crash reported in https://github.com/pylint-dev/pylint/issues/5321
open(FILENAME, args_good_one.mode, encoding=args_good_one.encoding)
# Positional arguments
@@ -157,8 +157,8 @@ Path(FILENAME).read_text() # [unspecified-encoding]
Path(FILENAME).write_text("string", "utf-8")
Path(FILENAME).write_text("string") # [unspecified-encoding]
-# Test for crash reported in https://github.com/PyCQA/pylint/issues/5731
+# Test for crash reported in https://github.com/pylint-dev/pylint/issues/5731
open(FILENAME, mode=None) # [bad-open-mode, unspecified-encoding]
-# Test for crash reported in https://github.com/PyCQA/pylint/issues/6414
+# Test for crash reported in https://github.com/pylint-dev/pylint/issues/6414
open('foo', mode=2) # [bad-open-mode, unspecified-encoding]
diff --git a/tests/functional/u/unsubscriptable_object.py b/tests/functional/u/unsubscriptable_object.py
index 0b7da78b3..4f21871d0 100644
--- a/tests/functional/u/unsubscriptable_object.py
+++ b/tests/functional/u/unsubscriptable_object.py
@@ -1,7 +1,7 @@
"""Tests for unscubscriptable-object"""
# Test for typing.NamedTuple
-# See: https://github.com/PyCQA/pylint/issues/1295
+# See: https://github.com/pylint-dev/pylint/issues/1295
import typing
MyType = typing.Tuple[str, str]
diff --git a/tests/functional/u/unused/unused_argument.py b/tests/functional/u/unused/unused_argument.py
index 69c37feef..1d072f21b 100644
--- a/tests/functional/u/unused/unused_argument.py
+++ b/tests/functional/u/unused/unused_argument.py
@@ -94,7 +94,7 @@ class BBBB:
self.spam = 1
-# Regression test for https://github.com/PyCQA/pylint/issues/5771
+# Regression test for https://github.com/pylint-dev/pylint/issues/5771
# involving keyword-only arguments
class Ancestor:
def __init__(self):
diff --git a/tests/functional/u/unused/unused_import.py b/tests/functional/u/unused/unused_import.py
index 0abc7bf4d..c3d596b24 100644
--- a/tests/functional/u/unused/unused_import.py
+++ b/tests/functional/u/unused/unused_import.py
@@ -105,7 +105,7 @@ class WithMetaclass(six.with_metaclass(ABCMeta)):
Requires six."""
-# Regression test for https://github.com/PyCQA/pylint/issues/3765
+# Regression test for https://github.com/pylint-dev/pylint/issues/3765
# `unused-import` should not be emitted when a type annotation uses quotation marks
from typing import List
diff --git a/tests/functional/u/unused/unused_import_class_def_keyword.py b/tests/functional/u/unused/unused_import_class_def_keyword.py
index 0d6b59987..161d33cdb 100644
--- a/tests/functional/u/unused/unused_import_class_def_keyword.py
+++ b/tests/functional/u/unused/unused_import_class_def_keyword.py
@@ -1,7 +1,7 @@
"""
Test false-positive for unused-import on class keyword arguments
- https://github.com/PyCQA/pylint/issues/3202
+ https://github.com/pylint-dev/pylint/issues/3202
"""
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name,import-error
diff --git a/tests/functional/u/unused/unused_import_everything_disabled.py b/tests/functional/u/unused/unused_import_everything_disabled.py
index 381cd012f..3c7d6c9ec 100644
--- a/tests/functional/u/unused/unused_import_everything_disabled.py
+++ b/tests/functional/u/unused/unused_import_everything_disabled.py
@@ -1,7 +1,7 @@
"""Test that unused-import is not emitted here when everything else is disabled
-https://github.com/PyCQA/pylint/issues/3445
-https://github.com/PyCQA/pylint/issues/6089
+https://github.com/pylint-dev/pylint/issues/3445
+https://github.com/pylint-dev/pylint/issues/6089
"""
from math import e, pi
from os import environ
diff --git a/tests/functional/u/unused/unused_import_positional_only_py38.py b/tests/functional/u/unused/unused_import_positional_only_py38.py
index 693a377d9..ceaad539d 100644
--- a/tests/functional/u/unused/unused_import_positional_only_py38.py
+++ b/tests/functional/u/unused/unused_import_positional_only_py38.py
@@ -1,6 +1,6 @@
"""Test that positional only argument annotations are properly marked as consumed
-https://github.com/PyCQA/pylint/issues/3462
+https://github.com/pylint-dev/pylint/issues/3462
"""
from typing import AnyStr, Set
diff --git a/tests/functional/u/unused/unused_private_member.py b/tests/functional/u/unused/unused_private_member.py
index 1696fb691..6b14b001f 100644
--- a/tests/functional/u/unused/unused_private_member.py
+++ b/tests/functional/u/unused/unused_private_member.py
@@ -106,7 +106,7 @@ k = Klass()
print(k.twentyone)
print(k.ninetyfive)
-# https://github.com/PyCQA/pylint/issues/4657
+# https://github.com/pylint-dev/pylint/issues/4657
# Mutation of class member with cls should not fire a false-positive
class FalsePositive4657:
"""False positive tests for 4657"""
@@ -140,7 +140,7 @@ class FalsePositive4657:
return cls.__attr_c # [undefined-variable]
-# https://github.com/PyCQA/pylint/issues/4668
+# https://github.com/pylint-dev/pylint/issues/4668
# Attributes assigned within __new__() has to be processed as part of the class
class FalsePositive4668:
# pylint: disable=protected-access, no-member, unreachable
@@ -166,7 +166,7 @@ class FalsePositive4668:
return self.func(*self.__args)
-# https://github.com/PyCQA/pylint/issues/4673
+# https://github.com/pylint-dev/pylint/issues/4673
# Nested functions shouldn't cause a false positive if they are properly used
class FalsePositive4673:
""" The testing class """
@@ -207,7 +207,7 @@ class FalsePositive4673:
return fn_to_return
-# https://github.com/PyCQA/pylint/issues/4755
+# https://github.com/pylint-dev/pylint/issues/4755
# Nested attributes shouldn't cause crash
class Crash4755Context:
def __init__(self):
@@ -223,7 +223,7 @@ class Crash4755Command:
print(message)
-# https://github.com/PyCQA/pylint/issues/4681
+# https://github.com/pylint-dev/pylint/issues/4681
# Accessing attributes of the class using the class name should not result in a false positive
# as long as it is used within the class
class FalsePositive4681:
@@ -263,7 +263,7 @@ class FalsePositive4681b:
FalsePositive4681b.__instance = False # This should be fine
-# https://github.com/PyCQA/pylint/issues/4849
+# https://github.com/pylint-dev/pylint/issues/4849
# Accessing private static methods from classmethods via `cls` should not result in a
# false positive
class FalsePositive4849:
@@ -283,7 +283,7 @@ class FalsePositive4849:
class Pony:
- """https://github.com/PyCQA/pylint/issues/4837"""
+ """https://github.com/pylint-dev/pylint/issues/4837"""
__defaults = {}
__defaults_set = False
@@ -305,7 +305,7 @@ def lookup_attribute(mapping, key):
# Test for regression on checking __class__ attribute
-# See: https://github.com/PyCQA/pylint/issues/5261
+# See: https://github.com/pylint-dev/pylint/issues/5261
class Foo:
__ham = 1
@@ -313,7 +313,7 @@ class Foo:
print(self.__class__.__ham)
-# https://github.com/PyCQA/pylint/issues/4756
+# https://github.com/pylint-dev/pylint/issues/4756
# Check for false positives emitted when private functions are not referenced in the class body
# with standard calls but passed as arguments to other functions.
class FalsePositive4756a:
@@ -347,7 +347,7 @@ class TypeSelfCallInMethod:
class Item:
- """Regression test for https://github.com/PyCQA/pylint/issues/6709"""
+ """Regression test for https://github.com/pylint-dev/pylint/issues/6709"""
def __init__(self, parent):
self.__parent: Item = parent
self.__item = self.__parent.__item # [unused-private-member]
diff --git a/tests/functional/u/unused/unused_typing_imports.py b/tests/functional/u/unused/unused_typing_imports.py
index 7de4e411b..3b9b7aa06 100644
--- a/tests/functional/u/unused/unused_typing_imports.py
+++ b/tests/functional/u/unused/unused_typing_imports.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring
-"""Regression test for https://github.com/PyCQA/pylint/issues/1168
+"""Regression test for https://github.com/pylint-dev/pylint/issues/1168
The problem was that we weren't handling keyword-only arguments annotations,
which means we were never processing them.
diff --git a/tests/functional/u/unused/unused_variable.py b/tests/functional/u/unused/unused_variable.py
index 0058516c9..9dabe5b59 100644
--- a/tests/functional/u/unused/unused_variable.py
+++ b/tests/functional/u/unused/unused_variable.py
@@ -155,7 +155,7 @@ def func4():
def main(lst):
- """https://github.com/PyCQA/astroid/pull/1111#issuecomment-890367609"""
+ """https://github.com/pylint-dev/astroid/pull/1111#issuecomment-890367609"""
try:
raise ValueError
except ValueError as e: # [unused-variable]
diff --git a/tests/functional/u/unused/unused_variable_after_inference.py b/tests/functional/u/unused/unused_variable_after_inference.py
index 569564dc9..5020cd32f 100644
--- a/tests/functional/u/unused/unused_variable_after_inference.py
+++ b/tests/functional/u/unused/unused_variable_after_inference.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/6895"""
+"""Regression test for https://github.com/pylint-dev/pylint/issues/6895"""
# pylint: disable=missing-class-docstring,too-few-public-methods
import argparse
class Cls:
diff --git a/tests/functional/u/use/use_a_generator.py b/tests/functional/u/use/use_a_generator.py
index 279deb46f..6327eb1a2 100644
--- a/tests/functional/u/use/use_a_generator.py
+++ b/tests/functional/u/use/use_a_generator.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring, invalid-name
-# https://github.com/PyCQA/pylint/issues/3165
+# https://github.com/pylint-dev/pylint/issues/3165
any([])
all([])
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison.py
index 681ee0607..26b6aeaef 100644
--- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.py
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.py
@@ -1,11 +1,11 @@
# pylint: disable=missing-docstring, missing-module-docstring, invalid-name
# pylint: disable=too-few-public-methods, line-too-long, dangerous-default-value
# pylint: disable=wrong-import-order
-# https://github.com/PyCQA/pylint/issues/4774
+# https://github.com/pylint-dev/pylint/issues/4774
def github_issue_4774():
# Test literals
- # https://github.com/PyCQA/pylint/issues/4774
+ # https://github.com/pylint-dev/pylint/issues/4774
good_list = []
if not good_list:
pass
@@ -197,7 +197,7 @@ if long_test == { }: # [use-implicit-booleaness-not-comparison]
# Check for properties and uninferable class methods
-# See https://github.com/PyCQA/pylint/issues/5646
+# See https://github.com/pylint-dev/pylint/issues/5646
from xyz import AnotherClassWithProperty
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt
index 2ace15d7e..f4cf77747 100644
--- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt
@@ -1,32 +1,32 @@
-use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:'bad_list == []' can be simplified to 'not bad_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:22:3:22:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:25:3:25:19::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:28:3:28:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:31:3:31:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:34:3:34:19::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:37:3:37:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:'t == ()' can be simplified to 'not t' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:'b == []' can be simplified to 'not b' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:'c == {}' can be simplified to 'not c' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:52:7:52:24::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:53:7:53:23::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:54:7:54:23::'empty_dict != {}' can be simplified to 'empty_dict' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:55:7:55:23::'empty_tuple < ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:56:7:56:23::'empty_list <= []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:57:7:57:23::'empty_tuple > ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:58:7:58:23::'empty_list >= []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:83:3:83:10::'a == []' can be simplified to 'not a' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:95:3:95:10::'e == []' can be simplified to 'not e' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:95:15:95:22::'f == {}' can be simplified to 'not f' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:133:3:133:14::'A.lst == []' can be simplified to 'not A.lst' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:137:3:137:14::'A.lst == []' can be simplified to 'not A.lst' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:141:3:141:20::'A.test(...) == []' can be simplified to 'not A.test(...)' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:149:3:149:24::'test_function(...) == []' can be simplified to 'not test_function(...)' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:156:3:156:20::'numpy_array == []' can be simplified to 'not numpy_array' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:158:3:158:20::'numpy_array != []' can be simplified to 'numpy_array' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:160:3:160:20::'numpy_array >= ()' can be simplified to 'not numpy_array' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:185:3:185:13::'data == {}' can be simplified to 'not data' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:187:3:187:13::'data != {}' can be simplified to 'data' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:195:3:195:26::'long_test == {}' can be simplified to 'not long_test' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:233:11:233:41:test_func:'my_class.parent_function == {}' can be simplified to 'not my_class.parent_function' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:234:11:234:37:test_func:'my_class.my_property == {}' can be simplified to 'not my_class.my_property' as an empty dict is falsey:HIGH
+use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:"""bad_list == []"" can be simplified to ""not bad_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:22:3:22:20::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:25:3:25:19::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:28:3:28:19::"""empty_dict == {}"" can be simplified to ""not empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:31:3:31:20::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:34:3:34:19::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:37:3:37:19::"""empty_dict == {}"" can be simplified to ""not empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:"""t == ()"" can be simplified to ""not t"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:"""b == []"" can be simplified to ""not b"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:"""c == {}"" can be simplified to ""not c"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:52:7:52:24::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:53:7:53:23::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:54:7:54:23::"""empty_dict != {}"" can be simplified to ""empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:55:7:55:23::"""empty_tuple < ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:56:7:56:23::"""empty_list <= []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:57:7:57:23::"""empty_tuple > ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:58:7:58:23::"""empty_list >= []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:83:3:83:10::"""a == []"" can be simplified to ""not a"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:95:3:95:10::"""e == []"" can be simplified to ""not e"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:95:15:95:22::"""f == {}"" can be simplified to ""not f"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:133:3:133:14::"""A.lst == []"" can be simplified to ""not A.lst"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:137:3:137:14::"""A.lst == []"" can be simplified to ""not A.lst"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:141:3:141:20::"""A.test(...) == []"" can be simplified to ""not A.test(...)"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:149:3:149:24::"""test_function(...) == []"" can be simplified to ""not test_function(...)"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:156:3:156:20::"""numpy_array == []"" can be simplified to ""not numpy_array"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:158:3:158:20::"""numpy_array != []"" can be simplified to ""numpy_array"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:160:3:160:20::"""numpy_array >= ()"" can be simplified to ""not numpy_array"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:185:3:185:13::"""data == {}"" can be simplified to ""not data"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:187:3:187:13::"""data != {}"" can be simplified to ""data"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:195:3:195:26::"""long_test == {}"" can be simplified to ""not long_test"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:233:11:233:41:test_func:"""my_class.parent_function == {}"" can be simplified to ""not my_class.parent_function"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:234:11:234:37:test_func:"""my_class.my_property == {}"" can be simplified to ""not my_class.my_property"", if it is strictly a sequence, as an empty dict is falsey":HIGH
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py
new file mode 100644
index 000000000..4fbf0fc1d
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py
@@ -0,0 +1,22 @@
+# pylint: disable=literal-comparison,missing-docstring
+
+X = ''
+Y = 'test'
+
+if X is '': # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if Y is not "": # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if X == "": # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if Y != '': # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if "" == Y: # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if '' != X: # [use-implicit-booleaness-not-comparison-to-string]
+ pass
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc
new file mode 100644
index 000000000..14648884d
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc
@@ -0,0 +1,2 @@
+[MAIN]
+enable=use-implicit-booleaness-not-comparison-to-string
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt
new file mode 100644
index 000000000..5f07a683c
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt
@@ -0,0 +1,6 @@
+use-implicit-booleaness-not-comparison-to-string:6:3:6:10::"""X is ''"" can be simplified to ""not X"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:9:3:9:14::"""Y is not ''"" can be simplified to ""Y"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:12:3:12:10::"""X == ''"" can be simplified to ""not X"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:15:3:15:10::"""Y != ''"" can be simplified to ""Y"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:18:3:18:10::"""'' == Y"" can be simplified to ""not Y"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:21:3:21:10::"""'' != X"" can be simplified to ""X"", if it is striclty a string, as an empty string is falsey":HIGH
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py
new file mode 100644
index 000000000..766b1f547
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py
@@ -0,0 +1,46 @@
+# pylint: disable=literal-comparison,missing-docstring, singleton-comparison
+
+X = 123
+Y = len('test')
+
+if X is 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if X is False:
+ pass
+
+if Y is not 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y is not False:
+ pass
+
+if X == 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if X == False:
+ pass
+
+if 0 == Y: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y != 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if 0 != X: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y != False:
+ pass
+
+if X > 0:
+ pass
+
+if X < 0:
+ pass
+
+if 0 < X:
+ pass
+
+if 0 > X:
+ pass
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc
new file mode 100644
index 000000000..be01705b1
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc
@@ -0,0 +1,2 @@
+[MAIN]
+enable=compare-to-zero,
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt
new file mode 100644
index 000000000..cb7d57699
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt
@@ -0,0 +1,6 @@
+use-implicit-booleaness-not-comparison-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"", if it is strictly an int, as 0 is falsey":HIGH
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_len.py b/tests/functional/u/use/use_implicit_booleaness_not_len.py
index 4002a6dda..79547d99e 100644
--- a/tests/functional/u/use/use_implicit_booleaness_not_len.py
+++ b/tests/functional/u/use/use_implicit_booleaness_not_len.py
@@ -158,28 +158,28 @@ def github_issue_1879():
return 1
return 2
- # def function_returning_generator(r):
- # for i in [r, 1, 2, 3]:
- # yield i
+ def function_returning_generator(r):
+ for i in [r, 1, 2, 3]:
+ yield i
- # def function_returning_comprehension(r):
- # return [x+1 for x in [r, 1, 2, 3]]
+ def function_returning_comprehension(r):
+ return [x+1 for x in [r, 1, 2, 3]]
- # def function_returning_function(r):
- # return function_returning_generator(r)
+ def function_returning_function(r):
+ return function_returning_generator(r)
assert len(function_returning_list(z)) # [use-implicit-booleaness-not-len]
assert len(function_returning_int(z))
# This should raise a use-implicit-booleaness-not-len once astroid can infer it
- # See https://github.com/PyCQA/pylint/pull/3821#issuecomment-743771514
- # assert len(function_returning_generator(z))
- # assert len(function_returning_comprehension(z))
- # assert len(function_returning_function(z))
+ # See https://github.com/pylint-dev/pylint/pull/3821#issuecomment-743771514
+ assert len(function_returning_generator(z))
+ assert len(function_returning_comprehension(z))
+ assert len(function_returning_function(z))
def github_issue_4215():
# Test undefined variables
- # https://github.com/PyCQA/pylint/issues/4215
+ # https://github.com/pylint-dev/pylint/issues/4215
if len(undefined_var): # [undefined-variable]
pass
if len(undefined_var2[0]): # [undefined-variable]
diff --git a/tests/functional/u/use/use_maxsplit_arg.py b/tests/functional/u/use/use_maxsplit_arg.py
index 449457a0c..11e51c116 100644
--- a/tests/functional/u/use/use_maxsplit_arg.py
+++ b/tests/functional/u/use/use_maxsplit_arg.py
@@ -84,7 +84,7 @@ a = "1,2,3".split('split')[-1] # [use-maxsplit-arg]
a = "1,2,3".rsplit('rsplit')[0] # [use-maxsplit-arg]
# Test cases for false-positive reported in #4664
-# https://github.com/PyCQA/pylint/issues/4664
+# https://github.com/pylint-dev/pylint/issues/4664
source = 'A.B.C.D.E.F.G'
i = 0
for j in range(5):
@@ -92,7 +92,7 @@ for j in range(5):
i = i + 1
# Test for crash when sep is given by keyword
-# https://github.com/PyCQA/pylint/issues/5737
+# https://github.com/pylint-dev/pylint/issues/5737
get_last = SEQ.split(sep=None)[-1] # [use-maxsplit-arg]
diff --git a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py
index a43a89aa1..e0d874ff8 100644
--- a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py
+++ b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py
@@ -1,6 +1,6 @@
"""Tests for used-before-assignment with assignments in except handlers after
try blocks with return statements.
-See: https://github.com/PyCQA/pylint/issues/5500.
+See: https://github.com/pylint-dev/pylint/issues/5500.
"""
# pylint: disable=inconsistent-return-statements
diff --git a/tests/functional/u/used/used_before_assignment.py b/tests/functional/u/used/used_before_assignment.py
index d36b2fd8d..9b7d668ca 100644
--- a/tests/functional/u/used/used_before_assignment.py
+++ b/tests/functional/u/used/used_before_assignment.py
@@ -1,6 +1,6 @@
"""Miscellaneous used-before-assignment cases"""
# pylint: disable=consider-using-f-string, missing-function-docstring
-
+import datetime
MSG = "hello %s" % MSG # [used-before-assignment]
@@ -14,6 +14,17 @@ def outer():
outer()
+class ClassWithProperty: # pylint: disable=too-few-public-methods
+ """This test depends on earlier and later defined module-level functions."""
+ prop = property(redefine_time_import) # [used-before-assignment]
+ prop_defined_earlier = property(outer)
+
+
+calculate(1.01, 2) # [used-before-assignment]
+def calculate(value1: int, value2: float) -> int:
+ return value1 + value2
+
+
# pylint: disable=unused-import, wrong-import-position, import-outside-toplevel, reimported, redefined-outer-name, global-statement
import time
def redefine_time_import():
@@ -108,7 +119,7 @@ for num in [0, 1]:
print(VAR12)
def turn_on2(**kwargs):
- """https://github.com/PyCQA/pylint/issues/7873"""
+ """https://github.com/pylint-dev/pylint/issues/7873"""
if "brightness" in kwargs:
brightness = kwargs["brightness"]
var, *args = (1, "set_dimmer_state", brightness)
@@ -116,3 +127,50 @@ def turn_on2(**kwargs):
var, *args = (1, "restore_dimmer_state")
print(var, *args)
+
+
+# Variables guarded by the same test when used.
+
+# Always false
+if __name__ == "__main__":
+ PERCENT = 20
+ SALE = True
+
+if __name__ == "__main__":
+ print(PERCENT)
+
+# Different test
+if __name__ is None:
+ print(SALE) # [used-before-assignment]
+
+
+# Ambiguous, but same test
+if not datetime.date.today():
+ WAS_TODAY = True
+
+if not datetime.date.today():
+ print(WAS_TODAY)
+
+
+# Different tests but same inferred values
+# Need falsy values here
+def give_me_zero():
+ return 0
+
+def give_me_nothing():
+ return 0
+
+if give_me_zero():
+ WE_HAVE_ZERO = True
+ ALL_DONE = True
+
+if give_me_nothing():
+ print(WE_HAVE_ZERO)
+
+
+# Different tests, different values
+def give_me_none():
+ return None
+
+if give_me_none():
+ print(ALL_DONE) # [used-before-assignment]
diff --git a/tests/functional/u/used/used_before_assignment.txt b/tests/functional/u/used/used_before_assignment.txt
index 70153f39a..37b25ab49 100644
--- a/tests/functional/u/used/used_before_assignment.txt
+++ b/tests/functional/u/used/used_before_assignment.txt
@@ -1,8 +1,12 @@
used-before-assignment:5:19:5:22::Using variable 'MSG' before assignment:HIGH
used-before-assignment:7:20:7:24::Using variable 'MSG2' before assignment:HIGH
used-before-assignment:10:4:10:9:outer:Using variable 'inner' before assignment:HIGH
-used-before-assignment:20:10:20:14:redefine_time_import:Using variable 'time' before assignment:HIGH
-used-before-assignment:34:3:34:7::Using variable 'VAR2' before assignment:CONTROL_FLOW
-used-before-assignment:52:3:52:7::Using variable 'VAR4' before assignment:CONTROL_FLOW
-used-before-assignment:67:3:67:7::Using variable 'VAR6' before assignment:CONTROL_FLOW
-used-before-assignment:102:6:102:11::Using variable 'VAR10' before assignment:CONTROL_FLOW
+used-before-assignment:19:20:19:40:ClassWithProperty:Using variable 'redefine_time_import' before assignment:HIGH
+used-before-assignment:23:0:23:9::Using variable 'calculate' before assignment:HIGH
+used-before-assignment:31:10:31:14:redefine_time_import:Using variable 'time' before assignment:HIGH
+used-before-assignment:45:3:45:7::Using variable 'VAR2' before assignment:CONTROL_FLOW
+used-before-assignment:63:3:63:7::Using variable 'VAR4' before assignment:CONTROL_FLOW
+used-before-assignment:78:3:78:7::Using variable 'VAR6' before assignment:CONTROL_FLOW
+used-before-assignment:113:6:113:11::Using variable 'VAR10' before assignment:CONTROL_FLOW
+used-before-assignment:144:10:144:14::Using variable 'SALE' before assignment:CONTROL_FLOW
+used-before-assignment:176:10:176:18::Using variable 'ALL_DONE' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/used/used_before_assignment_class_nested_under_function.py b/tests/functional/u/used/used_before_assignment_class_nested_under_function.py
index 3627ae1e1..43734757b 100644
--- a/tests/functional/u/used/used_before_assignment_class_nested_under_function.py
+++ b/tests/functional/u/used/used_before_assignment_class_nested_under_function.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/4590"""
+"""https://github.com/pylint-dev/pylint/issues/4590"""
# pylint: disable=too-few-public-methods
diff --git a/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py b/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py
index 2321afed7..6c7fe411a 100644
--- a/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py
+++ b/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py
@@ -2,7 +2,7 @@
# pylint: disable=broad-exception-raised
def func():
- """https://github.com/PyCQA/pylint/issues/5586"""
+ """https://github.com/pylint-dev/pylint/issues/5586"""
try:
print(value for value in range(1 / 0) if isinstance(value, int))
except ZeroDivisionError:
@@ -29,7 +29,7 @@ def func3():
def func4():
- """https://github.com/PyCQA/pylint/issues/6035"""
+ """https://github.com/pylint-dev/pylint/issues/6035"""
assets = [asset for asset in range(3) if asset.name == "filename"]
try:
@@ -54,7 +54,7 @@ def func5():
def func6(data, keys):
"""Similar, but with a subscript in a key-value pair rather than the test
- See https://github.com/PyCQA/pylint/issues/6069"""
+ See https://github.com/pylint-dev/pylint/issues/6069"""
try:
results = {key: data[key] for key in keys}
except KeyError as exc:
diff --git a/tests/functional/u/used/used_before_assignment_else_return.py b/tests/functional/u/used/used_before_assignment_else_return.py
index a7e58bb61..8dcd21337 100644
--- a/tests/functional/u/used/used_before_assignment_else_return.py
+++ b/tests/functional/u/used/used_before_assignment_else_return.py
@@ -3,7 +3,7 @@
import sys
def valid():
- """https://github.com/PyCQA/pylint/issues/6790"""
+ """https://github.com/pylint-dev/pylint/issues/6790"""
try:
pass
except ValueError:
diff --git a/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py b/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py
index c83a48473..418fee298 100644
--- a/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py
+++ b/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py
@@ -1,6 +1,6 @@
"""Tests for used-before-assignment with assignments in except handlers after
try blocks with return statements.
-See: https://github.com/PyCQA/pylint/issues/5500.
+See: https://github.com/pylint-dev/pylint/issues/5500.
"""
# pylint: disable=inconsistent-return-statements,broad-exception-raised
diff --git a/tests/functional/u/used/used_before_assignment_issue2615.py b/tests/functional/u/used/used_before_assignment_issue2615.py
index bce073bf3..e2e5a4181 100644
--- a/tests/functional/u/used/used_before_assignment_issue2615.py
+++ b/tests/functional/u/used/used_before_assignment_issue2615.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/2615"""
+"""https://github.com/pylint-dev/pylint/issues/2615"""
def main():
"""When evaluating except blocks, assume try statements fail."""
try:
diff --git a/tests/functional/u/used/used_before_assignment_issue4761.py b/tests/functional/u/used/used_before_assignment_issue4761.py
index 6f8e048e4..7ba77be62 100644
--- a/tests/functional/u/used/used_before_assignment_issue4761.py
+++ b/tests/functional/u/used/used_before_assignment_issue4761.py
@@ -13,7 +13,7 @@ def function():
def uses_nonlocal():
- """https://github.com/PyCQA/pylint/issues/5965"""
+ """https://github.com/pylint-dev/pylint/issues/5965"""
count = 0
def inner():
nonlocal count
@@ -46,7 +46,7 @@ def uses_unrelated_nonlocal():
# only non-break exit branch.
def valid_only_non_break_exit_from_loop_is_except_handler():
- """https://github.com/PyCQA/pylint/issues/5683"""
+ """https://github.com/pylint-dev/pylint/issues/5683"""
for _ in range(3):
try:
function() # not an exit branch because of `else` below
diff --git a/tests/functional/u/used/used_before_assignment_issue85.py b/tests/functional/u/used/used_before_assignment_issue85.py
index 367af9dfa..7ede436bb 100644
--- a/tests/functional/u/used/used_before_assignment_issue85.py
+++ b/tests/functional/u/used/used_before_assignment_issue85.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/85"""
+"""https://github.com/pylint-dev/pylint/issues/85"""
def main():
"""When evaluating finally blocks, assume try statements fail."""
try:
@@ -54,7 +54,7 @@ def try_except_finally_nested_try_finally_in_try():
def try_except_finally_nested_in_finally():
"""Until Pylint comes to a consensus on requiring all except handlers to
- define a name, raise, or return (https://github.com/PyCQA/pylint/issues/5524),
+ define a name, raise, or return (https://github.com/pylint-dev/pylint/issues/5524),
Pylint assumes statements in try blocks succeed when accessed *after*
except or finally blocks and fail when accessed *in* except or finally
blocks.)
diff --git a/tests/functional/u/used/used_before_assignment_nonlocal.py b/tests/functional/u/used/used_before_assignment_nonlocal.py
index 18e16177d..4d926e9eb 100644
--- a/tests/functional/u/used/used_before_assignment_nonlocal.py
+++ b/tests/functional/u/used/used_before_assignment_nonlocal.py
@@ -60,7 +60,7 @@ nonlocal_in_ifexp()
def type_annotation_only_gets_value_via_nonlocal():
- """https://github.com/PyCQA/pylint/issues/5394"""
+ """https://github.com/pylint-dev/pylint/issues/5394"""
some_num: int
def inner():
nonlocal some_num
diff --git a/tests/functional/u/used/used_before_assignment_postponed_evaluation.py b/tests/functional/u/used/used_before_assignment_postponed_evaluation.py
new file mode 100644
index 000000000..4ff22470c
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_postponed_evaluation.py
@@ -0,0 +1,13 @@
+"""Tests for used-before-assignment when postponed evaluation of annotations is enabled"""
+# pylint: disable=missing-function-docstring, invalid-name
+from __future__ import annotations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ var = 1
+ import math
+
+print(var) # [used-before-assignment]
+
+def function_one(m: math): # no error for annotations
+ return m
diff --git a/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt b/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt
new file mode 100644
index 000000000..88a958736
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt
@@ -0,0 +1 @@
+used-before-assignment:10:6:10:9::Using variable 'var' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/used/used_before_assignment_py37.py b/tests/functional/u/used/used_before_assignment_py37.py
index c64bf7cf5..1b0a895bf 100644
--- a/tests/functional/u/used/used_before_assignment_py37.py
+++ b/tests/functional/u/used/used_before_assignment_py37.py
@@ -30,6 +30,6 @@ class MyClass:
class NamedTupleSubclass(namedtuple("NamedTupleSubclass", [])):
- """Taken from https://github.com/PyCQA/pylint/issues/5982"""
+ """Taken from https://github.com/pylint-dev/pylint/issues/5982"""
def method(self) -> NamedTupleSubclass:
"""Variables checker crashed when astroid did not supply a lineno"""
diff --git a/tests/functional/u/used/used_before_assignment_scoping.py b/tests/functional/u/used/used_before_assignment_scoping.py
new file mode 100644
index 000000000..0d88210bd
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_scoping.py
@@ -0,0 +1,18 @@
+# pylint: disable=missing-function-docstring, missing-module-docstring
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from datetime import datetime
+
+
+def func_two():
+ second = datetime.now() # [used-before-assignment]
+ return second
+
+
+def func():
+ first: datetime
+ first = datetime.now() # [used-before-assignment]
+ second = datetime.now()
+ return first, second
diff --git a/tests/functional/u/used/used_before_assignment_scoping.txt b/tests/functional/u/used/used_before_assignment_scoping.txt
new file mode 100644
index 000000000..32b6d3e1b
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_scoping.txt
@@ -0,0 +1,2 @@
+used-before-assignment:10:13:10:21:func_two:Using variable 'datetime' before assignment:CONTROL_FLOW
+used-before-assignment:16:12:16:20:func:Using variable 'datetime' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/used/used_before_assignment_ternary.txt b/tests/functional/u/used/used_before_assignment_ternary.txt
index d991970e4..bcb21df1c 100644
--- a/tests/functional/u/used/used_before_assignment_ternary.txt
+++ b/tests/functional/u/used/used_before_assignment_ternary.txt
@@ -1,3 +1,3 @@
-used-before-assignment:6:14:6:15:invalid:Using variable 'a' before assignment:HIGH
-used-before-assignment:8:14:8:15:invalid:Using variable 'b' before assignment:HIGH
-used-before-assignment:9:10:9:11:invalid:Using variable 'c' before assignment:HIGH
+used-before-assignment:6:14:6:15:invalid:Using variable 'a' before assignment:HIGH
+used-before-assignment:8:14:8:15:invalid:Using variable 'b' before assignment:HIGH
+used-before-assignment:9:10:9:11:invalid:Using variable 'c' before assignment:HIGH
diff --git a/tests/functional/u/used/used_before_assignment_type_annotations.py b/tests/functional/u/used/used_before_assignment_type_annotations.py
index 1a03050c3..e70a911ca 100644
--- a/tests/functional/u/used/used_before_assignment_type_annotations.py
+++ b/tests/functional/u/used/used_before_assignment_type_annotations.py
@@ -77,7 +77,7 @@ def typing_and_value_assignment_with_tuple_assignment():
def nested_class_as_return_annotation():
"""A namedtuple as a class attribute is used as a return annotation
- Taken from https://github.com/PyCQA/pylint/issues/5568"""
+ Taken from https://github.com/pylint-dev/pylint/issues/5568"""
class MyObject:
"""namedtuple as class attribute"""
Coords = namedtuple('Point', ['x', 'y'])
diff --git a/tests/functional/u/used/used_before_assignment_typing.py b/tests/functional/u/used/used_before_assignment_typing.py
index a685bdabc..9ec040ff6 100644
--- a/tests/functional/u/used/used_before_assignment_typing.py
+++ b/tests/functional/u/used/used_before_assignment_typing.py
@@ -7,11 +7,12 @@ from typing import List, Optional, TYPE_CHECKING
if TYPE_CHECKING:
if True: # pylint: disable=using-constant-test
import math
+ import dbm
+ print(dbm) # no error when defined and used in the same false branch
from urllib.request import urlopen
import array
import base64
import binascii
- import bisect
import calendar
import collections
import copy
@@ -91,7 +92,7 @@ class MyClass:
class MySecondClass:
"""Class to test self referential variable typing.
- This regressed, reported in: https://github.com/PyCQA/pylint/issues/5342
+ This regressed, reported in: https://github.com/pylint-dev/pylint/issues/5342
"""
def self_referential_optional_within_method(self) -> None:
@@ -121,7 +122,7 @@ class MyOtherClass:
class MyThirdClass:
"""Class to test self referential variable typing within conditionals.
- This regressed, reported in: https://github.com/PyCQA/pylint/issues/5499
+ This regressed, reported in: https://github.com/pylint-dev/pylint/issues/5499
"""
def function(self, var: int) -> None:
@@ -134,7 +135,7 @@ class MyThirdClass:
class MyFourthClass: # pylint: disable=too-few-public-methods
"""Class to test conditional imports guarded by TYPE_CHECKING two levels
- up then used in function annotation. See https://github.com/PyCQA/pylint/issues/7539"""
+ up then used in function annotation. See https://github.com/pylint-dev/pylint/issues/7539"""
def is_close(self, comparator: math.isclose, first, second): # [used-before-assignment]
"""Conditional imports guarded are only valid for variable annotations."""
@@ -145,8 +146,8 @@ class VariableAnnotationsGuardedByTypeChecking: # pylint: disable=too-few-publi
"""Class to test conditional imports guarded by TYPE_CHECKING then used in
local (function) variable annotations, which are not evaluated at runtime.
- See: https://github.com/PyCQA/pylint/issues/7609
- and https://github.com/PyCQA/pylint/issues/7882
+ See: https://github.com/pylint-dev/pylint/issues/7609
+ and https://github.com/pylint-dev/pylint/issues/7882
"""
still_an_error: datetime.date # [used-before-assignment]
diff --git a/tests/functional/u/used/used_before_assignment_typing.txt b/tests/functional/u/used/used_before_assignment_typing.txt
index c0a31fae0..12794f0e9 100644
--- a/tests/functional/u/used/used_before_assignment_typing.txt
+++ b/tests/functional/u/used/used_before_assignment_typing.txt
@@ -1,5 +1,5 @@
-undefined-variable:68:21:68:28:MyClass.incorrect_typing_method:Undefined variable 'MyClass':UNDEFINED
-undefined-variable:73:26:73:33:MyClass.incorrect_nested_typing_method:Undefined variable 'MyClass':UNDEFINED
-undefined-variable:78:20:78:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED
-used-before-assignment:139:35:139:39:MyFourthClass.is_close:Using variable 'math' before assignment:HIGH
-used-before-assignment:152:20:152:28:VariableAnnotationsGuardedByTypeChecking:Using variable 'datetime' before assignment:HIGH
+undefined-variable:69:21:69:28:MyClass.incorrect_typing_method:Undefined variable 'MyClass':UNDEFINED
+undefined-variable:74:26:74:33:MyClass.incorrect_nested_typing_method:Undefined variable 'MyClass':UNDEFINED
+undefined-variable:79:20:79:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED
+used-before-assignment:140:35:140:39:MyFourthClass.is_close:Using variable 'math' before assignment:CONTROL_FLOW
+used-before-assignment:153:20:153:28:VariableAnnotationsGuardedByTypeChecking:Using variable 'datetime' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/useless/useless_parent_delegation.py b/tests/functional/u/useless/useless_parent_delegation.py
index ce645e31f..b742a4e94 100644
--- a/tests/functional/u/useless/useless_parent_delegation.py
+++ b/tests/functional/u/useless/useless_parent_delegation.py
@@ -312,7 +312,7 @@ class DecoratedList(MyList):
return super().__hash__()
-# Reported in https://github.com/PyCQA/pylint/issues/2270
+# Reported in https://github.com/pylint-dev/pylint/issues/2270
class Super:
def __init__(self, *args):
self.args = args
diff --git a/tests/functional/u/useless/useless_suppression.py b/tests/functional/u/useless/useless_suppression.py
index b5c681eef..627138b50 100644
--- a/tests/functional/u/useless/useless_suppression.py
+++ b/tests/functional/u/useless/useless_suppression.py
@@ -3,14 +3,14 @@
# pylint: disable=unused-import, wrong-import-order, wrong-import-position
# False positive for wrong-import-order
-# Reported in https://github.com/PyCQA/pylint/issues/2366
+# Reported in https://github.com/pylint-dev/pylint/issues/2366
from pylint import run_pylint
import astroid
# False-positive for 'line-too-long'
-# Reported in https://github.com/PyCQA/pylint/issues/4212
+# Reported in https://github.com/pylint-dev/pylint/issues/4212
VAR = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # pylint: disable=line-too-long
# False-positive for 'wrong-import-order'
-# Reported in https://github.com/PyCQA/pylint/issues/5219
+# Reported in https://github.com/pylint-dev/pylint/issues/5219
import os
diff --git a/tests/input/func_noerror_cycle/__init__.py b/tests/input/func_noerror_cycle/__init__.py
index fd8d14ec2..0a0ca7e19 100644
--- a/tests/input/func_noerror_cycle/__init__.py
+++ b/tests/input/func_noerror_cycle/__init__.py
@@ -1,3 +1,3 @@
-# https://github.com/PyCQA/pylint/issues/3525
+# https://github.com/pylint-dev/pylint/issues/3525
# `cyclic-import` should not be emitted if one import
# is guarded by `typing.TYPE_CHECKING`
diff --git a/tests/lint/__init__.py b/tests/lint/__init__.py
index e8a8ff79f..cfd18ddd3 100644
--- a/tests/lint/__init__.py
+++ b/tests/lint/__init__.py
@@ -1,3 +1,3 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
diff --git a/tests/lint/test_caching.py b/tests/lint/test_caching.py
index 55c2b54dd..e891f6810 100644
--- a/tests/lint/test_caching.py
+++ b/tests/lint/test_caching.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# Pytest fixtures work like this by design
# pylint: disable=redefined-outer-name
diff --git a/tests/lint/test_pylinter.py b/tests/lint/test_pylinter.py
index 1d0f43819..1e4f40a00 100644
--- a/tests/lint/test_pylinter.py
+++ b/tests/lint/test_pylinter.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import os
from pathlib import Path
@@ -8,8 +8,6 @@ from typing import Any, NoReturn
from unittest import mock
from unittest.mock import patch
-import pytest
-from _pytest.recwarn import WarningsRecorder
from pytest import CaptureFixture
from pylint.lint.pylinter import PyLinter
@@ -24,10 +22,8 @@ def raise_exception(*args: Any, **kwargs: Any) -> NoReturn:
def test_crash_in_file(
linter: PyLinter, capsys: CaptureFixture[str], tmp_path: Path
) -> None:
- with pytest.warns(DeprecationWarning):
- args = linter.load_command_line_configuration([__file__])
linter.crash_file_path = str(tmp_path / "pylint-crash-%Y")
- linter.check(args)
+ linter.check([__file__])
out, err = capsys.readouterr()
assert not out
assert not err
@@ -37,12 +33,6 @@ def test_crash_in_file(
assert any(m.symbol == "fatal" for m in linter.reporter.messages)
-def test_check_deprecation(linter: PyLinter, recwarn: WarningsRecorder) -> None:
- linter.check("myfile.py")
- msg = recwarn.pop()
- assert "check function will only accept sequence" in str(msg)
-
-
def test_crash_during_linting(
linter: PyLinter, capsys: CaptureFixture[str], tmp_path: Path
) -> None:
diff --git a/tests/lint/test_run_pylint.py b/tests/lint/test_run_pylint.py
index 73dc26331..5057f1343 100644
--- a/tests/lint/test_run_pylint.py
+++ b/tests/lint/test_run_pylint.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pathlib import Path
diff --git a/tests/lint/test_utils.py b/tests/lint/test_utils.py
index 872919f72..fa449374a 100644
--- a/tests/lint/test_utils.py
+++ b/tests/lint/test_utils.py
@@ -1,12 +1,13 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import unittest.mock
from pathlib import Path, PosixPath
import pytest
+from pylint.constants import full_version
from pylint.lint.utils import get_fatal_error_message, prepare_crash_report
from pylint.testutils._run import _Run as Run
@@ -17,19 +18,22 @@ def test_prepare_crash_report(tmp_path: PosixPath) -> None:
python_content = "from shadok import MagicFaucet"
with open(python_file, "w", encoding="utf8") as f:
f.write(python_content)
+ template_path = None
try:
- raise Exception(exception_content) # pylint: disable=broad-exception-raised
- except Exception as ex: # pylint: disable=broad-except
+ raise ValueError(exception_content)
+ except ValueError as ex:
template_path = prepare_crash_report(
ex, str(python_file), str(tmp_path / "pylint-crash-%Y.txt")
)
- assert str(tmp_path) in str(template_path) # pylint: disable=used-before-assignment
+ assert str(tmp_path) in str(template_path)
with open(template_path, encoding="utf8") as f:
template_content = f.read()
assert python_content in template_content
assert exception_content in template_content
assert "in test_prepare_crash_report" in template_content
- assert "raise Exception(exception_content)" in template_content
+ assert "raise ValueError(exception_content)" in template_content
+ assert "<details open>" in template_content
+ assert full_version in template_content
def test_get_fatal_error_message() -> None:
diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py
index a8c46498c..7120a1748 100644
--- a/tests/lint/unittest_expand_modules.py
+++ b/tests/lint/unittest_expand_modules.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py
index d3faa5453..918533795 100644
--- a/tests/lint/unittest_lint.py
+++ b/tests/lint/unittest_lint.py
@@ -1,42 +1,38 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
from __future__ import annotations
import argparse
-import datetime
import os
import re
import sys
import tempfile
from collections.abc import Iterator
from contextlib import contextmanager
-from importlib import reload
from io import StringIO
from os import chdir, getcwd
from os.path import abspath, dirname, join, sep
from pathlib import Path
from shutil import copy, rmtree
+from unittest import mock
import platformdirs
import pytest
from astroid import nodes
from pytest import CaptureFixture
-from pylint import checkers, config, exceptions, interfaces, lint, testutils
+from pylint import checkers, constants, exceptions, interfaces, lint, testutils
from pylint.checkers.utils import only_required_for_messages
from pylint.constants import (
MSG_STATE_CONFIDENCE,
MSG_STATE_SCOPE_CONFIG,
MSG_STATE_SCOPE_MODULE,
- OLD_DEFAULT_PYLINT_HOME,
PYLINT_HOME,
- USER_HOME,
_get_pylint_home,
- _warn_about_old_home,
)
from pylint.exceptions import InvalidMessageError
from pylint.lint import PyLinter, expand_modules
@@ -116,15 +112,6 @@ def fake_path() -> Iterator[list[str]]:
sys.path[:] = orig
-def test_deprecated() -> None:
- """Test that fix_import_path() and get_python_path() are deprecated"""
- with tempdir():
- create_files(["__init__.py"])
- with pytest.deprecated_call():
- with lint.fix_import_path([""]):
- expand_modules.get_python_path("__init__.py")
-
-
def test_no_args(fake_path: list[str]) -> None:
with lint.augmented_sys_path([]):
assert sys.path == fake_path
@@ -137,7 +124,7 @@ def test_no_args(fake_path: list[str]) -> None:
def test_one_arg(fake_path: list[str], case: list[str]) -> None:
with tempdir() as chroot:
create_files(["a/b/__init__.py"])
- expected = [join(chroot, "a")] + fake_path
+ expected = [join(chroot, "a"), *fake_path]
extra_sys_paths = [
expand_modules.discover_package_path(arg, []) for arg in case
@@ -161,7 +148,7 @@ def test_one_arg(fake_path: list[str], case: list[str]) -> None:
def test_two_similar_args(fake_path: list[str], case: list[str]) -> None:
with tempdir() as chroot:
create_files(["a/b/__init__.py", "a/c/__init__.py"])
- expected = [join(chroot, "a")] + fake_path
+ expected = [join(chroot, "a"), *fake_path]
extra_sys_paths = [
expand_modules.discover_package_path(arg, []) for arg in case
@@ -940,126 +927,14 @@ def pop_pylintrc() -> None:
@pytest.mark.usefixtures("pop_pylintrc")
def test_pylint_home() -> None:
- uhome = os.path.expanduser("~")
- if uhome == "~":
- expected = OLD_DEFAULT_PYLINT_HOME
- else:
- expected = platformdirs.user_cache_dir("pylint")
- assert config.PYLINT_HOME == expected
+ expected = platformdirs.user_cache_dir("pylint")
+ assert constants.PYLINT_HOME == expected
assert PYLINT_HOME == expected
+@mock.patch.dict(os.environ, {"PYLINTHOME": "whatever.d"})
def test_pylint_home_from_environ() -> None:
- try:
- pylintd = join(tempfile.gettempdir(), OLD_DEFAULT_PYLINT_HOME)
- os.environ["PYLINTHOME"] = pylintd
- try:
- assert _get_pylint_home() == pylintd
- finally:
- try:
- rmtree(pylintd)
- except FileNotFoundError:
- pass
- finally:
- del os.environ["PYLINTHOME"]
-
-
-def test_warn_about_old_home(capsys: CaptureFixture[str]) -> None:
- """Test that we correctly warn about old_home."""
- # Create old home
- old_home = Path(USER_HOME) / OLD_DEFAULT_PYLINT_HOME
- old_home.mkdir(parents=True, exist_ok=True)
-
- # Create spam prevention file
- ten_years_ago = datetime.datetime.now() - datetime.timedelta(weeks=520)
- new_prevention_file = Path(PYLINT_HOME) / ten_years_ago.strftime(
- "pylint_warned_about_old_cache_already_%Y-%m-%d.temp"
- )
- with open(new_prevention_file, "w", encoding="utf8") as f:
- f.write("")
-
- # Remove current prevention file
- cur_prevention_file = Path(PYLINT_HOME) / datetime.datetime.now().strftime(
- "pylint_warned_about_old_cache_already_%Y-%m-%d.temp"
- )
- if cur_prevention_file.exists():
- os.remove(cur_prevention_file)
-
- _warn_about_old_home(Path(PYLINT_HOME))
-
- assert not new_prevention_file.exists()
- assert cur_prevention_file.exists()
-
- out = capsys.readouterr()
- assert "PYLINTHOME is now" in out.err
-
-
-@pytest.mark.usefixtures("pop_pylintrc")
-def test_pylintrc() -> None:
- with fake_home():
- current_dir = getcwd()
- chdir(os.path.dirname(os.path.abspath(sys.executable)))
- # pylint: disable = too-many-try-statements
- try:
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() is None
- os.environ["PYLINTRC"] = join(tempfile.gettempdir(), ".pylintrc")
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() is None
- os.environ["PYLINTRC"] = "."
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() is None
- finally:
- chdir(current_dir)
- reload(config)
-
-
-@pytest.mark.usefixtures("pop_pylintrc")
-def test_pylintrc_parentdir() -> None:
- with tempdir() as chroot:
- create_files(
- [
- "a/pylintrc",
- "a/b/__init__.py",
- "a/b/pylintrc",
- "a/b/c/__init__.py",
- "a/b/c/d/__init__.py",
- "a/b/c/d/e/.pylintrc",
- ]
- )
- with fake_home():
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() is None
- results = {
- "a": join(chroot, "a", "pylintrc"),
- "a/b": join(chroot, "a", "b", "pylintrc"),
- "a/b/c": join(chroot, "a", "b", "pylintrc"),
- "a/b/c/d": join(chroot, "a", "b", "pylintrc"),
- "a/b/c/d/e": join(chroot, "a", "b", "c", "d", "e", ".pylintrc"),
- }
- for basedir, expected in results.items():
- os.chdir(join(chroot, basedir))
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() == expected
-
-
-@pytest.mark.usefixtures("pop_pylintrc")
-def test_pylintrc_parentdir_no_package() -> None:
- with tempdir() as chroot:
- with fake_home():
- create_files(["a/pylintrc", "a/b/pylintrc", "a/b/c/d/__init__.py"])
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() is None
- results = {
- "a": join(chroot, "a", "pylintrc"),
- "a/b": join(chroot, "a", "b", "pylintrc"),
- "a/b/c": None,
- "a/b/c/d": None,
- }
- for basedir, expected in results.items():
- os.chdir(join(chroot, basedir))
- with pytest.warns(DeprecationWarning):
- assert config.find_pylintrc() == expected
+ assert _get_pylint_home() == "whatever.d"
class _CustomPyLinter(PyLinter):
@@ -1267,7 +1142,7 @@ def test_globbing() -> None:
def test_relative_imports(initialized_linter: PyLinter) -> None:
- """Regression test for https://github.com/PyCQA/pylint/issues/3651"""
+ """Regression test for https://github.com/pylint-dev/pylint/issues/3651"""
linter = initialized_linter
with tempdir() as tmpdir:
create_files(["x/y/__init__.py", "x/y/one.py", "x/y/two.py"], tmpdir)
@@ -1322,7 +1197,7 @@ print(submodule1)
def test_lint_namespace_package_under_dir(initialized_linter: PyLinter) -> None:
- """Regression test for https://github.com/PyCQA/pylint/issues/1667"""
+ """Regression test for https://github.com/pylint-dev/pylint/issues/1667"""
linter = initialized_linter
with tempdir():
create_files(["outer/namespace/__init__.py", "outer/namespace/module.py"])
diff --git a/tests/message/__init__.py b/tests/message/__init__.py
index e8a8ff79f..cfd18ddd3 100644
--- a/tests/message/__init__.py
+++ b/tests/message/__init__.py
@@ -1,3 +1,3 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
diff --git a/tests/message/conftest.py b/tests/message/conftest.py
index e41057835..57567f438 100644
--- a/tests/message/conftest.py
+++ b/tests/message/conftest.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
diff --git a/tests/message/test_no_removed_msgid_or_symbol_used.py b/tests/message/test_no_removed_msgid_or_symbol_used.py
index 3b0134235..7b13dc460 100644
--- a/tests/message/test_no_removed_msgid_or_symbol_used.py
+++ b/tests/message/test_no_removed_msgid_or_symbol_used.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pylint.lint import PyLinter
from pylint.message._deleted_message_ids import DELETED_MESSAGES_IDS
@@ -10,7 +10,7 @@ def test_no_removed_msgid_or_symbol_used(linter: PyLinter) -> None:
"""Tests that we're not using deleted msgid or symbol.
This could cause occasional bugs, but more importantly confusion and inconsistencies
- when searching for old msgids online. See https://github.com/PyCQA/pylint/issues/5729
+ when searching for old msgids online. See https://github.com/pylint-dev/pylint/issues/5729
"""
for deleted_messages in DELETED_MESSAGES_IDS.values():
for msgid, symbol, old_names in deleted_messages:
diff --git a/tests/message/unittest_message.py b/tests/message/unittest_message.py
index edb803daf..6fddd804c 100644
--- a/tests/message/unittest_message.py
+++ b/tests/message/unittest_message.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/message/unittest_message_definition.py b/tests/message/unittest_message_definition.py
index aebd1bc6b..6c393b519 100644
--- a/tests/message/unittest_message_definition.py
+++ b/tests/message/unittest_message_definition.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/message/unittest_message_definition_store.py b/tests/message/unittest_message_definition_store.py
index eb323a2e6..a8a0043fa 100644
--- a/tests/message/unittest_message_definition_store.py
+++ b/tests/message/unittest_message_definition_store.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/message/unittest_message_id_store.py b/tests/message/unittest_message_id_store.py
index 9dcf774e5..c2b556ac9 100644
--- a/tests/message/unittest_message_id_store.py
+++ b/tests/message/unittest_message_id_store.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/primer/__main__.py b/tests/primer/__main__.py
index 1e99ca234..260306237 100644
--- a/tests/primer/__main__.py
+++ b/tests/primer/__main__.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/primer/packages_to_lint_batch_one.json b/tests/primer/packages_to_lint_batch_one.json
deleted file mode 100644
index 6520e2bd1..000000000
--- a/tests/primer/packages_to_lint_batch_one.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "keras": {
- "branch": "master",
- "directories": ["keras"],
- "url": "https://github.com/keras-team/keras.git"
- }
-}
diff --git a/tests/primer/packages_to_prime.json b/tests/primer/packages_to_prime.json
index fa1457773..a7c2796e7 100644
--- a/tests/primer/packages_to_prime.json
+++ b/tests/primer/packages_to_prime.json
@@ -2,7 +2,7 @@
"astroid": {
"branch": "main",
"directories": ["astroid"],
- "url": "https://github.com/PyCQA/astroid",
+ "url": "https://github.com/pylint-dev/astroid",
"pylintrc_relpath": "pylintrc"
},
"black": {
@@ -20,6 +20,11 @@
"directories": ["src/flask"],
"url": "https://github.com/pallets/flask"
},
+ "home-assistant": {
+ "branch": "dev",
+ "directories": ["homeassistant"],
+ "url": "https://github.com/home-assistant/core.git"
+ },
"music21": {
"branch": "master",
"directories": ["music21"],
diff --git a/tests/primer/test_primer_external.py b/tests/primer/test_primer_external.py
deleted file mode 100644
index 01b1367b1..000000000
--- a/tests/primer/test_primer_external.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-from __future__ import annotations
-
-import json
-import logging
-import subprocess
-from pathlib import Path
-
-import pytest
-from pytest import LogCaptureFixture
-
-from pylint.testutils._primer import PackageToLint
-
-PRIMER_DIRECTORY = (Path("tests") / ".pylint_primer_tests/").resolve()
-
-
-def get_packages_to_lint_from_json(json_path: Path | str) -> dict[str, PackageToLint]:
- with open(json_path, encoding="utf8") as f:
- return {
- name: PackageToLint(**package_data)
- for name, package_data in json.load(f).items()
- }
-
-
-PACKAGE_TO_LINT_JSON_BATCH_ONE = (
- Path(__file__).parent / "packages_to_lint_batch_one.json"
-)
-PACKAGES_TO_LINT_BATCH_ONE = get_packages_to_lint_from_json(
- PACKAGE_TO_LINT_JSON_BATCH_ONE
-)
-"""Dictionary of external packages used during the primer test in batch one."""
-
-
-class TestPrimer:
- @staticmethod
- @pytest.mark.primer_external_batch_one
- @pytest.mark.parametrize(
- "package", PACKAGES_TO_LINT_BATCH_ONE.values(), ids=PACKAGES_TO_LINT_BATCH_ONE
- )
- def test_primer_external_packages_no_crash_batch_one(
- package: PackageToLint,
- caplog: LogCaptureFixture,
- ) -> None:
- __tracebackhide__ = True # pylint: disable=unused-variable
- TestPrimer._primer_test(package, caplog)
-
- @staticmethod
- def _primer_test(package: PackageToLint, caplog: LogCaptureFixture) -> None:
- """Runs pylint over external packages to check for crashes and fatal messages.
-
- We only check for crashes (bit-encoded exit code 32) and fatal messages
- (bit-encoded exit code 1). We assume that these external repositories do not
- have any fatal errors in their code so that any fatal errors are pylint false
- positives
- """
- caplog.set_level(logging.INFO)
- package.lazy_clone()
-
- try:
- # We want to test all the code we can
- enables = ["--enable-all-extensions", "--enable=all"]
- # Duplicate code takes too long and is relatively safe
- disables = ["--disable=duplicate-code"]
- command = ["pylint"] + enables + disables + package.pylint_args
- logging.info("Launching primer:\n%s", " ".join(command))
- subprocess.run(command, check=True)
- except subprocess.CalledProcessError as ex:
- msg = f"Encountered {{}} during primer test for {package}"
- assert ex.returncode != 32, msg.format("a crash")
- assert ex.returncode % 2 == 0, msg.format("a message of category 'fatal'")
diff --git a/tests/primer/test_primer_stdlib.py b/tests/primer/test_primer_stdlib.py
index c2d879764..ea5581749 100644
--- a/tests/primer/test_primer_stdlib.py
+++ b/tests/primer/test_primer_stdlib.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -63,7 +63,7 @@ def test_primer_stdlib_no_crash(
disables = ["--disable=duplicate-code", "--ignore=test"]
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
- Run([test_module_name] + enables + disables)
+ Run([test_module_name, *enables, *disables])
except SystemExit as ex:
out, err = capsys.readouterr()
assert not err, err
diff --git a/tests/profile/test_profile_against_externals.py b/tests/profile/test_profile_against_externals.py
index 3ee7564f0..b646ede90 100644
--- a/tests/profile/test_profile_against_externals.py
+++ b/tests/profile/test_profile_against_externals.py
@@ -1,8 +1,8 @@
"""Profiles basic -jX functionality."""
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=missing-function-docstring
diff --git a/tests/pyreverse/conftest.py b/tests/pyreverse/conftest.py
index 02a19e613..9e1741f0a 100644
--- a/tests/pyreverse/conftest.py
+++ b/tests/pyreverse/conftest.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -29,9 +29,10 @@ def colorized_dot_config() -> PyreverseConfig:
@pytest.fixture()
-def vcg_config() -> PyreverseConfig:
+def no_standalone_dot_config() -> PyreverseConfig:
return PyreverseConfig(
- output_format="vcg",
+ output_format="dot",
+ no_standalone=True,
)
diff --git a/tests/pyreverse/data/classes_No_Name.dot b/tests/pyreverse/data/classes_No_Name.dot
index 2e8830fa0..a33f65da3 100644
--- a/tests/pyreverse/data/classes_No_Name.dot
+++ b/tests/pyreverse/data/classes_No_Name.dot
@@ -11,7 +11,6 @@ charset="utf-8"
"data.property_pattern.PropertyPatterns" [color="black", fontcolor="black", label=<{PropertyPatterns|prop1<br ALIGN="LEFT"/>prop2<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
"data.clientmodule_test.Specialization" [color="black", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="solid"];
"data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"];
-"data.clientmodule_test.Ancestor" -> "data.suppliermodule_test.Interface" [arrowhead="empty", arrowtail="node", style="dashed"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"];
"data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"];
diff --git a/tests/pyreverse/data/classes_No_Name.html b/tests/pyreverse/data/classes_No_Name.html
index bed9a8d14..bf4c17d0d 100644
--- a/tests/pyreverse/data/classes_No_Name.html
+++ b/tests/pyreverse/data/classes_No_Name.html
@@ -44,7 +44,6 @@
transform_value(value: int) int
}
Specialization --|> Ancestor
- Ancestor ..|> Interface
DoNothing --* Ancestor : cls_member
DoNothing --* Specialization : relation
DoNothing2 --o Specialization : relation2
diff --git a/tests/pyreverse/data/classes_No_Name.mmd b/tests/pyreverse/data/classes_No_Name.mmd
index 53cb4fc3c..9f38089de 100644
--- a/tests/pyreverse/data/classes_No_Name.mmd
+++ b/tests/pyreverse/data/classes_No_Name.mmd
@@ -39,7 +39,6 @@ classDiagram
transform_value(value: int) int
}
Specialization --|> Ancestor
- Ancestor ..|> Interface
DoNothing --* Ancestor : cls_member
DoNothing --* Specialization : relation
DoNothing2 --o Specialization : relation2
diff --git a/tests/pyreverse/data/classes_No_Name.puml b/tests/pyreverse/data/classes_No_Name.puml
index e4d06a00c..0b01169e4 100644
--- a/tests/pyreverse/data/classes_No_Name.puml
+++ b/tests/pyreverse/data/classes_No_Name.puml
@@ -40,7 +40,6 @@ class "Specialization" as data.clientmodule_test.Specialization {
transform_value(value: int) -> int
}
data.clientmodule_test.Specialization --|> data.clientmodule_test.Ancestor
-data.clientmodule_test.Ancestor ..|> data.suppliermodule_test.Interface
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Ancestor : cls_member
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Specialization : relation
data.suppliermodule_test.DoNothing2 --o data.clientmodule_test.Specialization : relation2
diff --git a/tests/pyreverse/data/classes_colorized.dot b/tests/pyreverse/data/classes_colorized.dot
index 49dc8a7e1..729b05828 100644
--- a/tests/pyreverse/data/classes_colorized.dot
+++ b/tests/pyreverse/data/classes_colorized.dot
@@ -1,17 +1,16 @@
digraph "classes_colorized" {
rankdir=BT
charset="utf-8"
-"data.clientmodule_test.Ancestor" [color="aliceblue", fontcolor="black", label=<{Ancestor|attr : str<br ALIGN="LEFT"/>cls_member<br ALIGN="LEFT"/>|get_value()<br ALIGN="LEFT"/>set_value(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
-"data.suppliermodule_test.CustomException" [color="aliceblue", fontcolor="red", label=<{CustomException|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
-"data.suppliermodule_test.DoNothing" [color="aliceblue", fontcolor="black", label=<{DoNothing|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
-"data.suppliermodule_test.DoNothing2" [color="aliceblue", fontcolor="black", label=<{DoNothing2|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
-"data.suppliermodule_test.DoSomething" [color="aliceblue", fontcolor="black", label=<{DoSomething|my_int : Optional[int]<br ALIGN="LEFT"/>my_int_2 : Optional[int]<br ALIGN="LEFT"/>my_string : str<br ALIGN="LEFT"/>|do_it(new_int: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
-"data.suppliermodule_test.Interface" [color="aliceblue", fontcolor="black", label=<{Interface|<br ALIGN="LEFT"/>|<I>get_value</I>()<br ALIGN="LEFT"/><I>set_value</I>(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
-"data.nullable_pattern.NullablePatterns" [color="aliceblue", fontcolor="black", label=<{NullablePatterns|<br ALIGN="LEFT"/>|<I>return_nullable_1</I>(): int \| None<br ALIGN="LEFT"/><I>return_nullable_2</I>(): Optional[int]<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
-"data.property_pattern.PropertyPatterns" [color="aliceblue", fontcolor="black", label=<{PropertyPatterns|prop1<br ALIGN="LEFT"/>prop2<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
-"data.clientmodule_test.Specialization" [color="aliceblue", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"data.clientmodule_test.Ancestor" [color="#77AADD", fontcolor="black", label=<{Ancestor|attr : str<br ALIGN="LEFT"/>cls_member<br ALIGN="LEFT"/>|get_value()<br ALIGN="LEFT"/>set_value(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"data.suppliermodule_test.CustomException" [color="#77AADD", fontcolor="red", label=<{CustomException|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
+"data.suppliermodule_test.DoNothing" [color="#77AADD", fontcolor="black", label=<{DoNothing|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
+"data.suppliermodule_test.DoNothing2" [color="#77AADD", fontcolor="black", label=<{DoNothing2|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
+"data.suppliermodule_test.DoSomething" [color="#77AADD", fontcolor="black", label=<{DoSomething|my_int : Optional[int]<br ALIGN="LEFT"/>my_int_2 : Optional[int]<br ALIGN="LEFT"/>my_string : str<br ALIGN="LEFT"/>|do_it(new_int: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"data.suppliermodule_test.Interface" [color="#77AADD", fontcolor="black", label=<{Interface|<br ALIGN="LEFT"/>|<I>get_value</I>()<br ALIGN="LEFT"/><I>set_value</I>(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"data.nullable_pattern.NullablePatterns" [color="#77AADD", fontcolor="black", label=<{NullablePatterns|<br ALIGN="LEFT"/>|<I>return_nullable_1</I>(): int \| None<br ALIGN="LEFT"/><I>return_nullable_2</I>(): Optional[int]<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"data.property_pattern.PropertyPatterns" [color="#77AADD", fontcolor="black", label=<{PropertyPatterns|prop1<br ALIGN="LEFT"/>prop2<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
+"data.clientmodule_test.Specialization" [color="#77AADD", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
"data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"];
-"data.clientmodule_test.Ancestor" -> "data.suppliermodule_test.Interface" [arrowhead="empty", arrowtail="node", style="dashed"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"];
"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"];
"data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"];
diff --git a/tests/pyreverse/data/classes_colorized.puml b/tests/pyreverse/data/classes_colorized.puml
index 9c046afa0..ef97398bc 100644
--- a/tests/pyreverse/data/classes_colorized.puml
+++ b/tests/pyreverse/data/classes_colorized.puml
@@ -1,36 +1,36 @@
@startuml classes_colorized
set namespaceSeparator none
-class "Ancestor" as data.clientmodule_test.Ancestor #aliceblue {
+class "Ancestor" as data.clientmodule_test.Ancestor #77AADD {
attr : str
cls_member
get_value()
set_value(value)
}
-class "<color:red>CustomException</color>" as data.suppliermodule_test.CustomException #aliceblue {
+class "<color:red>CustomException</color>" as data.suppliermodule_test.CustomException #77AADD {
}
-class "DoNothing" as data.suppliermodule_test.DoNothing #aliceblue {
+class "DoNothing" as data.suppliermodule_test.DoNothing #77AADD {
}
-class "DoNothing2" as data.suppliermodule_test.DoNothing2 #aliceblue {
+class "DoNothing2" as data.suppliermodule_test.DoNothing2 #77AADD {
}
-class "DoSomething" as data.suppliermodule_test.DoSomething #aliceblue {
+class "DoSomething" as data.suppliermodule_test.DoSomething #77AADD {
my_int : Optional[int]
my_int_2 : Optional[int]
my_string : str
do_it(new_int: int) -> int
}
-class "Interface" as data.suppliermodule_test.Interface #aliceblue {
+class "Interface" as data.suppliermodule_test.Interface #77AADD {
{abstract}get_value()
{abstract}set_value(value)
}
-class "NullablePatterns" as data.nullable_pattern.NullablePatterns #aliceblue {
+class "NullablePatterns" as data.nullable_pattern.NullablePatterns #77AADD {
{abstract}return_nullable_1() -> int | None
{abstract}return_nullable_2() -> Optional[int]
}
-class "PropertyPatterns" as data.property_pattern.PropertyPatterns #aliceblue {
+class "PropertyPatterns" as data.property_pattern.PropertyPatterns #77AADD {
prop1
prop2
}
-class "Specialization" as data.clientmodule_test.Specialization #aliceblue {
+class "Specialization" as data.clientmodule_test.Specialization #77AADD {
TYPE : str
relation
relation2
@@ -40,7 +40,6 @@ class "Specialization" as data.clientmodule_test.Specialization #aliceblue {
transform_value(value: int) -> int
}
data.clientmodule_test.Specialization --|> data.clientmodule_test.Ancestor
-data.clientmodule_test.Ancestor ..|> data.suppliermodule_test.Interface
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Ancestor : cls_member
data.suppliermodule_test.DoNothing --* data.clientmodule_test.Specialization : relation
data.suppliermodule_test.DoNothing2 --o data.clientmodule_test.Specialization : relation2
diff --git a/tests/pyreverse/data/classes_no_standalone.dot b/tests/pyreverse/data/classes_no_standalone.dot
new file mode 100644
index 000000000..7cffc0a38
--- /dev/null
+++ b/tests/pyreverse/data/classes_no_standalone.dot
@@ -0,0 +1,12 @@
+digraph "classes_no_standalone" {
+rankdir=BT
+charset="utf-8"
+"data.clientmodule_test.Ancestor" [color="black", fontcolor="black", label=<{Ancestor|attr : str<br ALIGN="LEFT"/>cls_member<br ALIGN="LEFT"/>|get_value()<br ALIGN="LEFT"/>set_value(value)<br ALIGN="LEFT"/>}>, shape="record", style="solid"];
+"data.suppliermodule_test.DoNothing" [color="black", fontcolor="black", label=<{DoNothing|<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
+"data.suppliermodule_test.DoNothing2" [color="black", fontcolor="black", label=<{DoNothing2|<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
+"data.clientmodule_test.Specialization" [color="black", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="solid"];
+"data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"];
+"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"];
+"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"];
+"data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"];
+}
diff --git a/tests/pyreverse/data/packages_colorized.dot b/tests/pyreverse/data/packages_colorized.dot
index eacc932b1..202c9a4e5 100644
--- a/tests/pyreverse/data/packages_colorized.dot
+++ b/tests/pyreverse/data/packages_colorized.dot
@@ -1,10 +1,10 @@
digraph "packages_colorized" {
rankdir=BT
charset="utf-8"
-"data" [color="aliceblue", label=<data>, shape="box", style="filled"];
-"data.clientmodule_test" [color="aliceblue", label=<data.clientmodule_test>, shape="box", style="filled"];
-"data.nullable_pattern" [color="aliceblue", label=<data.nullable_pattern>, shape="box", style="filled"];
-"data.property_pattern" [color="aliceblue", label=<data.property_pattern>, shape="box", style="filled"];
-"data.suppliermodule_test" [color="aliceblue", label=<data.suppliermodule_test>, shape="box", style="filled"];
+"data" [color="#77AADD", label=<data>, shape="box", style="filled"];
+"data.clientmodule_test" [color="#77AADD", label=<data.clientmodule_test>, shape="box", style="filled"];
+"data.nullable_pattern" [color="#77AADD", label=<data.nullable_pattern>, shape="box", style="filled"];
+"data.property_pattern" [color="#77AADD", label=<data.property_pattern>, shape="box", style="filled"];
+"data.suppliermodule_test" [color="#77AADD", label=<data.suppliermodule_test>, shape="box", style="filled"];
"data.clientmodule_test" -> "data.suppliermodule_test" [arrowhead="open", arrowtail="none"];
}
diff --git a/tests/pyreverse/data/packages_colorized.puml b/tests/pyreverse/data/packages_colorized.puml
index 1066a9448..639c0654f 100644
--- a/tests/pyreverse/data/packages_colorized.puml
+++ b/tests/pyreverse/data/packages_colorized.puml
@@ -1,19 +1,14 @@
@startuml packages_colorized
set namespaceSeparator none
-package "data" as data #aliceblue {
-
+package "data" as data #77AADD {
}
-package "data.clientmodule_test" as data.clientmodule_test #aliceblue {
-
+package "data.clientmodule_test" as data.clientmodule_test #77AADD {
}
-package "data.nullable_pattern" as data.nullable_pattern #aliceblue {
-
+package "data.nullable_pattern" as data.nullable_pattern #77AADD {
}
-package "data.property_pattern" as data.property_pattern #aliceblue {
-
+package "data.property_pattern" as data.property_pattern #77AADD {
}
-package "data.suppliermodule_test" as data.suppliermodule_test #aliceblue {
-
+package "data.suppliermodule_test" as data.suppliermodule_test #77AADD {
}
data.clientmodule_test --> data.suppliermodule_test
@enduml
diff --git a/tests/pyreverse/data/packages_no_standalone.dot b/tests/pyreverse/data/packages_no_standalone.dot
new file mode 100644
index 000000000..008c9c5d0
--- /dev/null
+++ b/tests/pyreverse/data/packages_no_standalone.dot
@@ -0,0 +1,7 @@
+digraph "packages_no_standalone" {
+rankdir=BT
+charset="utf-8"
+"data.clientmodule_test" [color="black", label=<data.clientmodule_test>, shape="box", style="solid"];
+"data.suppliermodule_test" [color="black", label=<data.suppliermodule_test>, shape="box", style="solid"];
+"data.clientmodule_test" -> "data.suppliermodule_test" [arrowhead="open", arrowtail="none"];
+}
diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml b/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml
index a5ccf11f7..10575159d 100644
--- a/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml
+++ b/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml
@@ -1,18 +1,18 @@
@startuml classes
set namespaceSeparator none
-class "CheckerCollector" as colorized.CheckerCollector #aliceblue {
+class "CheckerCollector" as colorized.CheckerCollector #77AADD {
checker1
checker2
checker3
}
-class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #antiquewhite {
+class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #99DDFF {
msgs : dict
name : str
leave_module(_: nodes.Module) -> None
process_tokens(tokens: list[TokenInfo]) -> None
visit_if(node: nodes.If) -> None
}
-class "ExceptionsChecker" as pylint.checkers.exceptions.ExceptionsChecker #aquamarine {
+class "ExceptionsChecker" as pylint.checkers.exceptions.ExceptionsChecker #44BB99 {
msgs : dict
name : str
options : tuple
@@ -22,7 +22,7 @@ class "ExceptionsChecker" as pylint.checkers.exceptions.ExceptionsChecker #aquam
visit_raise(node: nodes.Raise) -> None
visit_tryexcept(node: nodes.TryExcept) -> None
}
-class "StdlibChecker" as pylint.checkers.stdlib.StdlibChecker #aquamarine {
+class "StdlibChecker" as pylint.checkers.stdlib.StdlibChecker #44BB99 {
msgs : dict[str, MessageDefinitionTuple]
name : str
deprecated_arguments(method: str) -> tuple[tuple[int | None, str], ...]
diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot
new file mode 100644
index 000000000..7263cf8f5
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot
@@ -0,0 +1,11 @@
+digraph "classes" {
+rankdir=BT
+charset="utf-8"
+"custom_colors.CheckerCollector" [color="red", fontcolor="black", label=<{CheckerCollector|checker1<br ALIGN="LEFT"/>checker2<br ALIGN="LEFT"/>checker3<br ALIGN="LEFT"/>|}>, shape="record", style="filled"];
+"pylint.extensions.check_elif.ElseifUsedChecker" [color="#44BB88", fontcolor="black", label=<{ElseifUsedChecker|msgs : dict<br ALIGN="LEFT"/>name : str<br ALIGN="LEFT"/>|leave_module(_: nodes.Module): None<br ALIGN="LEFT"/>process_tokens(tokens: list[TokenInfo]): None<br ALIGN="LEFT"/>visit_if(node: nodes.If): None<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"pylint.checkers.exceptions.ExceptionsChecker" [color="yellow", fontcolor="black", label=<{ExceptionsChecker|msgs : dict<br ALIGN="LEFT"/>name : str<br ALIGN="LEFT"/>options : tuple<br ALIGN="LEFT"/>|open(): None<br ALIGN="LEFT"/>visit_binop(node: nodes.BinOp): None<br ALIGN="LEFT"/>visit_compare(node: nodes.Compare): None<br ALIGN="LEFT"/>visit_raise(node: nodes.Raise): None<br ALIGN="LEFT"/>visit_tryexcept(node: nodes.TryExcept): None<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"pylint.checkers.stdlib.StdlibChecker" [color="yellow", fontcolor="black", label=<{StdlibChecker|msgs : dict[str, MessageDefinitionTuple]<br ALIGN="LEFT"/>name : str<br ALIGN="LEFT"/>|deprecated_arguments(method: str): tuple[tuple[int \| None, str], ...]<br ALIGN="LEFT"/>deprecated_classes(module: str): Iterable[str]<br ALIGN="LEFT"/>deprecated_decorators(): Iterable[str]<br ALIGN="LEFT"/>deprecated_methods(): set[str]<br ALIGN="LEFT"/>visit_boolop(node: nodes.BoolOp): None<br ALIGN="LEFT"/>visit_call(node: nodes.Call): None<br ALIGN="LEFT"/>visit_functiondef(node: nodes.FunctionDef): None<br ALIGN="LEFT"/>visit_if(node: nodes.If): None<br ALIGN="LEFT"/>visit_ifexp(node: nodes.IfExp): None<br ALIGN="LEFT"/>visit_unaryop(node: nodes.UnaryOp): None<br ALIGN="LEFT"/>}>, shape="record", style="filled"];
+"pylint.checkers.exceptions.ExceptionsChecker" -> "custom_colors.CheckerCollector" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="checker1", style="solid"];
+"pylint.checkers.stdlib.StdlibChecker" -> "custom_colors.CheckerCollector" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="checker3", style="solid"];
+"pylint.extensions.check_elif.ElseifUsedChecker" -> "custom_colors.CheckerCollector" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="checker2", style="solid"];
+}
diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml
index 34dc814ff..f2cea9f63 100644
--- a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml
+++ b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml
@@ -5,7 +5,7 @@ class "CheckerCollector" as custom_colors.CheckerCollector #red {
checker2
checker3
}
-class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #green {
+class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #44BB88 {
msgs : dict
name : str
leave_module(_: nodes.Module) -> None
diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc
index ea30ad4a4..08f68bbb3 100644
--- a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc
+++ b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc
@@ -1,3 +1,3 @@
[testoptions]
-output_formats=puml
-command_line_args=-S --colorized --max-color-depth=2 --color-palette=red,green,yellow
+output_formats=puml,dot
+command_line_args=-S --colorized --max-color-depth=2 --color-palette=red,#44BB88,yellow
diff --git a/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd
new file mode 100644
index 000000000..646d8220d
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd
@@ -0,0 +1,6 @@
+classDiagram
+ class A {
+ }
+ class B {
+ }
+ B --|> A
diff --git a/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py
new file mode 100644
index 000000000..3d881d4c0
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py
@@ -0,0 +1,5 @@
+class A: pass
+
+class B(A): pass
+
+class C: pass
diff --git a/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc
new file mode 100644
index 000000000..c17e41cfb
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc
@@ -0,0 +1,2 @@
+[testoptions]
+command_line_args=--no-standalone
diff --git a/tests/pyreverse/test_diadefs.py b/tests/pyreverse/test_diadefs.py
index 96cafc2ef..cdcdea7c5 100644
--- a/tests/pyreverse/test_diadefs.py
+++ b/tests/pyreverse/test_diadefs.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unit test for the extensions.diadefslib modules."""
@@ -13,7 +13,7 @@ from collections.abc import Iterator
from pathlib import Path
import pytest
-from astroid import nodes
+from astroid import extract_node, nodes
from pylint.pyreverse.diadefslib import (
ClassDiadefGenerator,
@@ -97,19 +97,61 @@ def test_default_values() -> None:
# TODO : should test difference between default values for package or class diagrams
+class TestShowOptions:
+ def test_show_stdlib(self) -> None:
+ example = extract_node(
+ '''
+ import collections
+
+ class CustomDict(collections.OrderedDict):
+ """docstring"""
+ '''
+ )
+
+ config = PyreverseConfig()
+ dd_gen = DiaDefGenerator(Linker(PROJECT), DiadefsHandler(config))
+
+ # Default behavior
+ assert not list(dd_gen.get_ancestors(example, 1))
+
+ # Show standard library enabled
+ config.show_stdlib = True
+ ancestors = list(dd_gen.get_ancestors(example, 1))
+ assert len(ancestors) == 1
+ assert ancestors[0].name == "OrderedDict"
+
+ def test_show_builtin(self) -> None:
+ example = extract_node(
+ '''
+ class CustomError(Exception):
+ """docstring"""
+ '''
+ )
+
+ config = PyreverseConfig()
+ dd_gen = DiaDefGenerator(Linker(PROJECT), DiadefsHandler(config))
+
+ # Default behavior
+ assert not list(dd_gen.get_ancestors(example, 1))
+
+ # Show builtin enabled
+ config.show_builtin = True
+ ancestors = list(dd_gen.get_ancestors(example, 1))
+ assert len(ancestors) == 1
+ assert ancestors[0].name == "Exception"
+
+
class TestDefaultDiadefGenerator:
_should_rels = [
("aggregation", "DoNothing2", "Specialization"),
("association", "DoNothing", "Ancestor"),
("association", "DoNothing", "Specialization"),
- ("implements", "Ancestor", "Interface"),
("specialization", "Specialization", "Ancestor"),
]
def test_extract_relations(self, HANDLER: DiadefsHandler, PROJECT: Project) -> None:
"""Test extract_relations between classes."""
- with pytest.warns(DeprecationWarning):
- cd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)[1]
+ cd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)[1]
cd.extract_relationships()
relations = _process_relations(cd.relationships)
assert relations == self._should_rels
diff --git a/tests/pyreverse/test_diagrams.py b/tests/pyreverse/test_diagrams.py
index 863bcecc9..761aa0692 100644
--- a/tests/pyreverse/test_diagrams.py
+++ b/tests/pyreverse/test_diagrams.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unit test for the diagrams modules."""
diff --git a/tests/pyreverse/test_inspector.py b/tests/pyreverse/test_inspector.py
index 54fff0896..d28d99584 100644
--- a/tests/pyreverse/test_inspector.py
+++ b/tests/pyreverse/test_inspector.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""For the visitors.diadefs module."""
@@ -15,7 +15,6 @@ from pathlib import Path
import astroid
import pytest
-from astroid import nodes
from pylint.pyreverse import inspector
from pylint.pyreverse.inspector import Project
@@ -37,20 +36,6 @@ def project(get_project: GetProjectCallable) -> Generator[Project, None, None]:
yield project
-def test_class_implements(project: Project) -> None:
- klass = project.get_module("data.clientmodule_test")["Ancestor"]
- assert hasattr(klass, "implements")
- assert len(klass.implements) == 1
- assert isinstance(klass.implements[0], nodes.ClassDef)
- assert klass.implements[0].name == "Interface"
-
-
-def test_class_implements_specialization(project: Project) -> None:
- klass = project.get_module("data.clientmodule_test")["Specialization"]
- assert hasattr(klass, "implements")
- assert len(klass.implements) == 0
-
-
def test_locals_assignment_resolution(project: Project) -> None:
klass = project.get_module("data.clientmodule_test")["Specialization"]
assert hasattr(klass, "locals_type")
@@ -78,54 +63,6 @@ def test_instance_attrs_resolution(project: Project) -> None:
assert type_dict["_id"][0] is astroid.Uninferable
-def test_concat_interfaces() -> None:
- cls = astroid.extract_node(
- '''
- class IMachin: pass
-
- class Correct2:
- """docstring"""
- __implements__ = (IMachin,)
-
- class BadArgument:
- """docstring"""
- __implements__ = (IMachin,)
-
- class InterfaceCanNowBeFound: #@
- """docstring"""
- __implements__ = BadArgument.__implements__ + Correct2.__implements__
- '''
- )
- interfaces = inspector.interfaces(cls)
- assert [i.name for i in interfaces] == ["IMachin"]
-
-
-def test_interfaces() -> None:
- module = astroid.parse(
- """
- class Interface(object): pass
- class MyIFace(Interface): pass
- class AnotherIFace(Interface): pass
- class Concrete0(object):
- __implements__ = MyIFace
- class Concrete1:
- __implements__ = (MyIFace, AnotherIFace)
- class Concrete2:
- __implements__ = (MyIFace, AnotherIFace)
- class Concrete23(Concrete1): pass
- """
- )
-
- for klass, interfaces in (
- ("Concrete0", ["MyIFace"]),
- ("Concrete1", ["MyIFace", "AnotherIFace"]),
- ("Concrete2", ["MyIFace", "AnotherIFace"]),
- ("Concrete23", []),
- ):
- klass = module[klass]
- assert [i.name for i in inspector.interfaces(klass)] == interfaces
-
-
def test_from_directory(project: Project) -> None:
expected = os.path.join("tests", "data", "__init__.py")
assert project.name == "data"
@@ -141,18 +78,3 @@ def test_project_node(project: Project) -> None:
"data.suppliermodule_test",
]
assert sorted(project.keys()) == expected
-
-
-def test_interface_deprecation(project: Project) -> None:
- linker = inspector.Linker(project)
- cls = astroid.extract_node(
- '''
- class IMachin: pass
-
- class Concrete: #@
- """docstring"""
- __implements__ = (IMachin,)
- '''
- )
- with pytest.warns(DeprecationWarning):
- linker.visit_classdef(cls)
diff --git a/tests/pyreverse/test_main.py b/tests/pyreverse/test_main.py
index 86401e05b..350550585 100644
--- a/tests/pyreverse/test_main.py
+++ b/tests/pyreverse/test_main.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unittest for the main module."""
@@ -138,6 +138,7 @@ def test_graphviz_unsupported_image_format(capsys: CaptureFixture) -> None:
("show_associated", None),
("all_associated", None),
("show_builtin", 0),
+ ("show_stdlib", 0),
("module_names", None),
("output_format", "dot"),
("colorized", 0),
diff --git a/tests/pyreverse/test_printer.py b/tests/pyreverse/test_printer.py
index 4248e8bae..67b4186b8 100644
--- a/tests/pyreverse/test_printer.py
+++ b/tests/pyreverse/test_printer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
@@ -10,7 +10,6 @@ from astroid import nodes
from pylint.pyreverse.dot_printer import DotPrinter
from pylint.pyreverse.plantuml_printer import PlantUmlPrinter
from pylint.pyreverse.printer import Layout, NodeType, Printer
-from pylint.pyreverse.vcg_printer import VCGPrinter
@pytest.mark.parametrize(
@@ -20,10 +19,6 @@ from pylint.pyreverse.vcg_printer import VCGPrinter
(Layout.BOTTOM_TO_TOP, DotPrinter, "rankdir=BT", -2),
(Layout.LEFT_TO_RIGHT, DotPrinter, "rankdir=LR", -2),
(Layout.RIGHT_TO_LEFT, DotPrinter, "rankdir=RL", -2),
- (Layout.TOP_TO_BOTTOM, VCGPrinter, "orientation:top_to_bottom", -1),
- (Layout.BOTTOM_TO_TOP, VCGPrinter, "orientation:bottom_to_top", -1),
- (Layout.LEFT_TO_RIGHT, VCGPrinter, "orientation:left_to_right", -1),
- (Layout.RIGHT_TO_LEFT, VCGPrinter, "orientation:right_to_left", -1),
(Layout.TOP_TO_BOTTOM, PlantUmlPrinter, "top to bottom direction", -1),
(Layout.LEFT_TO_RIGHT, PlantUmlPrinter, "left to right direction", -1),
],
@@ -45,8 +40,15 @@ def test_unsupported_layout(layout: Layout, printer_class: type[Printer]) -> Non
def test_method_arguments_none() -> None:
- func = nodes.FunctionDef()
- args = nodes.Arguments()
+ func = nodes.FunctionDef(
+ name="func",
+ lineno=1,
+ col_offset=0,
+ end_lineno=None,
+ end_col_offset=None,
+ parent=None,
+ )
+ args = nodes.Arguments(vararg=None, kwarg=None, parent=func)
args.args = None
func.postinit(args, body=None)
parsed_args = Printer._get_method_arguments(func)
diff --git a/tests/pyreverse/test_printer_factory.py b/tests/pyreverse/test_printer_factory.py
index 76406f0a8..23055be28 100644
--- a/tests/pyreverse/test_printer_factory.py
+++ b/tests/pyreverse/test_printer_factory.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unit tests for pylint.pyreverse.printer_factory."""
@@ -12,13 +12,11 @@ from pylint.pyreverse import printer_factory
from pylint.pyreverse.dot_printer import DotPrinter
from pylint.pyreverse.plantuml_printer import PlantUmlPrinter
from pylint.pyreverse.printer import Printer
-from pylint.pyreverse.vcg_printer import VCGPrinter
@pytest.mark.parametrize(
"filetype, expected_printer_class",
[
- ("vcg", VCGPrinter),
("dot", DotPrinter),
("puml", PlantUmlPrinter),
("plantuml", PlantUmlPrinter),
diff --git a/tests/pyreverse/test_pyreverse_functional.py b/tests/pyreverse/test_pyreverse_functional.py
index aab500b81..715ad3dad 100644
--- a/tests/pyreverse/test_pyreverse_functional.py
+++ b/tests/pyreverse/test_pyreverse_functional.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import os
from pathlib import Path
diff --git a/tests/pyreverse/test_utils.py b/tests/pyreverse/test_utils.py
index d64bf4fa7..ef843fd29 100644
--- a/tests/pyreverse/test_utils.py
+++ b/tests/pyreverse/test_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Tests for pylint.pyreverse.utils."""
diff --git a/tests/pyreverse/test_writer.py b/tests/pyreverse/test_writer.py
index 0bf92d918..ed0f5b31e 100644
--- a/tests/pyreverse/test_writer.py
+++ b/tests/pyreverse/test_writer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Unit test for ``DiagramWriter``."""
@@ -10,9 +10,11 @@ import codecs
import os
from collections.abc import Iterator
from difflib import unified_diff
+from pathlib import Path
from unittest.mock import Mock
import pytest
+from pytest import MonkeyPatch
from pylint.pyreverse.diadefslib import DefaultDiadefGenerator, DiadefsHandler
from pylint.pyreverse.inspector import Linker, Project
@@ -32,19 +34,21 @@ _DEFAULTS = {
"all_associated": None,
"mode": "PUB_ONLY",
"show_builtin": False,
+ "show_stdlib": False,
"only_classnames": False,
"output_directory": "",
+ "no_standalone": False,
}
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data")
DOT_FILES = ["packages_No_Name.dot", "classes_No_Name.dot"]
COLORIZED_DOT_FILES = ["packages_colorized.dot", "classes_colorized.dot"]
-VCG_FILES = ["packages_No_Name.vcg", "classes_No_Name.vcg"]
PUML_FILES = ["packages_No_Name.puml", "classes_No_Name.puml"]
COLORIZED_PUML_FILES = ["packages_colorized.puml", "classes_colorized.puml"]
MMD_FILES = ["packages_No_Name.mmd", "classes_No_Name.mmd"]
HTML_FILES = ["packages_No_Name.html", "classes_No_Name.html"]
+NO_STANDALONE_FILES = ["classes_no_standalone.dot", "packages_no_standalone.dot"]
class Config:
@@ -69,6 +73,11 @@ def _file_lines(path: str) -> list[str]:
return [line for line in lines if line]
+@pytest.fixture(autouse=True)
+def change_to_temp_dir(monkeypatch: MonkeyPatch, tmp_path: Path) -> None:
+ monkeypatch.chdir(tmp_path)
+
+
@pytest.fixture()
def setup_dot(
default_config: PyreverseConfig, get_project: GetProjectCallable
@@ -88,12 +97,12 @@ def setup_colorized_dot(
@pytest.fixture()
-def setup_vcg(
- vcg_config: PyreverseConfig, get_project: GetProjectCallable
+def setup_no_standalone_dot(
+ no_standalone_dot_config: PyreverseConfig, get_project: GetProjectCallable
) -> Iterator[None]:
- writer = DiagramWriter(vcg_config)
- project = get_project(TEST_DATA_DIR)
- yield from _setup(project, vcg_config, writer)
+ writer = DiagramWriter(no_standalone_dot_config)
+ project = get_project(TEST_DATA_DIR, name="no_standalone")
+ yield from _setup(project, no_standalone_dot_config, writer)
@pytest.fixture()
@@ -144,19 +153,6 @@ def _setup(
diagram.extract_relationships()
writer.write(dd)
yield
- for fname in (
- DOT_FILES
- + COLORIZED_DOT_FILES
- + VCG_FILES
- + PUML_FILES
- + COLORIZED_PUML_FILES
- + MMD_FILES
- + HTML_FILES
- ):
- try:
- os.remove(fname)
- except FileNotFoundError:
- continue
@pytest.mark.usefixtures("setup_dot")
@@ -171,9 +167,9 @@ def test_colorized_dot_files(generated_file: str) -> None:
_assert_files_are_equal(generated_file)
-@pytest.mark.usefixtures("setup_vcg")
-@pytest.mark.parametrize("generated_file", VCG_FILES)
-def test_vcg_files(generated_file: str) -> None:
+@pytest.mark.usefixtures("setup_no_standalone_dot")
+@pytest.mark.parametrize("generated_file", NO_STANDALONE_FILES)
+def test_no_standalone_dot_files(generated_file: str) -> None:
_assert_files_are_equal(generated_file)
@@ -238,5 +234,3 @@ def test_package_name_with_slash(default_config: PyreverseConfig) -> None:
writer.write([obj])
assert os.path.exists("test_package_name_with_slash_.dot")
- # remove the generated file
- os.remove("test_package_name_with_slash_.dot")
diff --git a/tests/regrtest_data/line_too_long_no_code.py b/tests/regrtest_data/line_too_long_no_code.py
index 75ab07fc2..07fada40d 100644
--- a/tests/regrtest_data/line_too_long_no_code.py
+++ b/tests/regrtest_data/line_too_long_no_code.py
@@ -1,2 +1,2 @@
# ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # pylint: disable=line-too-long
-# See https://github.com/PyCQA/pylint/issues/3368
+# See https://github.com/pylint-dev/pylint/issues/3368
diff --git a/tests/regrtest_data/max_inferable_limit_for_classes/main.py b/tests/regrtest_data/max_inferable_limit_for_classes/main.py
index 2588d916f..5f64c2e57 100644
--- a/tests/regrtest_data/max_inferable_limit_for_classes/main.py
+++ b/tests/regrtest_data/max_inferable_limit_for_classes/main.py
@@ -1,6 +1,6 @@
"""This example is based on sqlalchemy.
-See https://github.com/PyCQA/pylint/issues/5679
+See https://github.com/pylint-dev/pylint/issues/5679
"""
from other_funcs import FromClause
diff --git a/tests/reporters/unittest_json_reporter.py b/tests/reporters/unittest_json_reporter.py
index 9104016ea..0182ebd1a 100644
--- a/tests/reporters/unittest_json_reporter.py
+++ b/tests/reporters/unittest_json_reporter.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test for the JSON reporter."""
diff --git a/tests/reporters/unittest_reporting.py b/tests/reporters/unittest_reporting.py
index 40a18036a..98cd17923 100644
--- a/tests/reporters/unittest_reporting.py
+++ b/tests/reporters/unittest_reporting.py
@@ -1,12 +1,11 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
from __future__ import annotations
-import sys
import warnings
from contextlib import redirect_stdout
from io import StringIO
@@ -15,7 +14,6 @@ from pathlib import Path
from typing import TYPE_CHECKING, TextIO
import pytest
-from _pytest.recwarn import WarningsRecorder
from pylint import checkers
from pylint.interfaces import HIGH
@@ -128,16 +126,6 @@ def test_template_option_with_header(linter: PyLinter) -> None:
assert out_lines[2] == '{ "Category": "convention" }'
-def test_deprecation_set_output(recwarn: WarningsRecorder) -> None:
- """TODO remove in 3.0."""
- reporter = BaseReporter()
- # noinspection PyDeprecation
- reporter.set_output(sys.stdout)
- warning = recwarn.pop()
- assert "set_output' will be removed in 3.0" in str(warning)
- assert reporter.out == sys.stdout
-
-
def test_parseable_output_deprecated() -> None:
with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
diff --git a/tests/test_check_parallel.py b/tests/test_check_parallel.py
index 9134d485b..24f958406 100644
--- a/tests/test_check_parallel.py
+++ b/tests/test_check_parallel.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Puts the check_parallel system under test."""
@@ -188,7 +188,7 @@ class TestCheckParallelFramework:
See:
https://stackoverflow.com/questions/8804830/python-multiprocessing-picklingerror-cant-pickle-type-function
- https://github.com/PyCQA/pylint/pull/5584
+ https://github.com/pylint-dev/pylint/pull/5584
"""
linter = PyLinter(reporter=Reporter())
linter.attribute = argparse.ArgumentParser() # type: ignore[attr-defined]
@@ -548,7 +548,7 @@ class TestCheckParallel:
The intent here is to validate the reduce step: no stats should be lost.
- Checks regression of https://github.com/PyCQA/pylint/issues/4118
+ Checks regression of https://github.com/pylint-dev/pylint/issues/4118
"""
# define the stats we expect to get back from the runs, these should only vary
diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
deleted file mode 100644
index ed57c7306..000000000
--- a/tests/test_deprecation.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Check deprecation across the codebase."""
-
-from __future__ import annotations
-
-from typing import Any
-
-import pytest
-from astroid import nodes
-
-from pylint import lint
-from pylint.checkers import BaseChecker
-from pylint.checkers.mapreduce_checker import MapReduceMixin
-from pylint.config import load_results, save_results
-from pylint.interfaces import (
- IAstroidChecker,
- IChecker,
- Interface,
- IRawChecker,
- IReporter,
- ITokenChecker,
-)
-from pylint.lint import PyLinter
-from pylint.message import MessageDefinitionStore
-from pylint.reporters import BaseReporter
-from pylint.reporters.ureports.nodes import Section
-from pylint.utils import FileState
-
-
-def test_mapreducemixin() -> None:
- """Test that MapReduceMixin has been deprecated correctly."""
-
- class MyChecker(MapReduceMixin):
- def get_map_data(self) -> Any:
- ...
-
- def reduce_map_data(self, linter: PyLinter, data: list[Any]) -> None:
- ...
-
- with pytest.warns(DeprecationWarning):
- MyChecker()
-
-
-def test_reporter_implements() -> None:
- """Test that __implements__ on BaseReporter has been deprecated correctly."""
-
- class MyReporter(BaseReporter):
- __implements__ = IReporter
-
- def _display(self, layout: Section) -> None:
- ...
-
- with pytest.warns(DeprecationWarning):
- MyReporter()
-
-
-def test_checker_implements() -> None:
- """Test that __implements__ on BaseChecker has been deprecated correctly."""
-
- class MyChecker(BaseChecker):
- __implements__ = IAstroidChecker
-
- with pytest.warns(DeprecationWarning):
- MyChecker(PyLinter())
-
-
-def test_interfaces() -> None:
- """Test that all interfaces have been deprecated correctly."""
- with pytest.warns(DeprecationWarning):
- Interface()
- with pytest.warns(DeprecationWarning):
- IAstroidChecker()
- with pytest.warns(DeprecationWarning):
- IReporter()
- with pytest.warns(DeprecationWarning):
- IRawChecker()
- with pytest.warns(DeprecationWarning):
- IChecker()
- with pytest.warns(DeprecationWarning):
- ITokenChecker()
-
-
-def test_load_and_save_results() -> None:
- """Test that load_results and save_results are deprecated."""
- with pytest.warns(DeprecationWarning):
- save_results(object(), "") # type: ignore[arg-type]
- with pytest.warns(DeprecationWarning):
- load_results("")
-
-
-def test_filestate() -> None:
- """Test that FileState needs its arguments."""
- with pytest.warns(DeprecationWarning):
- FileState()
- with pytest.warns(DeprecationWarning):
- FileState("foo")
- with pytest.warns(DeprecationWarning):
- FileState(msg_store=MessageDefinitionStore())
- FileState("foo", MessageDefinitionStore())
-
-
-def test_collectblocklines() -> None:
- """Test FileState.collect_block_lines."""
- state = FileState("foo", MessageDefinitionStore())
- with pytest.warns(DeprecationWarning):
- state.collect_block_lines(MessageDefinitionStore(), nodes.Module("foo"))
-
-
-def test_patch_sys_path() -> None:
- """Test that _patch_sys_path() is deprecated"""
- with pytest.deprecated_call():
- lint._patch_sys_path([])
-
-
-def test_fix_import_path() -> None:
- """Test that fix_import_path() is deprecated"""
- with pytest.deprecated_call():
- with lint.fix_import_path([]):
- pass
diff --git a/tests/test_epylint.py b/tests/test_epylint.py
deleted file mode 100644
index 7e9116e99..000000000
--- a/tests/test_epylint.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-
-"""Test for issue https://github.com/PyCQA/pylint/issues/4286."""
-# pylint: disable=redefined-outer-name
-from pathlib import PosixPath
-
-import pytest
-
-from pylint import epylint as lint
-
-
-@pytest.fixture()
-def example_path(tmp_path: PosixPath) -> PosixPath:
- content = """class IvrAudioApp:
-
- def run(self):
- self.hassan()
- """
- path = tmp_path / "my_app.py"
- with open(path, "w", encoding="utf-8") as f:
- f.write(content)
- return path
-
-
-def test_epylint_good_command(example_path: PosixPath) -> None:
- with pytest.warns(DeprecationWarning):
- out, _ = lint.py_run(
- f"{example_path} -E --disable=E1111 --msg-template "
- "'{category} {module} {obj} {line} {column} {msg}'",
- return_std=True,
- )
- msg = out.read()
- assert (
- msg
- == """\
-************* Module my_app
- error my_app IvrAudioApp.run 4 8 Instance of 'IvrAudioApp' has no 'hassan' member
- """
- )
-
-
-def test_epylint_strange_command(example_path: PosixPath) -> None:
- with pytest.warns(DeprecationWarning):
- out, _ = lint.py_run(
- # pylint: disable-next=consider-using-f-string
- "%s -E --disable=E1111 --msg-template={category} {module} {obj} {line} {column} {msg}"
- % example_path,
- return_std=True,
- )
- assert (
- out.read()
- == """\
-************* Module {module}
- fatal
- ************* Module {obj}
- fatal
- ************* Module {line}
- fatal
- ************* Module {column}
- fatal
- ************* Module {msg}
- fatal
- ************* Module my_app
- error
- """
- )
diff --git a/tests/test_func.py b/tests/test_func.py
index be0160ea0..d74e7ac6f 100644
--- a/tests/test_func.py
+++ b/tests/test_func.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Functional/non regression tests for pylint."""
@@ -72,7 +72,7 @@ class LintTestUsingModule:
try:
self.linter.check(tocheck)
except Exception as ex:
- print(f"Exception: {ex} in {tocheck}:: {'‚ '.join(ex.args)}")
+ print(f"Exception: {ex} in {tocheck}:: {', '.join(ex.args)}")
# This is legacy code we're trying to remove, not worth it to type correctly
ex.file = tocheck # type: ignore[attr-defined]
print(ex)
@@ -115,7 +115,7 @@ def gen_tests(
is_to_run = re.compile(filter_rgx).search
else:
is_to_run = ( # noqa: E731, We're going to throw all this anyway
- lambda x: 1 # type: ignore[assignment,misc] # pylint: disable=unnecessary-lambda-assignment
+ lambda x: 1 # type: ignore[assignment] # pylint: disable=unnecessary-lambda-assignment
)
tests: list[tuple[str, str, list[tuple[str, str]]]] = []
for module_file, messages_file in _get_tests_info(INPUT_DIR, MSG_DIR, "func_", ""):
diff --git a/tests/test_functional.py b/tests/test_functional.py
index 77cdbc58f..13bb060b7 100644
--- a/tests/test_functional.py
+++ b/tests/test_functional.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Functional full-module tests for PyLint."""
diff --git a/tests/test_functional_directories.py b/tests/test_functional_directories.py
index f75772332..59a2eddfb 100644
--- a/tests/test_functional_directories.py
+++ b/tests/test_functional_directories.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test that the directory structure of the functional tests is correct."""
from pathlib import Path
diff --git a/tests/test_import_graph.py b/tests/test_import_graph.py
index 2ad51f889..20cbdff00 100644
--- a/tests/test_import_graph.py
+++ b/tests/test_import_graph.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
diff --git a/tests/test_numversion.py b/tests/test_numversion.py
index 2c34c1aa3..d19c6a31e 100644
--- a/tests/test_numversion.py
+++ b/tests/test_numversion.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/test_pragma_parser.py b/tests/test_pragma_parser.py
index 3590950f4..b686c0042 100644
--- a/tests/test_pragma_parser.py
+++ b/tests/test_pragma_parser.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import pytest
diff --git a/tests/test_pylint_runners.py b/tests/test_pylint_runners.py
index 6a55db9eb..f3baee24b 100644
--- a/tests/test_pylint_runners.py
+++ b/tests/test_pylint_runners.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=missing-module-docstring, missing-function-docstring
from __future__ import annotations
@@ -12,21 +12,16 @@ import shlex
import sys
from collections.abc import Sequence
from io import BufferedReader
-from typing import Any, NoReturn
+from typing import Any, NoReturn, Protocol
from unittest.mock import MagicMock, mock_open, patch
import pytest
-from pylint import run_epylint, run_pylint, run_pyreverse, run_symilar
+from pylint import run_pylint, run_pyreverse, run_symilar
from pylint.testutils import GenericTestReporter as Reporter
from pylint.testutils._run import _Run as Run
from pylint.testutils.utils import _test_cwd
-if sys.version_info >= (3, 8):
- from typing import Protocol
-else:
- from typing_extensions import Protocol
-
class _RunCallable(Protocol): # pylint: disable=too-few-public-methods
def __call__(self, argv: Sequence[str] | None = None) -> NoReturn | None:
@@ -44,17 +39,6 @@ def test_runner(runner: _RunCallable, tmp_path: pathlib.Path) -> None:
assert err.value.code == 0
-def test_epylint(tmp_path: pathlib.Path) -> None:
- """TODO: 3.0 delete with epylint."""
- filepath = os.path.abspath(__file__)
- with _test_cwd(tmp_path):
- with patch.object(sys, "argv", ["", filepath]):
- with pytest.raises(SystemExit) as err:
- with pytest.warns(DeprecationWarning):
- run_epylint()
- assert err.value.code == 0
-
-
@pytest.mark.parametrize("runner", [run_pylint, run_pyreverse, run_symilar])
def test_runner_with_arguments(runner: _RunCallable, tmp_path: pathlib.Path) -> None:
"""Check the runners with arguments as parameter instead of sys.argv."""
@@ -66,25 +50,14 @@ def test_runner_with_arguments(runner: _RunCallable, tmp_path: pathlib.Path) ->
assert err.value.code == 0
-def test_epylint_with_arguments(tmp_path: pathlib.Path) -> None:
- """TODO: 3.0 delete with epylint."""
- filepath = os.path.abspath(__file__)
- testargs = [filepath]
- with _test_cwd(tmp_path):
- with pytest.raises(SystemExit) as err:
- with pytest.warns(DeprecationWarning):
- run_epylint(testargs)
- assert err.value.code == 0
-
-
def test_pylint_argument_deduplication(
tmp_path: pathlib.Path, tests_directory: pathlib.Path
) -> None:
"""Check that the Pylint runner does not over-report on duplicate
arguments.
- See https://github.com/PyCQA/pylint/issues/6242 and
- https://github.com/PyCQA/pylint/issues/4053
+ See https://github.com/pylint-dev/pylint/issues/6242 and
+ https://github.com/pylint-dev/pylint/issues/4053
"""
filepath = str(tests_directory / "functional/t/too/too_many_branches.py")
testargs = shlex.split("--report n --score n --max-branches 13")
diff --git a/tests/test_regr.py b/tests/test_regr.py
index eb8ad6c5d..d92742943 100644
--- a/tests/test_regr.py
+++ b/tests/test_regr.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Non regression tests for pylint, which requires a too specific configuration
to be incorporated in the automatic functional test framework
@@ -16,7 +16,6 @@ from collections.abc import Callable, Iterator
from os.path import abspath, dirname, join
from typing import cast
-import astroid
import pytest
from pylint import testutils
@@ -122,28 +121,6 @@ def test_check_package___init__(finalize_linter: PyLinter) -> None:
assert checked == ["__init__"]
-# TODO: 3.0: Test are broken because of property shenanigans of config attribute
-# Re-enable after some of the old attributes have been removed after deprecation period
-@pytest.mark.xfail
-def test_pylint_config_attr() -> None:
- mod = astroid.MANAGER.ast_from_module_name("pylint.lint.pylinter")
- pylinter = mod["PyLinter"]
- expect = [
- "_ArgumentsManager",
- "object",
- "ReportsHandlerMixIn",
- "BaseTokenChecker",
- "BaseChecker",
- "_ArgumentsProvider",
- ]
- assert [c.name for c in pylinter.ancestors()] == expect
- assert list(astroid.Instance(pylinter).getattr("config"))
- inferred = list(astroid.Instance(pylinter).igetattr("config"))
- assert len(inferred) >= 1
- assert inferred[0].root().name == "argparse"
- assert inferred[0].name == "Namespace"
-
-
@pytest.mark.timeout(30)
@pytest.mark.parametrize("file_names", ([join(REGR_DATA, "hang", "pkg4972.string")],))
def test_hang(finalize_linter: PyLinter, file_names: list[str]) -> None:
diff --git a/tests/test_self.py b/tests/test_self.py
index e40dd7a4d..48f914e35 100644
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=too-many-public-methods
@@ -10,7 +10,6 @@ import configparser
import contextlib
import json
import os
-import platform
import re
import subprocess
import sys
@@ -133,7 +132,7 @@ class TestRunTC:
@staticmethod
def _run_pylint(args: list[str], out: TextIO, reporter: Any = None) -> int:
- args = _add_rcfile_default_pylintrc(args + ["--persistent=no"])
+ args = _add_rcfile_default_pylintrc([*args, "--persistent=no"])
with _patch_streams(out):
with pytest.raises(SystemExit) as cm:
with warnings.catch_warnings():
@@ -257,9 +256,9 @@ class TestRunTC:
expected = textwrap.dedent(
f"""
************* Module data.clientmodule_test
- {module}:10:8: W0612: Unused variable 'local_variable' (unused-variable)
- {module}:18:4: C0116: Missing function or method docstring (missing-function-docstring)
- {module}:22:0: C0115: Missing class docstring (missing-class-docstring)
+ {module}:9:8: W0612: Unused variable 'local_variable' (unused-variable)
+ {module}:17:4: C0116: Missing function or method docstring (missing-function-docstring)
+ {module}:21:0: C0115: Missing class docstring (missing-class-docstring)
"""
)
self._test_output(
@@ -301,7 +300,7 @@ class TestRunTC:
An import inside `module_a`, which is used as a type annotation in `module_a`, should not prevent
emitting the `unused-import` message when the same import occurs in `module_b` & is unused.
- See: https://github.com/PyCQA/pylint/issues/4150
+ See: https://github.com/pylint-dev/pylint/issues/4150
"""
module1 = join(
HERE, "regrtest_data", "imported_module_in_typehint", "module_a.py"
@@ -349,16 +348,9 @@ class TestRunTC:
assert isinstance(output, list)
assert len(output) == 1
assert isinstance(output[0], dict)
- # So each version wants a different column number...
- if platform.python_implementation() == "PyPy":
- column = 9
- elif sys.version_info >= (3, 8):
- column = 9
- else:
- column = 15
expected = {
"obj": "",
- "column": column,
+ "column": 9,
"line": 1,
"type": "error",
"symbol": "syntax-error",
@@ -775,7 +767,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
)
def test_fail_on_edge_case(self, opts: list[str], out: int) -> None:
self._runtest(
- opts + [join(HERE, "regrtest_data", "fail_under_plus7_5.py")],
+ [*opts, join(HERE, "regrtest_data", "fail_under_plus7_5.py")],
code=out,
)
@@ -888,7 +880,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
[
["--disable=import-error,unused-import"],
# Test with multiple jobs for 'hmac.py' for which we have a
- # CVE against: https://github.com/PyCQA/pylint/issues/959
+ # CVE against: https://github.com/pylint-dev/pylint/issues/959
["-j2", "--disable=import-error,unused-import"],
],
)
@@ -898,13 +890,13 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
for path in ("astroid.py", "hmac.py"):
file_path = tmp_path / path
file_path.write_text("'Docstring'\nimport completely_unknown\n")
- pylint_call = [sys.executable, "-m", "pylint"] + args + [path]
+ pylint_call = [sys.executable, "-m", "pylint", *args, path]
with _test_cwd(tmp_path):
subprocess.check_output(pylint_call, cwd=str(tmp_path))
new_python_path = os.environ.get("PYTHONPATH", "").strip(":")
with _test_cwd(tmp_path), _test_environ_pythonpath(f"{new_python_path}:"):
# Appending a colon to PYTHONPATH should not break path stripping
- # https://github.com/PyCQA/pylint/issues/3636
+ # https://github.com/pylint-dev/pylint/issues/3636
subprocess.check_output(pylint_call, cwd=str(tmp_path))
@staticmethod
@@ -983,7 +975,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
def test_regression_parallel_mode_without_filepath(self) -> None:
# Test that parallel mode properly passes filepath
- # https://github.com/PyCQA/pylint/issues/3564
+ # https://github.com/pylint-dev/pylint/issues/3564
path = join(
HERE, "regrtest_data", "regression_missing_init_3564", "subdirectory/"
)
@@ -1022,7 +1014,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
path = join(HERE, "regrtest_data", "fail_on.py")
# We set fail-under to be something very low so that even with the warnings
# and errors that are generated they don't affect the exit code.
- self._runtest([path, "--fail-under=-10", "--disable=C"] + args, code=expected)
+ self._runtest([path, "--fail-under=-10", "--disable=C", *args], code=expected)
def test_one_module_fatal_error(self) -> None:
"""Fatal errors in one of several modules linted still exits non-zero."""
@@ -1046,7 +1038,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
)
def test_fail_on_info_only_exit_code(self, args: list[str], expected: int) -> None:
path = join(HERE, "regrtest_data", "fail_on_info_only.py")
- self._runtest([path] + args, code=expected)
+ self._runtest([path, *args], code=expected)
@pytest.mark.parametrize(
"output_format, expected_output",
@@ -1127,7 +1119,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
def test_regex_paths_csv_validator() -> None:
"""Test to see if _regexp_paths_csv_validator works.
Previously the validator crashed when encountering already validated values.
- Reported in https://github.com/PyCQA/pylint/issues/5437
+ Reported in https://github.com/pylint-dev/pylint/issues/5437
"""
with pytest.raises(SystemExit) as ex:
args = _add_rcfile_default_pylintrc(
@@ -1138,7 +1130,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
@staticmethod
def test_max_inferred_for_complicated_class_hierarchy() -> None:
- """Regression test for a crash reported in https://github.com/PyCQA/pylint/issues/5679.
+ """Regression test for a crash reported in https://github.com/pylint-dev/pylint/issues/5679.
The class hierarchy of 'sqlalchemy' is so intricate that it becomes uninferable with
the standard max_inferred of 100. We used to crash when this happened.
@@ -1273,7 +1265,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
def test_line_too_long_useless_suppression(self) -> None:
"""A test that demonstrates a known false positive for useless-suppression
- See https://github.com/PyCQA/pylint/issues/3368
+ See https://github.com/pylint-dev/pylint/issues/3368
If you manage to make this test fail and remove the useless-suppression
warning please contact open a Pylint PR!
@@ -1332,7 +1324,7 @@ class TestCallbackOptions:
"""Test whether certain strings are in the output of a callback command."""
command = _add_rcfile_default_pylintrc(command)
process = subprocess.run(
- [sys.executable, "-m", "pylint"] + command,
+ [sys.executable, "-m", "pylint", *command],
capture_output=True,
encoding="utf-8",
check=False,
@@ -1356,7 +1348,7 @@ class TestCallbackOptions:
"""Test the --help-msg flag."""
args = _add_rcfile_default_pylintrc(args)
process = subprocess.run(
- [sys.executable, "-m", "pylint"] + args,
+ [sys.executable, "-m", "pylint", *args],
capture_output=True,
encoding="utf-8",
check=False,
@@ -1373,7 +1365,7 @@ class TestCallbackOptions:
"""Test the --generate-rcfile flag."""
args = _add_rcfile_default_pylintrc(["--generate-rcfile"])
process = subprocess.run(
- [sys.executable, "-m", "pylint"] + args,
+ [sys.executable, "-m", "pylint", *args],
capture_output=True,
encoding="utf-8",
check=False,
@@ -1384,7 +1376,7 @@ class TestCallbackOptions:
assert "profile" not in process.stdout
args = _add_rcfile_default_pylintrc(["--generate-rcfile"])
process_two = subprocess.run(
- [sys.executable, "-m", "pylint"] + args,
+ [sys.executable, "-m", "pylint", *args],
capture_output=True,
encoding="utf-8",
check=False,
@@ -1436,7 +1428,7 @@ class TestCallbackOptions:
]
)
process = subprocess.run(
- [sys.executable, "-m", "pylint"] + args,
+ [sys.executable, "-m", "pylint", *args],
capture_output=True,
encoding="utf-8",
check=False,
@@ -1449,7 +1441,7 @@ class TestCallbackOptions:
assert 'preferred-modules = ["a:b"]' in process.stdout
process_two = subprocess.run(
- [sys.executable, "-m", "pylint"] + args,
+ [sys.executable, "-m", "pylint", *args],
capture_output=True,
encoding="utf-8",
check=False,
diff --git a/tests/test_similar.py b/tests/test_similar.py
index 051bc4b27..0f2ec242c 100644
--- a/tests/test_similar.py
+++ b/tests/test_similar.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/testutils/_primer/fixtures/message_changed/expected.txt b/tests/testutils/_primer/fixtures/message_changed/expected.txt
index 9640bed9e..676946fd2 100644
--- a/tests/testutils/_primer/fixtures/message_changed/expected.txt
+++ b/tests/testutils/_primer/fixtures/message_changed/expected.txt
@@ -2,14 +2,14 @@
-**Effect on [astroid](https://github.com/PyCQA/astroid):**
+**Effect on [astroid](https://github.com/pylint-dev/astroid):**
The following messages are now emitted:
<details>
1) locally-disabled:
*Locally disabling redefined-builtin [we added some text in the message] (W0622)*
-https://github.com/PyCQA/astroid/blob/123456789abcdef/astroid/__init__.py#L91
+https://github.com/pylint-dev/astroid/blob/123456789abcdef/astroid/__init__.py#L91
</details>
@@ -19,7 +19,7 @@ The following messages are no longer emitted:
1) locally-disabled:
*Locally disabling redefined-builtin (W0622)*
-https://github.com/PyCQA/astroid/blob/123456789abcdef/astroid/__init__.py#L91
+https://github.com/pylint-dev/astroid/blob/123456789abcdef/astroid/__init__.py#L91
</details>
diff --git a/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt b/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt
index 3912ea15b..3882b658f 100644
--- a/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt
+++ b/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt
@@ -2,18 +2,18 @@
-**Effect on [astroid](https://github.com/PyCQA/astroid):**
+**Effect on [astroid](https://github.com/pylint-dev/astroid):**
The following messages are now emitted:
<details>
1) locally-disabled:
*Locally disabling redefined-builtin [we added some text in the message] (W0622)*
-https://github.com/PyCQA/astroid/blob/123456789abcdef/astroid/__init__.py#L91
+https://github.com/pylint-dev/astroid/blob/123456789abcdef/astroid/__init__.py#L91
</details>
-The following message...
+The followi...
*This comment was truncated because GitHub allows only 525 characters in a comment.*
diff --git a/tests/testutils/_primer/fixtures/message_changed/main.json b/tests/testutils/_primer/fixtures/message_changed/main.json
index 96f0aaaef..69a42be1d 100644
--- a/tests/testutils/_primer/fixtures/message_changed/main.json
+++ b/tests/testutils/_primer/fixtures/message_changed/main.json
@@ -10,7 +10,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "locally-disabled",
"message": "Locally disabling redefined-builtin (W0622)",
"message-id": "I0011"
@@ -23,7 +23,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "unknown-option-value",
"message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'",
"message-id": "W0012"
diff --git a/tests/testutils/_primer/fixtures/message_changed/pr.json b/tests/testutils/_primer/fixtures/message_changed/pr.json
index 9e2eda37b..ef7e20fba 100644
--- a/tests/testutils/_primer/fixtures/message_changed/pr.json
+++ b/tests/testutils/_primer/fixtures/message_changed/pr.json
@@ -10,7 +10,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "locally-disabled",
"message": "Locally disabling redefined-builtin [we added some text in the message] (W0622)",
"message-id": "I0011"
@@ -23,7 +23,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "unknown-option-value",
"message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'",
"message-id": "W0012"
diff --git a/tests/testutils/_primer/fixtures/no_change/main.json b/tests/testutils/_primer/fixtures/no_change/main.json
index cd361e618..c2f34c750 100644
--- a/tests/testutils/_primer/fixtures/no_change/main.json
+++ b/tests/testutils/_primer/fixtures/no_change/main.json
@@ -10,7 +10,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "locally-disabled",
"message": "Locally disabling redefined-builtin (W0622)",
"message-id": "I0011"
@@ -23,7 +23,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "unknown-option-value",
"message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'",
"message-id": "W0012"
diff --git a/tests/testutils/_primer/fixtures/no_change/pr.json b/tests/testutils/_primer/fixtures/no_change/pr.json
index 96f0aaaef..69a42be1d 100644
--- a/tests/testutils/_primer/fixtures/no_change/pr.json
+++ b/tests/testutils/_primer/fixtures/no_change/pr.json
@@ -10,7 +10,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "locally-disabled",
"message": "Locally disabling redefined-builtin (W0622)",
"message-id": "I0011"
@@ -23,7 +23,7 @@
"column": 0,
"endLine": null,
"endColumn": null,
- "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py",
+ "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py",
"symbol": "unknown-option-value",
"message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'",
"message-id": "W0012"
diff --git a/tests/testutils/_primer/test_package_to_lint.py b/tests/testutils/_primer/test_package_to_lint.py
index 220e2c0b2..19645d1eb 100644
--- a/tests/testutils/_primer/test_package_to_lint.py
+++ b/tests/testutils/_primer/test_package_to_lint.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pylint.testutils._primer import PRIMER_DIRECTORY_PATH, PackageToLint
@@ -31,7 +31,8 @@ def test_package_to_lint() -> None:
expected_args = [
str(expected_path_to_lint),
f"--rcfile={expected_pylintrc_path}",
- ] + args
+ *args,
+ ]
assert package_to_lint.pylint_args == expected_args
diff --git a/tests/testutils/_primer/test_primer.py b/tests/testutils/_primer/test_primer.py
index d57e98d21..076c58a14 100644
--- a/tests/testutils/_primer/test_primer.py
+++ b/tests/testutils/_primer/test_primer.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Test the primer commands. """
from __future__ import annotations
@@ -29,7 +29,7 @@ DEFAULT_ARGS = ["python tests/primer/__main__.py", "compare", "--commit=v2.14.2"
@pytest.mark.parametrize("args", [[], ["wrong_command"]])
def test_primer_launch_bad_args(args: list[str], capsys: CaptureFixture) -> None:
with pytest.raises(SystemExit):
- with patch("sys.argv", ["python tests/primer/__main__.py"] + args):
+ with patch("sys.argv", ["python tests/primer/__main__.py", *args]):
Primer(PRIMER_DIRECTORY, PACKAGES_TO_PRIME_PATH).run()
out, err = capsys.readouterr()
assert not out
@@ -84,7 +84,7 @@ class TestPrimer:
pr = directory / "pr.json"
if expected_file is None:
expected_file = directory / "expected.txt"
- new_argv = DEFAULT_ARGS + [f"--base-file={main}", f"--new-file={pr}"]
+ new_argv = [*DEFAULT_ARGS, f"--base-file={main}", f"--new-file={pr}"]
with patch("sys.argv", new_argv):
Primer(PRIMER_DIRECTORY, PACKAGES_TO_PRIME_PATH).run()
with open(PRIMER_DIRECTORY / "comment.txt", encoding="utf8") as f:
diff --git a/tests/testutils/data/functional/broken_output_ok_test/exec_used.py b/tests/testutils/data/functional/broken_output_ok_test/exec_used.py
new file mode 100644
index 000000000..73d629d95
--- /dev/null
+++ b/tests/testutils/data/functional/broken_output_ok_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that is broken
+- the functional test itself is right
+
+So it should be updated.
+"""
+exec('a = 42') # [exec-used]
diff --git a/tests/testutils/data/functional/broken_output_ok_test/exec_used.txt b/tests/testutils/data/functional/broken_output_ok_test/exec_used.txt
new file mode 100644
index 000000000..d74b20893
--- /dev/null
+++ b/tests/testutils/data/functional/broken_output_ok_test/exec_used.txt
@@ -0,0 +1 @@
+exec-used:UNDEFINED
diff --git a/tests/testutils/data/functional/broken_output_wrong_test/exec_used.py b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.py
new file mode 100644
index 000000000..8b6c06a57
--- /dev/null
+++ b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that is broken
+- the functional test itself is wrong
+
+So it cannot be updated.
+"""
+exec('a = 42')
diff --git a/tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt
new file mode 100644
index 000000000..d74b20893
--- /dev/null
+++ b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt
@@ -0,0 +1 @@
+exec-used:UNDEFINED
diff --git a/tests/testutils/data/functional/no_output_ok_test/exec_used.py b/tests/testutils/data/functional/no_output_ok_test/exec_used.py
new file mode 100644
index 000000000..59d19fec0
--- /dev/null
+++ b/tests/testutils/data/functional/no_output_ok_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that does not exist
+- the functional test itself is right
+
+So it should be created
+"""
+exec('a = 42') # [exec-used]
diff --git a/tests/testutils/data/functional/no_output_wrong_test/exec_used.py b/tests/testutils/data/functional/no_output_wrong_test/exec_used.py
new file mode 100644
index 000000000..d3b318ab7
--- /dev/null
+++ b/tests/testutils/data/functional/no_output_wrong_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that does not exist
+- the functional test itself is wrong
+
+So it cannot be created.
+"""
+exec('a = 42')
diff --git a/tests/testutils/data/functional/ok_output_ok_test/exec_used.py b/tests/testutils/data/functional/ok_output_ok_test/exec_used.py
new file mode 100644
index 000000000..049213dd4
--- /dev/null
+++ b/tests/testutils/data/functional/ok_output_ok_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that is right
+- the functional test itself is right
+
+Nothing should be done.
+"""
+exec('a = 42') # [exec-used]
diff --git a/tests/testutils/data/functional/ok_output_ok_test/exec_used.txt b/tests/testutils/data/functional/ok_output_ok_test/exec_used.txt
new file mode 100644
index 000000000..6d0f82baf
--- /dev/null
+++ b/tests/testutils/data/functional/ok_output_ok_test/exec_used.txt
@@ -0,0 +1 @@
+exec-used:7:0:7:14::Use of exec:UNDEFINED
diff --git a/tests/testutils/data/functional/ok_output_wrong_test/exec_used.py b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.py
new file mode 100644
index 000000000..3f8637228
--- /dev/null
+++ b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that is right
+- the functional test itself is wrong
+
+Nothing should be done.
+"""
+exec('a = 42')
diff --git a/tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt
new file mode 100644
index 000000000..6d0f82baf
--- /dev/null
+++ b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt
@@ -0,0 +1 @@
+exec-used:7:0:7:14::Use of exec:UNDEFINED
diff --git a/tests/testutils/data/functional/wrong_output_ok_test/exec_used.py b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.py
new file mode 100644
index 000000000..0874f0a15
--- /dev/null
+++ b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that is wrong (but not broken)
+- the functional test itself is right
+
+So it needs to be updated.
+"""
+exec('a = 42') # [exec-used]
diff --git a/tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt
new file mode 100644
index 000000000..a737b8d51
--- /dev/null
+++ b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt
@@ -0,0 +1 @@
+missing-docstring:5:0:1:1::Missing docstring in file:HIGH
diff --git a/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py
new file mode 100644
index 000000000..fc35114e8
--- /dev/null
+++ b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py
@@ -0,0 +1,7 @@
+"""This is an example for a functional test with
+- an output that is wrong (but not broken)
+- the functional test itself is wrong
+
+So it can't be updated.
+"""
+exec('a = 42')
diff --git a/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt
new file mode 100644
index 000000000..a737b8d51
--- /dev/null
+++ b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt
@@ -0,0 +1 @@
+missing-docstring:5:0:1:1::Missing docstring in file:HIGH
diff --git a/tests/testutils/data/m/max_overflow/max_overflow_1.py b/tests/testutils/data/m/max_overflow/max_overflow_1.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testutils/data/m/max_overflow/max_overflow_1.py
diff --git a/tests/testutils/data/m/max_overflow/max_overflow_2.py b/tests/testutils/data/m/max_overflow/max_overflow_2.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testutils/data/m/max_overflow/max_overflow_2.py
diff --git a/tests/testutils/data/m/max_overflow/max_overflow_3.py b/tests/testutils/data/m/max_overflow/max_overflow_3.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testutils/data/m/max_overflow/max_overflow_3.py
diff --git a/tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py b/tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py
diff --git a/tests/testutils/dummy_checker.py b/tests/testutils/dummy_checker.py
index e8a8ff79f..cfd18ddd3 100644
--- a/tests/testutils/dummy_checker.py
+++ b/tests/testutils/dummy_checker.py
@@ -1,3 +1,3 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
diff --git a/tests/testutils/test_configuration_test.py b/tests/testutils/test_configuration_test.py
index 2efa65df3..fa6156a29 100644
--- a/tests/testutils/test_configuration_test.py
+++ b/tests/testutils/test_configuration_test.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import logging
from pathlib import Path
diff --git a/tests/testutils/test_functional_testutils.py b/tests/testutils/test_functional_testutils.py
index 68dad697d..d1047c8ee 100644
--- a/tests/testutils/test_functional_testutils.py
+++ b/tests/testutils/test_functional_testutils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
"""Tests for the functional test framework."""
@@ -41,8 +41,32 @@ def test_parsing_of_pylintrc_init_hook() -> None:
def test_get_functional_test_files_from_directory() -> None:
"""Test that we correctly check the functional test directory structures."""
- with pytest.raises(AssertionError, match="using_dir.py should not go in"):
- get_functional_test_files_from_directory(DATA_DIRECTORY)
+ with pytest.raises(AssertionError) as exc_info:
+ get_functional_test_files_from_directory(DATA_DIRECTORY / "u")
+ assert exc_info.match("'use_dir.py' should go in 'use'")
+ assert exc_info.match(
+ "using_dir.py should go in a directory that starts with the "
+ "first letters of 'using_dir'"
+ )
+ assert "incredibly_bold_mischief.py" not in str(exc_info.value)
+ # Leading underscore mean that this should not fail the assertion
+ get_functional_test_files_from_directory(DATA_DIRECTORY / "u/_no_issue_here")
+
+
+def test_get_functional_test_files_from_crowded_directory() -> None:
+ """Test that we correctly check the functional test directory structures."""
+ with pytest.raises(AssertionError) as exc_info:
+ get_functional_test_files_from_directory(
+ DATA_DIRECTORY / "m", max_file_per_directory=1
+ )
+ assert exc_info.match("m: 4 when the max is 1")
+ assert exc_info.match("max_overflow: 3 when the max is 1")
+ with pytest.raises(AssertionError) as exc_info:
+ get_functional_test_files_from_directory(
+ DATA_DIRECTORY / "m", max_file_per_directory=3
+ )
+ assert exc_info.match("m: 4 when the max is 3")
+ assert "max_overflow" not in str(exc_info.value)
def test_minimal_messages_config_enabled(pytest_config: MagicMock) -> None:
diff --git a/tests/testutils/test_lint_module_output_update.py b/tests/testutils/test_lint_module_output_update.py
index 2e387a118..a8bfc5fde 100644
--- a/tests/testutils/test_lint_module_output_update.py
+++ b/tests/testutils/test_lint_module_output_update.py
@@ -1,20 +1,24 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
from __future__ import annotations
+import shutil
from collections.abc import Callable
from pathlib import Path
import pytest
-from pylint.constants import PY38_PLUS
-from pylint.testutils import FunctionalTestFile
+from pylint.constants import IS_PYPY, PY38_PLUS, PY39_PLUS
+from pylint.testutils import FunctionalTestFile, LintModuleTest
from pylint.testutils.functional import LintModuleOutputUpdate
+FIXTURE_DIRECTORY = Path(__file__).parent / "data/functional"
+DIRECTORIES = list(FIXTURE_DIRECTORY.iterdir())
+
@pytest.fixture()
def lint_module_fixture(
@@ -76,4 +80,78 @@ def test_lint_module_output_update_remove_useless_txt(
expected_output_file.write_text("", encoding="utf8")
filename.write_text("", encoding="utf8")
lmou.runTest()
- assert not (expected_output_file).exists()
+ assert not expected_output_file.exists()
+
+
+@pytest.mark.skipif(
+ not PY38_PLUS or (IS_PYPY and not PY39_PLUS),
+ reason="Requires accurate 'end_col' value to update output",
+)
+@pytest.mark.parametrize(
+ "directory_path", DIRECTORIES, ids=[str(p) for p in DIRECTORIES]
+)
+def test_update_of_functional_output(directory_path: Path, tmp_path: Path) -> None:
+ """Functional test for the functional tests' helper."""
+
+ def _check_expected_output(_ftf: FunctionalTestFile) -> None:
+ new_output_path = _ftf.expected_output
+ assert Path(
+ new_output_path
+ ).exists(), "The expected output file does not exists"
+ with open(new_output_path, encoding="utf8") as f:
+ new_output = f.read()
+ assert (
+ new_output == "exec-used:7:0:7:14::Use of exec:UNDEFINED\n"
+ ), f"The content was wrongly updated in {new_output_path}"
+
+ def _assert_behavior_is_correct(
+ _ftf: FunctionalTestFile,
+ _lint_module: LintModuleTest,
+ _lint_module_output_update: LintModuleOutputUpdate,
+ _new_path: Path,
+ ) -> None:
+ new_path_str = str(_new_path)
+ if "wrong_test" in new_path_str:
+ expected = r'Wrong message\(s\) raised for "exec_used.py"'
+ with pytest.raises(AssertionError, match=expected):
+ _lint_module.runTest()
+ # When the tests are wrong we do not update the output at all
+ # and the test should fail
+ with pytest.raises(AssertionError, match=expected):
+ _lint_module_output_update.runTest()
+ elif "ok_test" in new_path_str:
+ if any(f"{x}_output" in new_path_str for x in ("wrong", "no", "broken")):
+ with pytest.raises(
+ AssertionError, match='Wrong output for "exec_used.txt"'
+ ):
+ _lint_module.runTest()
+ elif "ok_output" in new_path_str:
+ _lint_module.runTest()
+ _check_expected_output(_ftf)
+ else:
+ raise AssertionError(f"Unhandled test case: {new_path_str}")
+
+ # When the tests are ok we update the output whatever it's state
+ # was originally
+ _lint_module_output_update.runTest()
+ _check_expected_output(_ftf)
+ else:
+ raise AssertionError(
+ f"Do not pollute '{FIXTURE_DIRECTORY}' with unrelated "
+ f"or badly named test files."
+ )
+
+ new_path = tmp_path / directory_path.name
+ shutil.copytree(directory_path, new_path)
+ for filename in new_path.iterdir():
+ if filename.suffix != ".py":
+ continue
+ ftf = FunctionalTestFile(directory=str(new_path), filename=filename.name)
+ # Standard functional test helper
+ lint_module = LintModuleTest(ftf)
+ # Functional test helper that automatically update the output
+ lint_module_output_update = LintModuleOutputUpdate(ftf)
+
+ _assert_behavior_is_correct(
+ ftf, lint_module, lint_module_output_update, new_path
+ )
diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py
index 5b2bf1a1b..8e9cf2800 100644
--- a/tests/testutils/test_output_line.py
+++ b/tests/testutils/test_output_line.py
@@ -1,12 +1,12 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
from __future__ import annotations
-import sys
+from typing import Protocol
import pytest
@@ -16,11 +16,6 @@ from pylint.message import Message
from pylint.testutils.output_line import OutputLine
from pylint.typing import MessageLocationTuple
-if sys.version_info >= (3, 8):
- from typing import Protocol
-else:
- from typing_extensions import Protocol
-
class _MessageCallable(Protocol):
def __call__(self, confidence: Confidence = HIGH) -> Message:
@@ -134,82 +129,11 @@ def test_output_line_to_csv(confidence: Confidence, message: _MessageCallable) -
)
-def test_output_line_from_csv_error() -> None:
- """Test that errors are correctly raised for incorrect OutputLine's."""
- # Test a csv-string which does not have a number for line and column
- with pytest.warns(
- UserWarning,
- match="msg-symbolic-name:42:27:MyClass.my_function:The message",
- ):
- OutputLine.from_csv("'missing-docstring', 'line', 'column', 'obj', 'msg'", True)
- # Test a tuple which does not have a number for line and column
- with pytest.warns(
- UserWarning, match="we got 'missing-docstring:line:column:obj:msg'"
- ):
- csv = ("missing-docstring", "line", "column", "obj", "msg")
- OutputLine.from_csv(csv, True)
- # Test a csv-string that is too long
- with pytest.warns(
- UserWarning,
- match="msg-symbolic-name:42:27:MyClass.my_function:The message",
- ):
- OutputLine.from_csv(
- "'missing-docstring', 1, 2, 'obj', 'msg', 'func', 'message', 'conf', 'too_long'",
- True,
- )
-
-
-@pytest.mark.parametrize(
- "confidence,expected_confidence", [[None, "UNDEFINED"], ["INFERENCE", "INFERENCE"]]
-)
-def test_output_line_from_csv_deprecated(
- confidence: str | None, expected_confidence: str
-) -> None:
- """Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
- Test OutputLine's of length 5 or 6.
- """
- if confidence:
- proper_csv = [
- "missing-docstring",
- "1",
- "2",
- "obj",
- "msg",
- confidence,
- ]
- else:
- proper_csv = ["missing-docstring", "1", "2", "obj", "msg"]
- with pytest.warns(DeprecationWarning) as records:
- output_line = OutputLine.from_csv(proper_csv, True)
- assert len(records) == 1
-
- expected_column = 2 if PY38_PLUS else 0
- assert output_line == OutputLine(
- symbol="missing-docstring",
- lineno=1,
- column=expected_column,
- end_lineno=None,
- end_column=None,
- object="obj",
- msg="msg",
- confidence=expected_confidence,
- )
-
-
def test_output_line_from_csv() -> None:
"""Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
Test OutputLine of length 8.
"""
- proper_csv = [
- "missing-docstring",
- "1",
- "2",
- "1",
- "None",
- "obj",
- "msg",
- "HIGH",
- ]
+ proper_csv = ["missing-docstring", "1", "2", "1", "None", "obj", "msg", "HIGH"]
expected_column = 2 if PY38_PLUS else 0
output_line = OutputLine.from_csv(proper_csv)
diff --git a/tests/testutils/test_pyreverse_testutils.py b/tests/testutils/test_pyreverse_testutils.py
index 95cbc239f..2bb411c4d 100644
--- a/tests/testutils/test_pyreverse_testutils.py
+++ b/tests/testutils/test_pyreverse_testutils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from pathlib import Path
diff --git a/tests/testutils/test_testutils_utils.py b/tests/testutils/test_testutils_utils.py
index b521e25c4..f32f87ba3 100644
--- a/tests/testutils/test_testutils_utils.py
+++ b/tests/testutils/test_testutils_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import os
import sys
diff --git a/tests/utils/unittest_ast_walker.py b/tests/utils/unittest_ast_walker.py
index 5a2dc6609..2aac78126 100644
--- a/tests/utils/unittest_ast_walker.py
+++ b/tests/utils/unittest_ast_walker.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
diff --git a/tests/utils/unittest_utils.py b/tests/utils/unittest_utils.py
index c802c40e2..d2cfbd5b2 100644
--- a/tests/utils/unittest_utils.py
+++ b/tests/utils/unittest_utils.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
import io
diff --git a/towncrier.toml b/towncrier.toml
index d8ef40f10..250cc10f1 100644
--- a/towncrier.toml
+++ b/towncrier.toml
@@ -1,9 +1,9 @@
[tool.towncrier]
-version = "2.17.4"
+version = "3.0.0"
directory = "doc/whatsnew/fragments"
-filename = "doc/whatsnew/2/2.17/index.rst"
+filename = "doc/whatsnew/3/3.0/index.rst"
template = "doc/whatsnew/fragments/_template.rst"
-issue_format = "`#{issue} <https://github.com/PyCQA/pylint/issues/{issue}>`_"
+issue_format = "`#{issue} <https://github.com/pylint-dev/pylint/issues/{issue}>`_"
wrap = true
# Definition of fragment types.
@@ -65,3 +65,8 @@ showcontent = true
directory = "internal"
name = "Internal Changes"
showcontent = true
+
+[[tool.towncrier.type]]
+directory = "performance"
+name = "Performance Improvements"
+showcontent = true
diff --git a/tox.ini b/tox.ini
index 0c78b8798..5f512d221 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 3.0
-envlist = formatting, py37, py38, py39, py310, py311, pypy, benchmark
+envlist = formatting, py38, py39, py310, py311, pypy, benchmark
skip_missing_interpreters = true
requires = pip >=21.3.1
isolated_build = true
@@ -56,7 +56,12 @@ changedir = doc/
deps =
-r {toxinidir}/doc/requirements.txt
commands =
- sphinx-build -W -b html -d _build/doctrees . _build/html
+ # Readthedoc launch a slightly different command see '.readthedocs.yaml'
+ # sphinx-build -T -W -E --keep-going -b html -d _build/doctrees -D language=en . _build/html
+ # Changes were made for performance reasons, add or remove only if you can't reproduce.
+ sphinx-build -T -W -j auto --keep-going -b html -d _build/doctrees -D language=en . _build/html
+ # -E: don't use a saved environment, always read all files
+ # -j auto: build in parallel with N processes where possible (special value "auto" will set N to cpu-count)
[testenv:test_doc]
deps =