Project

General

Profile

Autoformat your code

Added by Hackenberg Jan over 1 year ago

Hi,
to all who are developing own steps or plugins, I started using clang-format tool at work and code look and feel is amazing. I just installed and used it on Ubuntu 18.04, but it is also widely used for Windows.

sudo apt-get install clang-format

make a backup commit,

copy the following line in an sh script, but the path to the plugin.

#!/bin/bash
for f in $(find /home/follpathToPluginFolder/ -name '*.h’ -or -name '*.hpp’ -or -name '*.cpp’); do clang-format -i $f; done

give script user the rights to exectute it and it will well format all cpp code in that folder. Have fun starting QT Creator next time. You can also switch to other well distributed pre configurations, but read in clang forums if you tried and tested.

QT Creator seems to have Clang build in as well, but the clang plugin crashes my QT.... If you have it working you could avoid the command line.

Jan

p.s: taken from here:
https://askubuntu.com/questions/448497/source-code-formatter-indenter