diff --git a/get-pr-changed-files b/get-pr-changed-files new file mode 100755 index 000000000000..29ab09b2e8f4 --- /dev/null +++ b/get-pr-changed-files @@ -0,0 +1,2 @@ +#!/bin/bash +curl -s -L https://patch-diff.githubusercontent.com/raw/cms-sw/$1/pull/$2.patch | grep '^diff --git ' | sed 's|.* a/||;s| *b/.*||' | sort | uniq diff --git a/run-pr-format b/run-pr-format new file mode 100755 index 000000000000..190fca27aba4 --- /dev/null +++ b/run-pr-format @@ -0,0 +1,25 @@ +#!/bin/bash -ex +PULL_REQUEST=$1 +CMS_BOT_DIR=$(dirname $0) +case $CMS_BOT_DIR in /*) ;; *) CMS_BOT_DIR=$(pwd)/${CMS_BOT_DIR} ;; esac +if [ "X${WORKSPACE}" = "X" ] ; then WORKSPACE=$(pwd) ; fi + +NUM_PROC=$(getconf _NPROCESSORS_ONLN) +cd $CMSSW_BASE/src +git cms-merge-topic -u ${PULL_REQUEST} +scram build -j ${NUM_PROC} llvm-ccdb +rm -rf ${CMSSW_BASE}/pr-changed-files-all.log ${CMSSW_BASE}/pr-changed-files-selected.log +${CMS_BOT_DIR}/get-pr-changed-files cmssw ${PULL_REQUEST} > ${CMSSW_BASE}/pr-changed-files-all.log +touch ${CMSSW_BASE}/pr-changed-files-selected.log +for f in $(cat ${CMSSW_BASE}/pr-changed-files-all.log | grep -v '/test/') ; do + if [ $(grep "/src/$f\"" $CMSSW_BASE/compile_commands.json | wc -l) -gt 0 ] ; then + echo $f >> ${CMSSW_BASE}/pr-changed-files-selected.log + fi +done +USER_CODE_CHECK_FILES=$(cat ${CMSSW_BASE}/pr-changed-files-selected.log | tr '\n' ' ') +if [ "${USER_CODE_CHECK_FILES}" != "" ] ; then + export USER_STYLE_CHECKS='boost-use-to-string,misc-string-compare,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-make-shared,modernize-use-bool-literals,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,performance-unnecessary-copy-initialization,readability-container-size-empty,readability-redundant-string-cstr,readability-static-definition-in-anonymous-namespace,readability-uniqueptr-delete-release' + export USER_CODE_CHECK_FILES + scram build -j ${NUM_PROC} style > ${WORKSPACE}/clang-tidy.log 2>&1 + git diff > ${WORKSPACE}/${PULL_REQUEST}.diff +fi