1
0
Fork 0

changed output paths of lint.sh

This commit is contained in:
Christian Kühnel 2020-03-26 10:19:20 +01:00
parent 580d4ba63c
commit 4465b0fc52
3 changed files with 15 additions and 13 deletions

View file

@ -124,7 +124,7 @@ pipeline {
{ {
script { script {
try { try {
sh(script: "${SCRIPT_DIR}/lint.sh HEAD~1") sh(script: "${SCRIPT_DIR}/lint.sh HEAD~1 ${RESULT_DIR}")
} catch (e) { } catch (e) {
success = false; success = false;
failure_message += "\nFailed to run linters" // append as build might already be broken failure_message += "\nFailed to run linters" // append as build might already be broken
@ -154,8 +154,6 @@ pipeline {
set -eu set -eu
cp ${LLVM_DIR}/build/CMakeCache.txt . || : cp ${LLVM_DIR}/build/CMakeCache.txt . || :
cp ${LLVM_DIR}/build/test-results.xml . || : cp ${LLVM_DIR}/build/test-results.xml . || :
cp ${LLVM_DIR}/clang-format.patch . || :
cp ${LLVM_DIR}/clang-tidy.txt . || :
mkdir -p ${TARGET_DIR} mkdir -p ${TARGET_DIR}
cp * ${TARGET_DIR} cp * ${TARGET_DIR}
""" """
@ -167,8 +165,8 @@ pipeline {
--test-result-file "${RESULT_DIR}/test-results.xml" \ --test-result-file "${RESULT_DIR}/test-results.xml" \
--host "${PHABRICATOR_HOST}/api/" \ --host "${PHABRICATOR_HOST}/api/" \
--buildresult ${currentBuild.result} \ --buildresult ${currentBuild.result} \
--clang-format-patch "${LLVM_DIR}/clang-format.patch" \ --clang-format-patch "${RESULT_DIR}/clang-format.patch" \
--clang-tidy-result "${LLVM_DIR}/clang-tidy.txt" \ --clang-tidy-result "${RESULT_DIR}/clang-tidy.txt" \
--clang-tidy-ignore "${SCRIPT_DIR}/clang-tidy-comments.ignore" \ --clang-tidy-ignore "${SCRIPT_DIR}/clang-tidy-comments.ignore" \
--results-dir "${TARGET_DIR}" \ --results-dir "${TARGET_DIR}" \
--results-url "${RESULT_URL}" \ --results-url "${RESULT_URL}" \

View file

@ -130,7 +130,7 @@ pipeline {
steps { steps {
script { script {
try { try {
sh(script: "${SCRIPT_DIR}/lint.sh") sh(script: "${SCRIPT_DIR}/lint.sh HEAD ${TARGET_DIR}")
} catch (e) { } catch (e) {
success = false; success = false;
failure_message += "\nFailed to run linters" // append as build might already be broken failure_message += "\nFailed to run linters" // append as build might already be broken

View file

@ -19,12 +19,16 @@
set -eux set -eux
echo "Running linters... =====================================" echo "Running linters... ====================================="
# In the normal case: diff staging area against head if (( $# != 2 )); then
# Optionml: diff against another commit, set via command line parameter echo "Syntax: lint.sh <COMMIT> <OUTPUT_DIR>"
COMMIT=HEAD exit 1
if (( $# == 1 )); then
COMMIT="$1"
fi; fi;
# Commit to diff against
COMMIT="$1"
# output directory for test results
OUTPUT_DIR="$2"
# root directory, where the config files are located
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [ ! -f "compile_commands.json" ] ; then if [ ! -f "compile_commands.json" ] ; then
echo "Could not find compile commands.json in $(pwd)" echo "Could not find compile commands.json in $(pwd)"
@ -35,12 +39,12 @@ fi
# Let clang format apply patches --diff doesn't produces results in the format we want. # Let clang format apply patches --diff doesn't produces results in the format we want.
git-clang-format "${COMMIT}" git-clang-format "${COMMIT}"
set +e set +e
git diff -U0 --exit-code | "${SCRIPT_DIR}/ignore_diff.py" "${SCRIPT_DIR}/clang-format.ignore" > "${TARGET_DIR}"/clang-format.patch git diff -U0 --exit-code | "${DIR}/ignore_diff.py" "${DIR}/clang-format.ignore" > "${OUTPUT_DIR}"/clang-format.patch
set -e set -e
# Revert changes of git-clang-format. # Revert changes of git-clang-format.
git checkout -- . git checkout -- .
# clang-tidy # clang-tidy
git diff -U0 "${COMMIT}" | "${SCRIPT_DIR}/ignore_diff.py" "${SCRIPT_DIR}/clang-tidy.ignore" | clang-tidy-diff -p1 -quiet | sed "/^[[:space:]]*$/d" > "${TARGET_DIR}"/clang-tidy.txt git diff -U0 "${COMMIT}" | "${DIR}/ignore_diff.py" "${DIR}/clang-tidy.ignore" | clang-tidy-diff -p1 -quiet | sed "/^[[:space:]]*$/d" > "${OUTPUT_DIR}"/clang-tidy.txt
echo "linters completed ======================================" echo "linters completed ======================================"