From ac65bdc0741379c3f2ac964626b31db93d49bf1e Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Sun, 13 Nov 2022 12:41:38 +0100 Subject: Use qualified name when checking for overgeneral exceptions (#7497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update tests * Use qualified name when checking for overgeneral exceptions * WIP: Add deprecation warning * Add changelog fragment * Use qualified name in test case * spell check fix * Update changelog fragment with suggested fixes Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> * Move OVERGENERAL_EXCEPTIONS directly to the default value in dict * Mark as TODO for pylint 3.0 * Properly warn on each occurrence of name without dots * Update the warning per the review * Rephrase the warning to mention pylint 3.0 * Remove unnecessary nesting of the if condition * Quote the exception name in deprecation warning * Use config value for overgeneral exceptions in broad-exception-raised * Infer qualified name of the exception in broad-exception-raised * e.g. -> maybe? Co-authored-by: Pierre Sassoulas * Suppress missing class docstrings * Add few more tests for broad-exception-raised Co-authored-by: Pierre Sassoulas * Fix unexpected missing-raise-from * Revert "Fix unexpected missing-raise-from" This reverts commit d796e72035b7f7578b9e6bb1e45a30935e80b009. * Revert "Add few more tests for broad-exception-raised" This reverts commit e5a193ee136f8566d43450fbb9fbf28cc717d307. * Change confidence of broad-exception-raised from HIGH to INFERENCE * Only trigger broad-exception-raised for raise with new exc instance * Update overgeneral-exceptions definition in example pylintrc file * Update pylint/checkers/exceptions.py Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> Co-authored-by: Pierre Sassoulas --- pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pylintrc') diff --git a/pylintrc b/pylintrc index 7195a6592..cf0ee89bf 100644 --- a/pylintrc +++ b/pylintrc @@ -510,7 +510,7 @@ preferred-modules= # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception [TYPING] -- cgit v1.2.1