diff --git a/.clang-format b/.clang-format index e0464987424a02d9daacc7730a9c49519f1cd175..8e3945de245a7bd55da09677b090e927d1002a72 100644 --- a/.clang-format +++ b/.clang-format @@ -68,6 +68,6 @@ SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: c++14 +Standard: c++17 TabWidth: 4 UseTab: Never diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 73badb0a6dec37f5615659a4d38e22ef9b94d669..1ed0824937097cdada6ff86238f9d97dbdb922fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ image: gekkofs/gekkofs:build_env-0.8.0 check format: stage: check format script: - - ${CI_PROJECT_DIR}/scripts/check_format.sh -s "${CI_PROJECT_DIR}/src" -i "${CI_PROJECT_DIR}/src" + - ${CI_PROJECT_DIR}/scripts/check_format.sh -s "${CI_PROJECT_DIR}/src" -i "${CI_PROJECT_DIR}/src" -v compile dependencies: stage: build deps diff --git a/scripts/check_format.sh b/scripts/check_format.sh index d58c045b71a85ea447dbdd28192dd8c6e8ba0cdc..c178ebc38838b648f8b9168bbdec2faa8e3910a8 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -4,6 +4,7 @@ PROJECT_SRC="$(pwd)/src" PROJECT_INCLUDE="$(pwd)/include" RUN_FORMAT=false CLANG_FORMAT_BIN="" +VERBOSE=false usage_short() { echo " @@ -30,6 +31,7 @@ optional arguments: (default: looks for 'clang-format' or 'clang-format-10') -r, --run_format run clang-formatter before formatting check DISCLAIMER: FILES ARE MODIFIED IN PLACE! + -v, --verbose shows the diff of all files " } @@ -61,6 +63,10 @@ while [[ $# -gt 0 ]]; do RUN_FORMAT=true shift # past argument ;; + -v | --verbose) + VERBOSE=true + shift # past argument + ;; -h | --help) help_msg exit @@ -115,6 +121,11 @@ while IFS= read -r -d '' FILE; do else echo -n "$FILE " echo "$UNFORMATTED_LINES" + if [[ "$VERBOSE" == true ]]; then + diff -u <(cat "$FILE") <($CLANG_FORMAT_BIN -style=file "$FILE") + echo "_______________________________________________________" + fi + echo FAIL=true fi fi