diff options
author | Konstantin <Github@pheanex.de> | 2018-04-18 09:48:32 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-04-18 09:48:32 +0200 |
commit | ab93123a30da6a75e5df7e1de209688bd80068d9 (patch) | |
tree | d2414b010075168241f2c5c6468feddc4fa370d7 /doc/whatsnew/2.0.rst | |
parent | deae2ae1eb7650d6d2c37e70a488361043fcba96 (diff) | |
download | pylint-git-ab93123a30da6a75e5df7e1de209688bd80068d9.tar.gz |
Add a new check, consider-using-join
Add a check `consider-using-in` for comparisons of a variable against
multiple values with "==" and "or"s instead of checking if the variable
is contained "in" a tuple of those values.
Close #1977
Diffstat (limited to 'doc/whatsnew/2.0.rst')
-rw-r--r-- | doc/whatsnew/2.0.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/whatsnew/2.0.rst b/doc/whatsnew/2.0.rst index e6e57e793..946cb6cb2 100644 --- a/doc/whatsnew/2.0.rst +++ b/doc/whatsnew/2.0.rst @@ -16,6 +16,19 @@ Summary -- Release highlights New checkers ============ +* A new check was added, ``consider-using-in``. + + This refactoring message is emitted when a variable is compared against multiple + values concatenated by ors instead of using the faster, more idiomatic "in" check. + + .. code-block:: python + + if variable == 1 or variable == 2 or variable == 3: # bad + pass + + if variable in (1, 2, 3): # good + pass + * A new check was added, ``consider-using-join``. This refactoring message is emitted when using a for loop over a iterable to join strings |