flake8-simplify
flake8-simplify copied to clipboard
SIM110: a false-positive test-case
Desired change
- Rule(s): SIM110
- Adjustment: A false positive
Example
def _check_libalternatives_presence(pkg, alts_requirement):
for path in pkg.files:
if path.startswith('/usr/share/libalternatives/'):
return True
return any(req[0] == alts_requirement for req in pkg.requires + pkg.prereq)
$ flake8 /tmp/snippet.py
/tmp/snippet.py:2:5: SIM110 Use 'return any(path.startswith('/usr/share/libalternatives/') for path in pkg.files)'
It's wrong as the last statement will be never executed.