nova/nova/hacking
Eric Fried 8899f8b5b5 Hacking N363: `in (not_a_tuple)`
A few places in the code had conditionals including:

 if something in (element):

which was clearly intended to be

 if something in (element,):

(I.e. `in $tuple`, not `in element` with redundant parens) or just

 if something == element:

Fix those [1] and introduce hacking rule N363 to disallow this kind of
thing in the future.

[1] NOTE: These weren't actually latent bugs because

 'foo' in ('foo')

which is the same as

 'foo' in 'foo'

returns True. In order to be a bug, the left operand would have to be
able to be a substring of the right:

 'foo' in ('foobar')  # True
 'foo' in ('foobar',) # False

...which I don't think is possible in any of the scenarios found.

Change-Id: I950d07eb533e0d43466c58e36b314aaaf8560251
2019-06-07 16:08:12 -05:00
..
__init__.py Switch to flake8+hacking. 2013-05-17 12:54:12 -07:00
checks.py Hacking N363: `in (not_a_tuple)` 2019-06-07 16:08:12 -05:00