Skip to content

(ci): update uncrustify and indent rules

Didier WECKMANN requested to merge 38-ci-update-uncrustify-and-indent-rules into dev

Description

Updated the current rules to 0.72 and propose a new stricter set.

Closes #38 (closed)

How to test it?

  • Install uncrustify 0.72 (Ubuntu 20.10 provides 0.71, but it is bogus, on the contrary of Ubuntu 21.04 which provides the good 0.72 version)

  • With sheldon:

    • as before if the uncrustify binary is named uncrustify and is in the PATH
    • by specifying uncrustify binary `--with-uncrustify /xxx/xxx/uncrustify-0.72.0

it will only test default rules updated to 0.72 version. Bassically nothing change, except some alignment as uncrustify will distinguish between declaration and simple re-affectation.

  • Standalone:
    • go to a git source tree (sight, for example)
    • find . -iname "*.?pp" -exec uncrustify-0.72.0 -c new_uncrustify.cfg --replace --no-backup --if-changed --mtime -l CPP {} \;
    • compare the result with a good diff viewer (gitkraken is nice enough)

303 options set, that's a lot. I've been quite careful with the result and they should match my PERSONAL taste. I'm completely open to discuss about them and I'm not putting any pressure to force people in any way. The goal is to have coherence in the code style, everywhere, most of the time, not starting a flame war:

  if(toto.getTutu() == (map[0]+zezette(1)))
  {
    ...
  }

is as acceptable as:

  if ( toto.getTutu() == ( map[ 0 ] + zezette( 1 ) ) )
  {
    ...
  }

but I would like to avoid a "mix" everywhere:

  if (toto.getTutu() == ( map[0 ] + zezette( 1)) )
  {
    ...
  }

  if(toto.getTutu( )==(map[2] +zezette(3) ))
  {
    ...
  }

Once a standard set of rules is accepted, new_uncrustify.cfg will overwrite uncrustify.cfg

Edited by Didier WECKMANN

Merge request reports