Skip to content
Snippets Groups Projects
Commit 565b549d authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

Merge remote-tracking branch 'project-template/master' into update-project-template

parents daa3094d d35adb88
No related branches found
No related tags found
No related merge requests found
#
# ChimeraTK clang-format definition.
#
# Use with clang-format-14. Please refer to https://apt.llvm.org/ for installation instructions on older Ubuntu versions.
#
---
BasedOnStyle: LLVM
AccessModifierOffset: '-1'
......
......@@ -4,9 +4,15 @@ ERRFILE=`mktemp`
export ERRFILE
echo 0 > "${ERRFILE}"
# This is necessary to get the two paths to match up, since we get a full path from cmake
mypath=$(pwd)
mypath=$(realpath $mypath)
exclude_path=${1:-justignoreme}
exclude_pattern="$exclude_path/*"
# check clang-format formatting
if which clang-format-14 > /dev/null; then
find \( -name *.cc -o -name *.cpp -o -name *.h \) -exec clang-format-14 --output-replacements-xml \{\} \; | grep "^<replacement " > /dev/null
find $mypath \( -name *.cc -o -name *.cpp -o -name *.h \) -not -path "$exclude_pattern" -exec clang-format-14 --output-replacements-xml \{\} \; | grep "^<replacement " > /dev/null
if [ $? -ne 1 ]; then
echo 1 > "${ERRFILE}"
echo "Code formatting incorrect!"
......@@ -30,7 +36,7 @@ checkCopyrightComment() {
fi
}
export -f checkCopyrightComment
find \( -name *.cc -o -name *.cpp -o -name *.h \) -exec bash -c 'checkCopyrightComment {}' \;
find $mypath \( -name *.cc -o -name *.cpp -o -name *.h \) -not -path "$exclude_pattern" -exec bash -c 'checkCopyrightComment {}' \;
# check all header files for "#pragma once" in 3rd line
checkPramgaOnce() {
......@@ -40,7 +46,7 @@ checkPramgaOnce() {
fi
}
export -f checkPramgaOnce
find -name *.h -exec bash -c 'checkPramgaOnce {}' \;
find $mypath -name *.h -not -path "$exclude_pattern" -exec bash -c 'checkPramgaOnce {}' \;
ERROR=`cat "${ERRFILE}"`
rm -f "${ERRFILE}"
......
......@@ -18,5 +18,5 @@
#######################################################################################################################
enable_testing()
add_test(NAME coding_style COMMAND ${CMAKE_SOURCE_DIR}/cmake/check-coding-style.sh
add_test(NAME coding_style COMMAND ${CMAKE_SOURCE_DIR}/cmake/check-coding-style.sh ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment