pytest-assert_match-after-path-patch
pytest-assert_match-after-path-patch
snapshot.assert_match makes use of pathlib to create files. Patching $METHOD may result in unexpected snapshot behavior
sync-sleep-in-async-code
sync-sleep-in-async-code
Synchronous time.sleep in async code will block the event loop and not allow other tasks to execute. Use asyncio.sleep() instead.
unchecked-subprocess-call
unchecked-subprocess-call
This is not checking the return value of this subprocess call; if it fails no exception will be raised. Consider subprocess.check_call() instead
baseclass-attribute-override
baseclass-attribute-override
Class A
and
F`; one of these methods will be overwritten.file-object-redefined-before-close
file-object-redefined-before-close
Detected a file object that is redefined and never closed. This could leak file descriptors and unnecessarily consume system resources.
uncaught-executor-exceptions
uncaught-executor-exceptions
Values returned by thread pool map must be read in order to raise exceptions. Consider using
for _ in $EXECUTOR.map(...): pass
.return-in-init
return-in-init
return
should never appear inside a class init function. This will cause a runtime error.yield-in-init
yield-in-init
yield
should never appear inside a class init function. This will cause a runtime error.list-modify-while-iterate
list-modify-while-iterate
It appears that
$LIST
is a list that is being modified while in a for loop. This will likely cause a runtime error or an infinite loop.use-sys-exit
use-sys-exit
Detected use of
exit
. Use sys.exit
over the python shell exit
built-in. exit
is a helper for the interactive shell and may not be available on all Python implementations.writing-to-file-in-read-mode
writing-to-file-in-read-mode
The file object ‘$FD’ was opened in read mode, but is being written to. This will cause a runtime error.
no-strings-as-booleans
no-strings-as-booleans
Using strings as booleans in Python has unexpected results.
"one" and "two"
will return “two”. "one" or "two"
will return “one”. In Python, strings are truthy, and strings with a non-zero length evaluate to True.test-is-missing-assert
test-is-missing-assert
Comparison without assertion. The result of this comparison is not used. Perhaps this expression is missing an
assert
keyword.dict-del-while-iterate
dict-del-while-iterate
It appears that
$DICT[$KEY]
is a dict with items being deleted while in a for loop. This is usually a bad idea and will likely lead to a RuntimeError: dictionary changed size during iterationcannot-cache-generators
cannot-cache-generators
Generators can only be consumed once, so in most cases, caching them will cause an error when the already-consumed generator is retrieved from cache.
pdb-remove
pdb-remove
pdb is an interactive debugging tool and you may have forgotten to remove it before committing your code
useless-eqeq
useless-eqeq
This expression is always True:
$X == $X
or $X != $X
. If testing for floating point NaN, use math.isnan($X)
, or cmath.isnan($X)
if the number is complex.