summaryrefslogtreecommitdiffstats
path: root/Checkstyle/checkstyle
diff options
context:
space:
mode:
Diffstat (limited to 'Checkstyle/checkstyle')
-rwxr-xr-xCheckstyle/checkstyle52
1 files changed, 52 insertions, 0 deletions
diff --git a/Checkstyle/checkstyle b/Checkstyle/checkstyle
new file mode 100755
index 0000000..02cfad2
--- /dev/null
+++ b/Checkstyle/checkstyle
@@ -0,0 +1,52 @@
+#!/bin/bash
+################################################################################
+#
+# Author: Alejandro Colomar Andrés
+#
+# This script checks the style in all files of type (.c .cpp .h .hpp) in the
+# selected dirs.
+#
+
+
+################################################################################
+# variables #
+################################################################################
+dirs=(
+ ../
+)
+
+
+################################################################################
+# functions #
+################################################################################
+check_style()
+{
+
+ ./checkpatch.pl --show-types --no-tree -f $1 \
+ --ignore SPDX_LICENSE_TAG,IF_0,SPACING,BRACKET_SPACE
+}
+
+find_source_files()
+{
+
+ source_files=$(find $1 -type f \( -iname \*.c -o -iname \*.h -o -iname \*.cpp -o -iname \*.hpp \))
+}
+
+
+################################################################################
+# main #
+################################################################################
+for i in ${dirs[*]}
+do
+ find_source_files ${i}
+
+ for j in ${source_files}
+ do
+ check_style ${j}
+ done
+done
+
+
+################################################################################
+# end of file #
+################################################################################