diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6877fbd4a2947ca17e1a43cef429369ee6dcbdee --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,49 @@ +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=unusedFunction, + --suppress=missingInclude + ] + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v13.0.0 + hooks: + - id: clang-format + args: [ + --dry-run, + --Werror + ] + - repo: local + hooks: + - id: copyright + name: Copyright + entry: scripts/linter.py + args: [ + --copyright, + src + ] + pass_filenames: false + language: python + - repo: local + hooks: + - id: find + name: Find + entry: scripts/linter.py + args: [ + --find, + src + ] + pass_filenames: false + language: python diff --git a/README.md b/README.md index 962ea8630feb1778655e316a8acb85b74151860a..aa7d817f1decd499ac3425dd4ef87698c4a79282 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ In the main folder you will find **CMakeLists.txt** which is used to configure t * Git * Miosix Toolchain -Also, Ccache, Ninja, OpenOCD, Cppcheck and clang-format are recommended for a better experience. +Also, Ccache, Ninja, OpenOCD, Cppcheck, clang-format and pre-commit are recommended for a better experience. #### Cloning the repo @@ -53,12 +53,20 @@ cmake --build . ``` Or using the SBS wrapper script: -``` +```sh ./sbs ``` The build system will start building all the targets (entrypoints and tests). Depending on how many targets there are, this operation may take several minutes. +### Contributing + +You can install a pre-commit hook to ensure changes to the code will pass CI: + +```sh +pre-commit install +``` + ### What's next? In the [Wiki](https://git.skywarder.eu/scs/skyward-boardcore/wikis/home) you will find some first-steps **guides** (configuring the IDE, building a firmware, etc.) as well as the **coding guidelines** and some **best practices** we adopt.