From: Joel Rosdahl Date: Sun, 14 Jun 2020 18:45:23 +0000 (+0200) Subject: Remove cmake-format check and support X-Git-Tag: v4.0~401 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbb6006913f321bc388c9f584f9d1848b44efcfa;p=thirdparty%2Fccache.git Remove cmake-format check and support Motivation: 1. It’s unsatisfying to have to remember to run “make format” after editing CMake files. (Clang-Format has more editor integrations, and most importantly there are integrations for my editor of choice.) 2. The output of cmake-format seems to be a bit unstable between versions. 3. I don’t like some of cmake-format’s formatting choices. This could be potentially be improved, though. Let’s remove the support for now and maybe revisit later. --- diff --git a/.cmake-format b/.cmake-format deleted file mode 100644 index e0ce1c8df..000000000 --- a/.cmake-format +++ /dev/null @@ -1,21 +0,0 @@ -# This is for cmake-format. -# See https://github.com/cheshirekow/cmake_format -# for GUI integration and more details. - -# Installation: pip3 install cmake-format - -# cmake-format -# Execution: cmake-format CMakeLists.txt cmake/*.cmake src/CMakeLists.txt unittest/CMakeLists.txt -i -bullet_char: '*' -dangle_parens: false -enum_char: . -line_ending: unix -line_width: 80 -separate_ctrl_name_with_space: false -separate_fn_name_with_space: false -tab_size: 2 -max_subgroups_hwrap: 3 # default is 2 which prevents trivial set(key value PARENT_SCOPE) - -# cmake-lint -# Execution: cmake-lint CMakeLists.txt cmake/*.cmake src/CMakeLists.txt unittest/CMakeLists.txt -max_statement_spacing: 2 diff --git a/.travis.yml b/.travis.yml index f7119d60a..fb29537cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,7 +117,7 @@ jobs: - libzstd1-dev - libb2-dev - # Job 12: Run Clang-Format amd CMake-Format check mode + # Job 12: Run Clang-Format in check mode - os: linux compiler: clang env: T="Clang-Format" VERBOSE=1 BUILDEXTRAFLAGS="--target check_format" RUN_TESTS=0 @@ -185,7 +185,7 @@ jobs: - libzstd1-dev - libb2-dev - # Job 12: Run Clang-Format amd CMake-Format check mode + # Job 12: Run Clang-Format check mode - os: linux compiler: clang env: T="Clang-Format" VERBOSE=1 BUILDEXTRAFLAGS="--target check_format" RUN_TESTS=0 diff --git a/cmake/CodeAnalysis.cmake b/cmake/CodeAnalysis.cmake index 17eedf510..927486da7 100644 --- a/cmake/CodeAnalysis.cmake +++ b/cmake/CodeAnalysis.cmake @@ -6,7 +6,6 @@ if(ENABLE_CPPCHECK) find_program(CPPCHECK_EXE cppcheck) mark_as_advanced(CPPCHECK_EXE) # don't show in ccmake if(CPPCHECK_EXE) - # cmake-format: off set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXE} --suppressions-list=${CMAKE_SOURCE_DIR}/misc/cppcheck-suppressions.txt @@ -18,7 +17,6 @@ if(ENABLE_CPPCHECK) -I ${CMAKE_SOURCE_DIR} --template="cppcheck: warning: {id}:{file}:{line}: {message}" -i src/third_party) - # cmake-format: on else() message(WARNING "cppcheck requested but executable not found") endif() diff --git a/cmake/Findlibb2.cmake b/cmake/Findlibb2.cmake index 628616446..012a14c5f 100644 --- a/cmake/Findlibb2.cmake +++ b/cmake/Findlibb2.cmake @@ -97,9 +97,6 @@ else() endif() include(FeatureSummary) -# cmake-format: off -# (behaviour change in cmake-format 0.6.10) set_package_properties( libb2 PROPERTIES URL "http://blake2.net/" DESCRIPTION "C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp") -# cmake-format: on diff --git a/cmake/Findzstd.cmake b/cmake/Findzstd.cmake index a0095090b..758b6cc95 100644 --- a/cmake/Findzstd.cmake +++ b/cmake/Findzstd.cmake @@ -44,9 +44,6 @@ else() endif() include(FeatureSummary) -# cmake-format: off -# (behaviour change in cmake-format 0.6.10) set_package_properties( zstd PROPERTIES URL "https://facebook.github.io/zstd" DESCRIPTION "Zstandard - Fast real-time compression algorithm") -# cmake-format: on diff --git a/misc/check_format.sh b/misc/check_format.sh index dff3d94d0..7af55d929 100755 --- a/misc/check_format.sh +++ b/misc/check_format.sh @@ -8,17 +8,4 @@ fi clang-format --version find src unittest -path src/third_party -prune -o -regex ".*\.[ch]p?p?" -print0 | xargs -0 -n1 misc/run-clang-format --check -# Top level CMakeLists.txt + subidrectories. -# This avoids running the check on any build directories. -if hash cmake-format 2>/dev/null; then - printf "cmake-format version " - cmake-format --version - CLANG_FORMAT=cmake-format misc/run-clang-format --check CMakeLists.txt - find cmake -name "*.cmake" -print0 | CLANG_FORMAT=cmake-format xargs -0 -n1 misc/run-clang-format --check - find src unittest -name "CMakeLists.txt" -print0 | CLANG_FORMAT=cmake-format xargs -0 -n1 misc/run-clang-format --check -else - echo "Note: cmake-format not installed. CMake files will not be checked for correct formatting." - echo "You can install it via pip3 install cmake-format" -fi - echo "Format is ok" diff --git a/misc/format.sh b/misc/format.sh index 4e5861703..0e361a7aa 100755 --- a/misc/format.sh +++ b/misc/format.sh @@ -6,15 +6,4 @@ fi find src unittest -path src/third_party -prune -o -regex ".*\.[ch]p?p?" -exec misc/run-clang-format {} \; -if hash cmake-format 2>/dev/null; then - # Top level CMakeLists.txt + subidrectories. - # This avoids running the check on any build directories. - cmake-format -i CMakeLists.txt - find cmake -name "*.cmake" -exec cmake-format -i {} \; - find src unittest -name "CMakeLists.txt" -exec cmake-format -i {} \; -else - echo "Note: cmake-format not installed. CMake files will not be formatted." - echo "You can install it via pip3 install cmake-format" -fi - echo "Formatting complete"