[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


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:

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:

Both? :-)

Zvezdan


More information about the Python-Dev mailing list