afonasev / flake8-breakpoint

Flake8 plugin that check forgotten breakpoints
MIT License
14 stars 1 forks source link

Aborts with error when flake8 is feed from its stdin #1

Open memeplex opened 4 years ago

memeplex commented 4 years ago

Description

Installed the plugin, tried to use it with emacs flymake, which feeds flake from the stdin, it stopped working so I check doing the same manually in the terminal, I got:

~::  flake8 - < /tmp/test.py 
Traceback (most recent call last):
  File "/home/carlos/.local/bin/flake8", line 10, in <module>
    sys.exit(main())
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/main/cli.py", line 18, in main
    app.run(argv)
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/main/application.py", line 393, in run
    self._run(argv)
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/main/application.py", line 381, in _run
    self.run_checks()
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/main/application.py", line 300, in run_checks
    self.file_checker_manager.run()
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/checker.py", line 331, in run
    self.run_serial()
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/checker.py", line 315, in run_serial
    checker.run_checks()
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/checker.py", line 598, in run_checks
    self.run_ast_checks()
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8/checker.py", line 502, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8_plugin_utils/plugin.py", line 48, in run
    self._load_file()
  File "/home/carlos/.local/lib/python3.7/site-packages/flake8_plugin_utils/plugin.py", line 60, in _load_file
    with open(self._filename) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'stdin'

After uninstalling the plugin:

~:: cat /tmp/test.py  | flake8 -
stdin:7:1: F821 undefined name 'deew'
stdin:9:1: F821 undefined name 'f'

The file is simply:

~:: cat /tmp/test.py 
x = 2
y = 3

z = x + y

deew

f()
breakpoint()
afonasev commented 4 years ago

I'll try to fix it, thx for issue