SCF: Added checkpatch Support
This patch adds checkpatch to the Static Checking Framework.
The rules are kept identical to the one's used by the CI.
Change-Id: Ib90073b810fcaee3a01a71c52addcf53f33a08a4
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
diff --git a/static_checks/checkpatch/setup.sh b/static_checks/checkpatch/setup.sh
new file mode 100755
index 0000000..9894cba
--- /dev/null
+++ b/static_checks/checkpatch/setup.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+CHECKPATCH_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+CHECKPATCH_REPO="https://raw.githubusercontent.com/torvalds/linux/v5.9/scripts"
+
+download_file() {
+ F_PATH="$CHECKPATCH_PATH/$1"
+ curl "$CHECKPATCH_REPO/$1" --output "$F_PATH" &>/dev/null
+
+ if [ $? != 0 ]; then
+ echo "[SCF checkpatch] Error downloading file $1"
+ exit 1
+ else
+ if [ "$1" = "checkpatch.pl" ]; then
+ echo "[SCF checkpatch] $F_PATH --> chmod 740"
+ chmod 750 "$F_PATH"
+ else
+ echo "[SCF checkpatch] $F_PATH --> chmod 640"
+ chmod 640 "$F_PATH"
+ fi
+ fi
+}
+
+# Download required files
+download_file checkpatch.pl
+download_file const_structs.checkpatch
+download_file spelling.txt