Closed
Description
Current status
pylint will issue pointless-statement
when a class (e.g. Exception) is used. this is great:
$ cat test.py
Exception
$ pylint3 test.py
test.py:1:0: W0104: Statement seems to have no effect (pointless-statement)
but if the exception is instantiated, it's not shown:
$ cat test.py
Exception()
$ pylint3 test.py
<nothing>
Proposal
while instantiating random classes can have side-effects, exceptions rarely (if ever) have such behavior. it's so uncommon that, imo, it should trigger a warning by default. we ran into issues where people forgot to raise
the exception (because the naming made it sound like it would throw an error), so code that was supposed to fail ended up not.
so how about:
$ cat test.py
Exception()
$ pylint3 test.py
test.py:1:0: W0104: Instantiated object seems to have no effect (pointless-exception-object)
feel free to bikeshed the exact naming/phrasing.
Version info
$ pylint3 --version
pylint3 2.2.2
astroid 2.1.0
Python 3.6.8 (default, Jan 3 2019, 03:42:36)
[GCC 8.2.0]