Differences between revisions 17 and 18
Revision 17 as of 2021-02-02 16:02:23
Size: 1442
Editor: ThomasKeller
Comment:
Revision 18 as of 2023-07-19 09:23:58
Size: 1620
Editor: JendrikSeipp
Comment: Switch to uncrustofy 0.72.0
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
Please note that we require a specific uncrustify version. Please note that we require a specific uncrustify version. On Ubuntu 22.04, 22.10 and 23.04, you get this uncrustify version by calling {{{sudo apt install uncrustify}}}, so on these Ubuntu versions you don't need the steps below.
Line 14: Line 14:
wget https://github.com/uncrustify/uncrustify/archive/uncrustify-0.67.tar.gz
tar -xzvf uncrustify-0.67.tar.gz
cd uncrustify-uncrustify-0.67
wget https://github.com/uncrustify/uncrustify/archive/uncrustify-0.72.0.tar.gz
tar -xzvf uncrustify-0.72.0.tar.gz
cd uncrustify-uncrustify-0.72.0

Back to developer page.

Using uncrustify to fix code layout

We use uncrustify with a Fast Downward configuration file (.uncrustify.cfg in the repository root) to enforce some of our formatting conventions. If a source file is properly formatted, applying uncrustify should be an idempotent operation (i.e., result in an identical file). This is important so that we can verify our style rules automatically, at least for those rules which uncrustify can handle.

Not all aspects of source layout are handled by uncrustify, so please still pay attention to our ../Whitespace rules and other ../CodingConventions.

Installing uncrustify

Please note that we require a specific uncrustify version. On Ubuntu 22.04, 22.10 and 23.04, you get this uncrustify version by calling sudo apt install uncrustify, so on these Ubuntu versions you don't need the steps below.

wget https://github.com/uncrustify/uncrustify/archive/uncrustify-0.72.0.tar.gz
tar -xzvf uncrustify-0.72.0.tar.gz
cd uncrustify-uncrustify-0.72.0
mkdir build
cd build
cmake ../
make -j4
sudo cp uncrustify /usr/local/bin  # Add binary to a directory on PATH.

Running uncrustify

To check the formatting of all C++ files, use ./misc/style/run-uncrustify.py. To actually edit the files that need to be uncrustified, use ./misc/style/run-uncrustify.py --modify. This script is also part of our tox tests:

sudo apt install tox
cd misc/
tox -e fix-style

To check the style of Python and C++ files, you can use tox -e style.

FastDownward: ForDevelopers/Uncrustify (last edited 2023-07-19 09:23:58 by JendrikSeipp)