msherry / flycheck-pycheckers

Multiple syntax checker for Python in Emacs, using Flycheck
GNU General Public License v3.0
63 stars 23 forks source link

flake8 errors missing from *Flycheck errors* buffer #11

Closed posita closed 6 years ago

posita commented 6 years ago

I have pycheckers set up with flake8, mypy, and pylint. I'm not sure when this started happening, but flake8 items no longer appear in the error list. They still show up in the minibuffer though when the cursor is on an offending line:

screen shot 2017-12-12 at 10 57 47

$ flake8 --version
3.5.0 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.6.0 on Darwin

I'm still investigating the underlying cause, but I suspect flake8 may have changed its output format?


Test file:

from typing import Type

class A(object): pass
class B(object): pass

a = None  # type: A
a = A()
a = B()

def foo(arg1, arg2):
    return arg1.member, arg2.member
msherry commented 6 years ago

@posita Thanks for the report! I'm currently running a different version of flake8, so it's very possible that the format has changed.

msherry@msherry-mbp$ flake8 --version
3.3.0 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.5.0) CPython 2.7.13 on Darwin

That said, though, it seems weird that it would show up in one place but not another if there was a parse issue. I notice that you're running elpy, which has its own flake8 integration. Can you confirm the value of flycheck-pycheckers-checkers and ensure that flake8 is actually being run by flycheck-pycheckers, rather than elpy?

If so, I'll try to find some time to investigate this soon and release a fix!

posita commented 6 years ago

smacks forehead

Weird. flake8 was unchecked. I have no idea how/when that happened. Apologies for the red herring! 😳

As an aside, if I remove all customizations for that variable, it defaults to pylint, mypy 2, and mypy 3.

UPDATE: The noted defaults are intended. I wonder when I screwed up my own config. 🤔 In any event, apologies again for the distraction! 😞

sfavazza commented 4 years ago

Even if after some years... I got exactly into the same issue recently.

Elpy runs the flake8 command only when a python file is visited for the first time (or reverted), then it passes the control to flymake. To prevent any collision I disabled flymake and enabled flycheck with:

(add-hook 'elpy-mode-hook 'flymake-mode-off)
(add-hook 'elpy-mode-hook 'flycheck-mode)

Then to prevent elpy from running flake8 I set an invalid command string:

(setq elpy-syntax-check-command "none")

Moreover I changed the checkers for flycheck-pychechers to:

(setq flycheck-pycheckers-checkers (quote (flake8)))

With this setup the Flycheck errors buffer is empty, though if I run the flycheck-pycheckers python script from shell with --checker flake8 option I get all the flake8 messages.

image

image

Might it be a wrong parsing through Flyckech, i.e. an erroneous checker definition in the flycheck-pychecker.el file?

msherry commented 4 years ago

@sfavazza Thanks for the report! It looks like the output of flake8 is different than the regex is expecting -- e.g. the first item in an output line is "WARNING/ERROR", while the checker is expecting a filename first.

I've opened a separate issue (#47) to track this -- let's continue the conversation there.