afonasev / flake8-return

Flake8 plugin for return expressions checking.
MIT License
62 stars 69 forks source link

Plugin crashes when used with stdin #69

Open gorrog opened 3 years ago

gorrog commented 3 years ago

Description

When emacs' lsp-mode calls flake 8 on a file (in order to lint it), the command errors out. I strongly suspect the issue is the same as the one reported here: https://github.com/sco1/flake8-annotations/issues/52 My reason for suspecting the error lies within this plugin is the fact that the error goes away when I remove this plugin.

What I Did

Opened the file, activated the virtual env, and started the language server (which called flake8)

What I expected

Flake8 gives results and the pyls lints my code

What I got

Stack trace below

2020-11-27 12:43:25,280 UTC - ERROR - pyls.plugins.flake8_lint - Error while running flake8 'Traceback (most recent call last):
  File "some_code/.venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 351, in _run
    self.run_checks()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 264, in run_checks
    self.file_checker_manager.run()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 323, in run
    self.run_serial()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 307, in run_serial
    checker.run_checks()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 589, in run_checks
    self.run_ast_checks()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 494, in run_ast_checks
    for (line_number, offset, text, _) in runner:
  File "some_code/.venv/lib/python3.8/site-packages/flake8_plugin_utils/plugin.py", line 75, in run
    self._load_file()
  File "some_code/.venv/lib/python3.8/site-packages/flake8_plugin_utils/plugin.py", line 87, in _load_file
    with open(self._filename, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'stdin'
'
ddelange commented 3 years ago

ref https://github.com/afonasev/flake8-plugin-utils/issues/47

afonasev commented 2 years ago

Thank you for issue. Unfortunately, I can't fix it quickly, but I'm ready to consider a pull request.