[petsc-dev] pretty printing PETSc source code

Karl Rupp rupp at mcs.anl.gov
Tue Sep 18 22:21:24 CDT 2012


Hi,

 >   Yes, I have dreamed for many years that upon committing files to 
petsc-dev it would automatically trigger appropriate formatting tools so 
people cannot commit/push badly formatted source code. Unfortunately the 
llvm boys and girls have let me down and I still cannot find a tool 
better than uncrustify.  With a little ambition we could add a set of 
rules in addition to uncrustify that reject non-standard PETSc source 
code from being committed/pushed (like the absolutely perverse sizeof 
something that Jed is so damn fond of).

I would love to have something similar to such a coding-style-guard at 
commit for Vienna* too. On the other hand, I don't think that 
non-uncrustify-approved commits should be rejected, because there are 
some exceptions to rules which are rather tough to check automatically 
(like the 'if (!foo)' vs. 'if (foo != 0)' depending on the type of foo. 
However, some prompt ala 'Your code contains XY lines potentially 
violating the PETSc coding style. Are you sure you wish to commit? 
(Yes/No/Show)' would help a lot.

Best regards,
Karli




More information about the petsc-dev mailing list