From be77dbbda692792335a8e9e7c02e0c281f003c40 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 22 Aug 2018 12:31:48 +0530 Subject: clang-format: add the config file Also update the required documents and scripts to enable clang-format Change-Id: I73aae6db06c2f732a1779d59a73bc05e28beafba updates: bz#1564149 Signed-off-by: Amar Tumballi --- rfc.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'rfc.sh') diff --git a/rfc.sh b/rfc.sh index 6947aa24231..607fd7528fb 100755 --- a/rfc.sh +++ b/rfc.sh @@ -303,7 +303,7 @@ main() return; fi - check_patches_for_coding_style; + # check_patches_for_coding_style rebase_changes; @@ -320,6 +320,23 @@ main() warn_reference_missing; fi + # TODO: add clang-format command here. It will after the changes are done everywhere else + clang_format=$(clang-format --version) + if [ ! -z "${clang_format}" ]; then + # Considering git show may not give any files as output matching the + # criteria, good to tell script not to fail on error + set +e + list_of_files=$(git show --pretty="format:" --name-only | + grep -v "contrib/" | egrep --color=never "*\.[ch]$"); + if [ ! -z "${list_of_files}" ]; then + echo "${list_of_files}" | xargs clang-format -i + fi + set -e + else + echo "High probability of your patch not passing smoke due to coding standard check" + echo "Please install 'clang-format' to format the patch before submitting" + fi + if [ "$DRY_RUN" = 1 ]; then drier='echo -e Please use the following command to send your commits to review:\n\n' else -- cgit