-
Notifications
You must be signed in to change notification settings - Fork 45
Uncrustifying
This page is kept for reference, we'd prefer if anyone wanting to contribute manually formats code according to elementary's code style.
To easily install uncrustify 0.65, run the following in the terminal:
cd ~/Downloads # or wherever you want it
wget https://github.com/uncrustify/uncrustify/archive/uncrustify-0.65.tar.gz
tar -xf uncrustify-0.65.tar.gz
cd uncrustify-uncrustify-0.65/cmake/
cmake ..
sudo make installTest it with uncrustify --version. It should output Uncrustify-0.65_f.
The pre-commit hook runs uncrustify for you automatically when you commit. This removes the need to manually run it.
To set it up, simply run these commands from the base repository folder:
cp pre-commit .git/hooks/
chmod +x .git/hooks/pre-commituncrustify should now run automatically when you commit.
The above pre-commit hook should remove the need to run it manually. But if you need to for some reason, navigate to src/ and run uncrustify like this:
uncrustify --replace --no-backup -c ../etc/uncrustify-elementary-vala.cfg */*.vala *.valaRun uncrustify on the code with the above command before you commit your changes! This helps keeps the commit noise down.
Make sure you don't end comment lines with a \ (backslash)!
Otherwise uncrustify turns the next line into a comment as well:
// This prints a \
my_function ();// This prints a
// my_function ();It's okay if you put any character after it though:
// This prints a \ character.
// (or) This prints a \.
my_function ();