Development/clang-format

Introduction
Sometimes when you a submit a patch to Gerrit that you expect to be OK, you get this error from the CI build by Jenkins:

The problem is that your code does not conform to the coding conventions used in the new files. This is not the case for older cxx/hxx files, as they are kept with the old coding conventions from Apache OpenOffice, in order to minimize the changes, and keep the git history usable.

If you have encountered the above error message, you have to install, and then run it on your code to format the code according to the convention for the new files.

Installing clang-format
The easy way to install specific version of  used in LibreOffice is to install it from the binaries. The binaries for  are available here: https://dev-www.libreoffice.org/bin/

You should download the appropriate binary from the above link, and then copy that to the  folder. For example, in x64 Linux you can do the installation with these commands:

Then you should make sure that you are running the correct. You should use  instead of the system.

As you can see, the version is different.

Checking the format
To make sure that the formatting of your code is OK, you can invoke this command:

Automatic reformatting of the code
After the installation is done, you should use the second one. You should use it this way:

After re-formatting the source code, just add it to the staging area of the git:

and then commit, and resubmit to Gerrit to see it as a new patch set, and then hopefully see the successful build in Jenkins CI.