summaryrefslogtreecommitdiff
path: root/pylint/checkers/exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* [PyCQA migration] Upgrade links to the repositories in code and doc (#8514)Pierre Sassoulas2023-03-291-2/+2
|
* [overgeneral-exceptions] Only handle qualified names (#8411)Pierre Sassoulas2023-03-091-17/+12
| | | | | * [overgeneral-exceptions] Only handle qualified names * fix changelog
* Use UninferableBase instead of UninferableDaniel van Noord2023-03-071-6/+6
|
* [doc] Add details and related links for bare/broad-except (#8077)Pierre Sassoulas2023-01-241-4/+13
| | | Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* [style] Limit line length and complexity using flake8 (#8064)Pierre Sassoulas2023-01-161-1/+4
| | | 125 is a good start. The check was activated in pylint with value = 100, but flake8 is less lenient than pylint and does not make any exceptions (for docstrings, strings and comments in particular).
* Fixes false positive for `try-except-raise` with multiple exceptions in one ↵fly2023-01-121-1/+1
| | | | | except statement if exception are in different namespace (#8052) Closes #8051
* Use qualified name when checking for overgeneral exceptions (#7497)Jakub Kuczys2022-11-131-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <pierre.sassoulas@gmail.com> * Suppress missing class docstrings * Add few more tests for broad-exception-raised Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> * 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 <pierre.sassoulas@gmail.com>
* Add confidence levels to all exception checkers (#7716)Dani Alcala2022-11-051-12/+45
|
* Rename `broad-except` and new check `broad-exception-raised` (#7709)Dani Alcala2022-11-051-4/+20
| | | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Rename bad-exception-context to bad-exception-cause (#7125)VictorT2022-07-181-18/+17
| | | | | | Fixes #3694 Co-authored-by: Victor Taïx <victor.taix@grenoble-inp.org> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add typing to ``exceptions`` checker (#7194)Daniël van Noord2022-07-161-16/+24
|
* Bump or remove some ``TODOs`` (#7141)Daniël van Noord2022-07-071-2/+0
|
* [refactor] Normalize the typing of visitor functions (#6892)Pierre Sassoulas2022-06-121-0/+2
| | | Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* [raise-missing-from] Clearer message and example in the documentation (#6576)Pierre Sassoulas2022-05-121-13/+31
| | | | | | | | | * [raise-missing-from] Clearer message and example in the documentation Co-authored-by: cool-RR <ram@rachum.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> Refs #5953 Closes #3707
* [--long-help] Remove redundant default description in message (#6581)Pierre Sassoulas2022-05-111-3/+1
| | | | | | | | | | | | | | Text was: ``` --overgeneral-exceptions <comma-separated class names> Exceptions that will emit a warning when being caught. Defaults to "BaseException, Exception". (default: ('BaseException', 'Exception')) ``` Now: ``` --overgeneral-exceptions <comma-separated class names> Exceptions that will emit a warning when being caught. (default: ('BaseException', 'Exception')) ``` Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* Add typing to ``BaseChecker`` ``msgs`` and ``reports`` (#6456)Daniël van Noord2022-04-251-1/+4
|
* Migrate from 'check_messages' to 'only_required_for_messages' (#6417)Pierre Sassoulas2022-04-211-4/+4
|
* Remove ``IAstroidChecker`` from ``__implements__``Daniël van Noord2022-04-191-3/+1
|
* Replace .namespace with .config (#6316)Daniël van Noord2022-04-141-1/+1
|
* Use ``python-typing-update`` on ``pylint/checkers`` directoryDaniël van Noord2022-04-141-6/+9
|
* Remove the ``future_option_parsing`` keyword (#6253)Daniël van Noord2022-04-111-3/+0
|
* Use ``argparse`` config handler in ``imports.py`` & ``exceptions.py``Daniël van Noord2022-04-021-1/+4
|
* Remove the concept of checker priority (#6034)Daniël van Noord2022-04-011-1/+0
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Don't emit `raising-bad-type` when there is ambiguity (#5968)Jacob Walls2022-03-251-9/+6
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add a pre-commit hook to check the copyright noticePierre Sassoulas2022-03-241-1/+1
| | | | | Fix the existing file so they have a notice. No header for setup.py or examples or doc
* Simplify hard to maintain copyright noticePierre Sassoulas2022-03-241-32/+1
| | | | | | git is the source of truth for the copyright, copyrite (the tool) was taking exponentially longer with each release, and it's polluting the code with sometime as much as 50 lines of names.
* Upgrade ``pydocstringformatter`` to ``0.5.0`` (#5910)Daniël van Noord2022-03-131-0/+1
|
* Update ``pydocstringformatter`` to 0.4.0 (#5787)Daniël van Noord2022-02-101-2/+2
|
* Format docstrings with ``pydocstringformatter``Daniël van Noord2022-01-021-2/+1
|
* Add typing and uniformize the checker registering in Pylinter (#5558)Pierre Sassoulas2021-12-271-3/+5
| | | | | Remove verbose docstring in code, keep them in example and doc Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Fix typos accross the whole codebase (#5575)Pierre Sassoulas2021-12-211-21/+21
| | | | Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
* Bump pylint to 2.12.0, update changelogv2.12.0Pierre Sassoulas2021-11-251-0/+1
| | | | Closes #5250
* Fix typo in pylintrc for useless-suppression (#5303)Daniël van Noord2021-11-231-2/+0
| | | | | | | | | | | * Fix typo in pylintrc for useless-suppression * Fix CI for information messages * Remove useless disables * Update CI and docs for 3.8+ Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Enable for_any_all check (#5206)Nick Drozd2021-10-251-5/+2
| | | | | | | * Enable for_any_all check, reword a few docstrings, shorten some loop variable names, and add typing on modified functions. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* Bump pylint to 2.11.0, update changelogv2.11.0Pierre Sassoulas2021-09-161-0/+1
|
* Refactor various typing related issues (#4940)Daniël van Noord2021-09-031-28/+28
| | | | | | | | | | | | | | | * Add type annotations to ``visit`` & ``leave`` calls This adds typing to most calls that visit nodes. All other changes are due to mypy errors resulting from introduction of typing. * Fix outstanding mypy issues This removes some of the `type: ignore` comments in favour of solving the mypy issues these comments were surpressing. * Fix remaining references to node_classes Except for two references to node_classes in the changelog this should be the last of them Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix the raising-bad-type warning for stringPierre Sassoulas2021-09-011-5/+3
| | | | | | Apparently this use case was supposed to be handled by the py3K checker but as it was disabled all the time the issue has'nt been handled at all for a long time.
* Add ``Consider-using-f-string`` checker (#4796)Daniël van Noord2021-08-301-13/+4
| | | | | | | | | | | | | | | | * Add ``consider-using-f-string`` checker This adds a checker for normal strings which are formatted with ``.format()`` or '%'. The message is a convention to nudge users towards using f-strings. This closes #3592 * Update pylint code to use f-strings After adding `consider-using-f-strings` the codebase showed numerous cases of formatting which could be f-strings. This commit changes most of these to become f-strings, or adds ignores. * Apply suggestions from code review Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Use alias for astroid.nodes 02 (#4863)Marc Mueller2021-08-181-29/+27
| | | | * Use alias for astroid nodes * Resolve name conflicts
* Create a constant for BUILTINSPierre Sassoulas2021-07-061-1/+0
|
* Fix copyright links (#4647)Marc Mueller2021-07-011-1/+1
| | | | * Fix link in license header * Update link to astroid bump_changelog
* Bump pylint to 2.9.0-dev1, update changelogPierre Sassoulas2021-06-171-0/+1
|
* Update name for consider-using-namedtuple to include dataclass (#4536)Marc Mueller2021-06-021-1/+1
| | | | | * Change msg name to include dataclass * Update pylint ignores * Update tests
* Add new checker consider-using-namedtuple (#4517)Marc Mueller2021-05-311-1/+1
| | | | * Add new checker consider-using-namedtuple * Add disable for existing code base
* Rename copying to license and upgrade the setup.cfg (#4338)Pierre Sassoulas2021-04-111-1/+1
|
* Fix value assigned to local variable 'bare_raise' is never usedPierre Sassoulas2021-03-311-7/+2
|
* Refactor from old style typing to new style typingPierre Sassoulas2021-03-311-1/+1
|
* Import astroid with import x or from x import y but not bothPierre Sassoulas2021-03-281-3/+2
| | | | Remove unused imports for astroid
* Apply copyrite --contribution-thresholdPierre Sassoulas2021-02-211-1/+2
|
* Move from % string formatting syntax to f-string or .format()Pierre Sassoulas2021-02-211-3/+3
|