flycheck-mode as my syntax checker/linter for Python. It works great for the most part, however I can't get it to warn me when I have gone over a specified line length.
I am using
flake8 as my checker for Python, and have confirmed this with
flycheck-verify-setup. The output from this command in a
python-mode buffer is:
Syntax checkers for buffer config.py in python-mode: python-flake8 - predicate: t - executable: Found at /usr/bin/flake8 python-pylint - predicate: nil - executable: Not found python-pycompile - predicate: t - executable: Found at /usr/bin/python The following checker is explicitly selected for this buffer: python-flake8 - major mode: `python-mode' supported - predicate: t - executable: Found at /usr/bin/flake8 Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled checkers.
The checking works in general, so if I have the following Python code:
import re long_string = "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" class Foo(): pass
I get two warnings from
're' imported but unused [F401] expected 2 blank lines, found 0 [E302]
I do not, however, get a warning that
long_string is too long. I have tried setting:
(setq-default flycheck-flake8-maximum-line-length 79)
in my init file as suggested here. I have tried configuring
flake8 with a
flake8 file in my
~/.config/ directory, as described here, which I assume
flycheck is supposed to respect, based on this answer. I have also tried setting the value of
flycheck-flake8rc to point to that
flake8 file. I have tried using a local configuration file within a project as described here. None of these have worked for me. Instead,
flycheck seems to ignore any
flake8 config I try to give it, and will not warn about line length. This is the case even when I use
emacs -Q, initialize packages, and enable
global-flycheck-mode - although, in this case the output of
flycheck-verify-setup is the same. Any suggestions how I might be able to:
flycheck-modeto respect my
flycheck-modeto warn me about going over a specified line length?
Question 2 would be solved, in theory, by any solution to question 1, because I could set, e.g.:
[flake8] max-line-length = 79
in my configuration file, but I would be satisfied with a solution to question 2 alone. Thank you!