From 39ad65fa205158a2a204b724f1a11e0e38f58637 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Mon, 12 Sep 2022 13:03:35 -0700 Subject: [PATCH] Remove redundant style check for clang-format. (#11668) This PR removes a redundant style check for clang-format. Our configuration in `.pre-commit-config.yaml` already runs clang-format so we don't need a separate step for that purpose in `style.sh`. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Ray Douglass (https://github.com/raydouglass) - Jordan Jacobelli (https://github.com/Ethyling) - Nghia Truong (https://github.com/ttnghia) URL: https://github.com/rapidsai/cudf/pull/11668 --- .pre-commit-config.yaml | 5 ++--- ci/checks/style.sh | 20 ++++---------------- cpp/.clang-format | 4 ++-- cpp/src/column/column_factories.cpp | 2 +- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a448b33a76d..08e35fb47b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,9 +45,8 @@ repos: rev: v11.1.0 hooks: - id: clang-format - files: \.(cu|cuh|h|hpp|cpp|inl)$ - types_or: [file] - args: ['-fallback-style=none', '-style=file', '-i'] + types_or: [c, c++, cuda] + args: ["-fallback-style=none", "-style=file", "-i"] - repo: local hooks: - id: no-deprecationwarning diff --git a/ci/checks/style.sh b/ci/checks/style.sh index 27f34dc335e..de3f8c01d83 100755 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -19,16 +19,16 @@ export RAPIDS_CMAKE_FORMAT_FILE=/tmp/rapids_cmake_ci/cmake-formats-rapids-cmake. mkdir -p $(dirname ${RAPIDS_CMAKE_FORMAT_FILE}) wget -O ${RAPIDS_CMAKE_FORMAT_FILE} ${FORMAT_FILE_URL} - +# Run pre-commit checks pre-commit run --hook-stage manual --all-files PRE_COMMIT_RETVAL=$? # Check for copyright headers in the files modified currently COPYRIGHT=`python ci/checks/copyright.py --git-modified-only 2>&1` -CR_RETVAL=$? +COPYRIGHT_RETVAL=$? # Output results if failure otherwise show pass -if [ "$CR_RETVAL" != "0" ]; then +if [ "$COPYRIGHT_RETVAL" != "0" ]; then echo -e "\n\n>>>> FAILED: copyright check; begin output\n\n" echo -e "$COPYRIGHT" echo -e "\n\n>>>> FAILED: copyright check; end output\n\n" @@ -37,20 +37,8 @@ else echo -e "$COPYRIGHT" fi -# Run clang-format and check for a consistent code format -CLANG_FORMAT=`python cpp/scripts/run-clang-format.py 2>&1` -CLANG_FORMAT_RETVAL=$? - -if [ "$CLANG_FORMAT_RETVAL" != "0" ]; then - echo -e "\n\n>>>> FAILED: clang format check; begin output\n\n" - echo -e "$CLANG_FORMAT" - echo -e "\n\n>>>> FAILED: clang format check; end output\n\n" -else - echo -e "\n\n>>>> PASSED: clang format check\n\n" -fi - RETVALS=( - $CR_RETVAL $PRE_COMMIT_RETVAL $CLANG_FORMAT_RETVAL + $PRE_COMMIT_RETVAL $COPYRIGHT_RETVAL ) IFS=$'\n' RETVAL=`echo "${RETVALS[*]}" | sort -nr | head -n1` diff --git a/cpp/.clang-format b/cpp/.clang-format index 6019a6f3d5c..26b9a5bf4ce 100644 --- a/cpp/.clang-format +++ b/cpp/.clang-format @@ -15,7 +15,7 @@ AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: true +AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: All @@ -27,7 +27,7 @@ AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: false +BinPackArguments: false BinPackParameters: false BraceWrapping: AfterClass: false diff --git a/cpp/src/column/column_factories.cpp b/cpp/src/column/column_factories.cpp index 118a08ab26d..098e0d3e2cc 100644 --- a/cpp/src/column/column_factories.cpp +++ b/cpp/src/column/column_factories.cpp @@ -157,7 +157,7 @@ std::unique_ptr make_fixed_width_column(data_type type, else if (is_duration (type)) return make_duration_column (type, size, state, stream, mr); else if (is_fixed_point(type)) return make_fixed_point_column(type, size, state, stream, mr); else return make_numeric_column (type, size, state, stream, mr); - /// clang-format on + // clang-format on } std::unique_ptr make_dictionary_from_scalar(scalar const& s,