Status: Accepted
Owner: ----
New issue 468 by [email protected]: "make lint" should report
wrongly-indented continuation lines
http://code.google.com/p/ganeti/issues/detail?id=468
After I've found many cases in our code where we don't respect our style
guides regarding the alignment of continuation lines, which are not
reported by "make lint", I wondered if we could have an automatic system to
detect them. PEP8 could do it, but it assumes an indentation level of 4,
and we use 2. From Makefile.am:
# E127: continuation line over-indented for visual indent
# (since our indent level is not 4)
PEP8_IGNORE = E111,E121,E125,E127,E261,E501
I've tried to enable (not disable, actually) E127 in PEP8 and look at the
result. The only false positives that I've found are cases like this:
variable = \
very_long_expression_that_forces_to_break_the_statement
So, if we could ignore errors when the previous line ends with backslash,
we could get errors for the cases that we care about. I have a proposal on
how to solve this.
We run PEP8 as we do now, and if no errors are found, we run PEP8 again
with E127 enabled. We feed the list of errors to a small scripts that
checks the reported lines in the source code, and removes the cases like
the one above. It then prints all the remaining errors (if any) and
terminates with the appropriate exit code, so make fails when it should.
Comments are welcome.
It's a bit of a hack, but not difficult, and if we do it, we'll find
hundreds of style errors lingering in our code.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings