From f93e4e7f8025322c365e649cad96b65faf9d6ab5 Mon Sep 17 00:00:00 2001
From: Damiano Amatruda <damiano.amatruda@skywarder.eu>
Date: Sat, 11 Dec 2021 20:58:04 +0100
Subject: [PATCH] Add pre-commit hook

---
 .clang-format           | 13 +++++++++++++
 .pre-commit-config.yaml | 30 ++++++++++++++++++++++++++++++
 README.md               |  2 +-
 3 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 .clang-format
 create mode 100644 .pre-commit-config.yaml

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..827c89b
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,13 @@
+{
+    BasedOnStyle: Google,
+    AccessModifierOffset: -4,
+    AlignConsecutiveAssignments: true,
+    AllowShortIfStatementsOnASingleLine: false,
+    AllowShortLoopsOnASingleLine: false,
+    BreakBeforeBraces: Allman,
+    ColumnLimit: 80,
+    ConstructorInitializerAllOnOneLineOrOnePerLine: false,
+    IndentCaseLabels: true,
+    IndentWidth: 4,
+    KeepEmptyLinesAtTheStartOfBlocks: true,
+}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..f9089f6
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,30 @@
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v2.3.0
+    hooks:
+      - id: check-yaml
+      - id: end-of-file-fixer
+      - id: trailing-whitespace
+  - repo: https://gitlab.com/daverona/pre-commit/cpp
+    rev: 0.8.0
+    hooks:
+      - id: cppcheck
+        args: [
+          --quiet,
+          --language=c++,
+          --enable=all,
+          --inline-suppr,
+          --suppress=unmatchedSuppression,
+          --suppress=unusedFunction,
+          --suppress=missingInclude,
+          --suppress=noExplicitConstructor
+        ]
+  - repo: https://github.com/pre-commit/mirrors-clang-format
+    rev: v13.0.0
+    hooks:
+      - id: clang-format
+        args: [
+          -style=file,
+          --dry-run,
+          --Werror
+        ]
diff --git a/README.md b/README.md
index 9f39cc1..6abc0c7 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
 # Miosix Host
 
-API emulation layer of the Miosix embedded real-time operating system compatible with the host system.
\ No newline at end of file
+API emulation layer of the Miosix embedded real-time operating system compatible with the host system.
-- 
GitLab