| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
typing hint?)
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
| |
Because empty string needs to " because node.as_string() use
simple quote.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
sequence
|
|
|
| |
First step prior doing #6870 in order to make it more reviewable.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
| |
Fix the existing file so they have a notice.
No header for setup.py or examples or doc
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
* Activate and fix existing use-set-for-membership checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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>
|