[Python-Dev] Running Clang 2.7's static analyzer over the code base (original) (raw)
Zvezdan Petkovic zvezdan at zope.com
Tue May 4 17:27:58 CEST 2010
- Previous message: [Python-Dev] Running Clang 2.7's static analyzer over the code base
- Next message: [Python-Dev] Running Clang 2.7's static analyzer over the code base
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On May 4, 2010, at 8:41 AM, Antoine Pitrou wrote:
I think we should reindent all 3 branches. Most of the work can probably be scripted (str.replace("\t", " " * 4)), and then a visual pass is necessary to fix vertical alignments and the like.
I think we should reindent all 3 branches. Most of the work can probably be scripted (str.replace("\t", " " * 4)), and then a visual pass is necessary to fix vertical alignments and the like.
Is it really that simple?
People often do the following:
- use tabs inside strings ("\t" should be used instead);
- use tabs for alignment of inline comments on the right side;
- mix tabs and spaces for indentation whitespace (continuation lines);
- use tabs for alignment inside comments.
A simple replacement of a tab with 4 spaces as you propose does not work on such a code.
To do it properly, you may end up reinventing indent
(UNIX program).
What if there was a set of indent
flags defined for PEP-7?
It would be a nice tool to check whether a new code complies.
However, running indent
on an existing code would probably cause non-whitespace changes too as it rearranges the comments and code.
I'm afraid that any other kind of "script + visual pass + post-edit" would incur similar changes if done properly (only more tedious).
So, the question is what bothers developers more:
- old C files with tab indentation, or
- a lot of changes in version control to fix them?
Both? :-)
Zvezdan
- Previous message: [Python-Dev] Running Clang 2.7's static analyzer over the code base
- Next message: [Python-Dev] Running Clang 2.7's static analyzer over the code base
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]