How to run the beautifier?

As recommended in the code style policy, I tried to setup my git using:

git config core.hooksPath .githooks
git config clangFormat.style file
git config kicad.check-format true

Unfortunately git commit reports:
SETUP ERROR: no git-clang-format executable found, or it is not executable
Hook /home/jv/kicad/.githooks/pre-commit.d/50-check-format failed with error code 1

This file contains:
check_clang_format() {
if hash git-clang-format 2>/dev/null; then
return
else
echo “SETUP ERROR: no git-clang-format executable found, or it is not executable”
exit 1
fi

clang itself is available everywhere

clang
clang: error: no input files

but I have no idea about how to setup git-clang-format

You will need to install clang-format. This is a separate package for most Linux distributions.

for any directory

clang-format file.cpp

echoes file.cpp why I assume clang-format package is already installed beside clang and llvm by default (ubuntu 18.03 LTS) ? Does the use need the clang server protocoll clangd ?

It needs the executable git-clang-format On my machine (Debian), this is provided by the clang-format package.

You might try searching for the executable. It is possible that it is not in your search path. Use something like locate git-clang-format

1 Like

ok - success. There was
/usr/lib/llvm-6.0/bin/git-clang-format out of path what was linked inside search path with link name
/usr/bin/git-clang-format-6.0

Decided to rename the link removing -6.0 in the hope of less side effects than changing path or 50-check-format file. Nevertheless its making an unreadble mess of my file e.g:

lut_dir lut_tab[] =  {
-                      {( e12_lut), E12_SIZE},\
-                      {( e6_lut ),  E6_SIZE},\
-                      {( e3_lut ),  E3_SIZE},\
-                      {( e1_lut ),  E1_SIZE}
-                     };                          //directory for look up tables
+lut_dir lut_tab[] = { { ( e12_lut ), E12_SIZE }, { ( e6_lut ), E6_SIZE }, { ( e3_lut ), E3_SIZE },
+    { ( e1_lut ), E1_SIZE } }; //directory for look up tables

A few other things are some blank inserted before and after operators and brackets. Not shure if I should consider this only as a suggestion ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.