[petsc-dev] pretty printing PETSc source code

Barry Smith bsmith at mcs.anl.gov
Tue Sep 18 22:26:47 CDT 2012


On Sep 18, 2012, at 10:21 PM, Karl Rupp <rupp at mcs.anl.gov> wrote:

> 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.

    This is why I dream of LLVM doing it right. Where one could provide a virtually limitless list of special  (and perhaps silly) rules that depend on the exact circumstances of the code (types of variables etc).

> 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.

  Yup

> 
> Best regards,
> Karli
> 




More information about the petsc-dev mailing list