Beno?t HERVIER wrote:
Hi,

I've a question before reinvent the wheel, does there is any tool to
fix some common pep8 format error ? Like space after comma or things
like that ?

I haven't seen one, but then a single replace command does the jobs just as 
well:

s/,\([^ ]\)/, \1/g

No need to write a special program for that imho.



I disagree with you that this is a 'common pep8 format error'. I type whitespace automatically to get readable code, so these errors never pop up here, except when I deliberately omit the space to make the line stay within the 80 characters limit.
(In which case your 'fixing' would cause another pylint error.)


> I ask because i'm planning to write one which use the results of
> pylint to do the fix.

I believe that making a program that fixes such errors automatically, defeats the purpose of those errors.

Imho a lot of pylints output is about making you aware of sloppy coding/typing, and the fact that you need to fix them manually, re-inforces the idea that you should 'fix' them while entering the code, in the first place. An automagic fixing program never makes you aware of those sloppy habits, and thus you will never get rid of them. (In other words, I think pylint is not only about rating/improving a program, it is about rating/improving your personal coding habits as well. An automatic fixing program makes the latter impossible.)


Another thing to consider is how many of the errors reported by pylint are actually fixable automagically. Many of the errors require a human decision (my most common error is 'bad variable name, invent a better one'). I suspect your program will stay within the range of errors that are easily circumvented by good code-entering habits (ie hit the 'space bar' and/or 'return key' a few times more often).
That would make the program useless for many people.


Sincerely,
Albert

_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to