JBKahn / flake8-print

flake8
MIT License
121 stars 21 forks source link

Plugin doesn't detect prints #27

Closed adrianmoisey closed 6 years ago

adrianmoisey commented 6 years ago

Hi

I'm not sure what's going on here, but I can't seem to get the plugin to work:

root@9eab8a7ef08d:/code# flake8 --version
c3.5.0 (flake8-blind-except: 0.1.1, flake8-print: 3.0.1, flake8_pep3101: 0.1, import-order: 0.15, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 2.7.6 on Linux
root@9eab8a7ef08d:/code# cat test.py
import this

print "hello world"

a = b
root@9eab8a7ef08d:/code# flake8 test.py
test.py:1:1: F401 'this' imported but unused
test.py:5:5: F821 undefined name 'b'
JBKahn commented 6 years ago

I tested this recently when I released it. I'll try it with those specific versions and see if I can find something wrong.

Jenselme commented 6 years ago

Hi,

I have the same problem with:

 flake8 --version
3.5.0 (flake8-bugbear: 17.12.0, flake8-print: 3.0.1, flake8_commas._base: 0.4.3, flake8_quotes: 0.13.0, import-order: 0.16, mccabe: 0.6.1, naming: 0.4.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.6.3 on Linux

I also tried to install only flake8 and flake8-print in a venv but my print are still not detected.

I did some debugging and run method is correctly called and yields the proper result (correct line and errors). I guess the issue is in how flake8 consumes the results from the plugin. I'll try to dig deeper later.

JBKahn commented 6 years ago

Thanks for the work. This month I've been swamped moving and haven't had as much time for maintenance but I'll keep playing around with it too see if I can figure it out as soon as I have a second.

Jenselme commented 6 years ago

See #29 for why it doesn't work and my fix proposal. In the meantime, you can explicitely enable the report with something like flake8 --enable=T to get the expected result.

JBKahn commented 6 years ago

I'm going to play around and try to see if I can get everything to work properly. Just in the middle of a move right now so I'm super busy.

Jenselme commented 6 years ago

Any progress on this?

JBKahn commented 6 years ago

Sorry, been under the weather but I will try to wrap this up on the weekend.

JBKahn commented 6 years ago
(flake8print) jkahn (2018-02-11 11:29:25)>~/flake8-print (master)$ flake8 --version
3.5.0 (flake8-print: 3.1.0, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.6.4 on Darwin
(flake8print) jkahn (2018-02-11 11:29:27)>~/flake8-print (master)$ cat test.py
import this

print("hello world")

a = b
(flake8print) jkahn (2018-02-11 11:29:29)>~/flake8-print (master)$ flake8 test.py
test.py:1:1: F401 'this' imported but unused
test.py:3:1: T001 print found.
test.py:5:5: F821 undefined name 'b'

3.1.0 which I release today fixes this.