summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring/implicit_booleaness_checker.py
Commit message (Collapse)AuthorAgeFilesLines
* [use-implicit-booleaness] Micro-optimization if some messages are disabledPierre Sassoulas2023-05-031-4/+9
|
* [use-implicit-booleaness] Remove condition that is always false (outdated ↵Pierre Sassoulas2023-05-031-2/+0
| | | | typing hint?)
* [use-implicit-booleaness] Optimization for unknown operatorsPierre Sassoulas2023-05-031-5/+7
|
* [use-implicit-booleaness] Merge the check for string and zero togetherPierre Sassoulas2023-05-031-64/+52
|
* Uniformize message and remove useless details.rstPierre Sassoulas2023-05-031-17/+19
|
* Add applicability notes for `compare-to-empty-string/zero` (#8592)Jason Lau2023-05-031-3/+3
| | | | | | The extension `compare-to-empty-string` is only applicable when the expression being compared is strictly a `str`. The extension `compare-to-zero` is only applicable when the expression being compared is strictly an `int`.
* Switch from ' to " in use-implicit-booleaness-not-comparisonPierre Sassoulas2023-05-031-1/+1
| | | | | Because empty string needs to " because node.as_string() use simple quote.
* Merge the empty-string extensions to 'implicit_booleaness_checker'Pierre Sassoulas2023-05-021-2/+56
|
* Merge the compare-to-zero extensions to 'implicit_booleaness_checker'Pierre Sassoulas2023-05-021-0/+59
|
* [PyCQA migration] Upgrade links to the repositories in code and doc (#8514)Pierre Sassoulas2023-03-291-2/+2
|
* Use UninferableBase instead of UninferableDaniel van Noord2023-03-071-2/+4
|
* [use-implicit-booleaness-not-comparison] Better message with the type of ↵Pierre Sassoulas2022-11-091-9/+17
| | | | sequence
* [implicit_booleaness_checker] Add the confidence to related messages (#7721)Pierre Sassoulas2022-11-061-26/+35
| | | First step prior doing #6870 in order to make it more reviewable.
* Add missing whitespace to a message description (#7002)Julthep Nandakwang2022-06-231-1/+1
|
* Enable line-wrapping from ``pydocstringformatter``Daniël van Noord2022-05-231-2/+2
|
* Some initial line wrapping of docstrings (#6672)Daniël van Noord2022-05-231-1/+2
|
* Run development version of ``pydocstringformatter`` (#6469)Daniël van Noord2022-04-281-1/+1
|
* Migrate from utils.check_messages to utils.only_required_for_messages (#6432)Pierre Sassoulas2022-04-221-3/+3
|
* Remove ``IAstroidChecker`` from ``__implements__``Daniël van Noord2022-04-191-3/+1
|
* Use ``python-typing-update`` on ``pylint/checkers/...`` directoriesDaniël van Noord2022-04-141-4/+2
|
* Remove the concept of checker priority (#6034)Daniël van Noord2022-04-011-1/+0
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add a pre-commit hook to check the copyright noticePierre Sassoulas2022-03-241-1/+2
| | | | | 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-0/+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-2/+1
|
* Update ``pydocstringformatter`` to 0.4.0 (#5787)Daniël van Noord2022-02-101-1/+1
|
* Fix crash on properties & inherited methods in ``implicit-booleaness`` (#5652)Daniël van Noord2022-01-131-10/+14
|
* Format docstrings with ``pydocstringformatter``Daniël van Noord2022-01-021-1/+2
|
* Fix some typoes before adding typing for checker registeringPierre Sassoulas2021-12-201-1/+1
|
* Activate and fix existing use-set-for-membership checks (#5379)Pierre Sassoulas2021-11-251-1/+1
| | | | * Activate and fix existing use-set-for-membership checks
* Fix use-implicit-booleaness-not-comparison crash (#5176)Jaehoon Hwang2021-10-231-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix use-implicit-booleaness-not-comparison crash `use-implicit-booleaness-not-comparison` caused a crash due to `target_node` not being an instance of `NodeNG.Name` This fix will allow the checker to have a default handling when it encounters `target_node` other than `Calls`,`Name`, or `Attribute` * Added more comprehensive test for implicit_booealness_checker * Make implicit_booealness_checker to have default `variable_name` * Handle `Calls`,`Name`, or `Attribute` * Fix typing in ImplicitBooleanessChecker.base_classes_of_node * [implicit-booleaness] Add call nodes name in warnings * Use `BaseContainer` to check for empty tuple/list and use `as_string` for `Attribute` and `Name` nodes for message Using `BaseContainer` for checking for empty `tuple` and `list`. In addition, `is_base_container` checks for `FrozenSet` and `Set` as well. * Update test cases with cr concerns * Use `BaseContainer` when checking for empty list or tuple * Update `is_literal_tuple/list` to use `is_base_container` * Use `as_string` when giving out function or variable name for message. * Fix broken baseContainer test * Use safe_infer for inferencing `target_instance` * Swap opreators message * Address CR comments; no more try/catch for infer & Add more test cases * Add more test cases and changed few cases to cover more cases. * Remove `try/catch` from `safe_infer` since `safe_infer` will return `None` when it encounters exceptions. * Comparison from infer to be more explicit; using `None` instead of relying on `bool` Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add a warning ``use-implicit-booleaness-not-comparison`` for comparison with ↵Jaehoon Hwang2021-10-171-1/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | collection literals (#5120) * Create a new checker; use-implicit-booleanness checker where it looks for boolean evaluatiion with collection literals such as `()`, `[]`, or `{}` * Fixed invalid usage of comparison within pylint package This closes #4774 * Ignore tuples when checking for `literal-comparison` Closes #3031 * Merge len_checker with empty_literal checker Moving empty literal checker with len_checker to avoid class without iterators without boolean expressions (false positive on pandas) Reference: https://github.com/PyCQA/pylint/pull/3821/files * Update `len_checker` and its class `LenChecker` to `ComparisonChecker` to reflect better usage after merging between `len_checker` and `empty_literal_checker` and its tests. * Fixed `consider_using_in` and `consider_iterating_dictionary` tests that were failing due to new empty literal checkers. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Rename `len-as-condition` to `use-implicit-booleaness-not-len` (#5132)Jaehoon Hwang2021-10-101-0/+123
Rename `len-as-condition` to be more general for new checker `use-implicit-booleaness-not-comparison` * Refactor `LenChecker` class -> `ImplicitBooleanessChecker`o * Rename test files/`len_checker.py`/`__init__.py` to reflect new name. * Add `len-as-condition` as `old_names` for `use-implicit-booleaness-not-len` Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>