[petsc-dev] Coding style and its violations...

Karl Rupp rupp at mcs.anl.gov
Tue Jan 15 14:42:58 CST 2013


Dear all,

quoting a recent commit:

 > BarryFSmith committed 16 hours ago (raw commit)
 >
 > silly code formatting problems; some people still need to read the
 > style guide

So we have a style guide that is partially respected, partially ignored. 
Some things are pretty hard to check automatically, while others are 
rather simple. So let's pick
   "No tabs are allowed in any of the source code."
as an example and run

$petsc-dev/src> find . -name *.h -type f | xargs grep -P '\t' | wc -l

to pick the number of violations in .h-files. I get 3215 hits, which is 
still small compared to the 8797 hits in .c-files.

So, what can we do to reduce the number of violations of the style guide 
and keep the number of violations as small as possible in the future?

- First and foremost, eliminate (as many of the) existing violations (as 
possible) and come to a clean state.

- Run pre-push-scripts on bitbucket on the diff. They may not find all 
violations, but at least check for the most obvious ones.

- Add nightly tests on the source tree. We can compare the output of a 
properly configured uncrustify against the existing source files and 
complain on a mismatch.

Unless there are objections, I'm willing to devote some time on that 
while playing with options for a better testing environment. I don't 
think that a full elimination of all violations is ever possible nor 
reasonably attainable. However, a reduction of violations simplifies the 
handling of the code base considerably and is thus worth the effort.

Best regards,
Karli




More information about the petsc-dev mailing list