To get flycheck working for Python, I had reached a satisfactory .emacs
, which turned out to require no more than:
(require 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
Now after a bit of looking forward at what Python 3.6 will be like, even a two-liner
class Foo():
pass
gets a whole slew of warnings:
Too few public methods (0/2) [too-few-public-methods]
Class has no __init__ method [no-init]
Old-style class defined. [old-style-class]
Missing class docstring [missing-docstring]
Missing module docstring [missing-docstring]
despite that I'm now firmly back in 2.7 (sudo port select --set python python27
).
Emacs gets us used to being context-agnostic. It usually doesn't matter what is on the system; one gets the same behavior if one starts from an unchanged .emacs
. What else might have changed in my system to trigger a sudden increase in flycheck warnings?
OK, I found the answer.
flycheck chooses (silently?) flake8, and if that is not found, it falls back on pylint (and subsequently on pycompile).
The problem was that the symlink
flake8
had vanished. Here is why/how.After selecting python36 and back
and after selecting pip36 and back
the symlink
/opt/local/bin/flake8
disappears. Only flake8-2.7 is left.What happens, presumably, is that
flake8
points to nothing (port select
is updated, and the symlink is removed) when you update to Python 3.6 but do not have flake8-36. The symlink cannot be reinstated when you downgrade to Python 2.7 (one of these, perhaps the former, merits a warning—maybe as a minor bug in MacPorts).The solution is to explicitly point
flake8
toflake8-27
when you downgrade.And the link comes back and flycheck chooses
flake8
overpylint
.