-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🪝 Added a simple initial pre-commit configuration * 🎨 Incorporated pre-commit fixes * 🪝 Added a check to handle unwanted unicode characters * 🎨 Incorporated pre-commit fixes * 🪝 Added a check for common RST mistakes * 🎨 Incorporated pre-commit fixes * 🪝 Added an automatic clang-format check * 🎨 Incorporated pre-commit fixes * 🪝 Added a check for CMake linting and formatting * 🎨 Incorporated pre-commit fixes
- Loading branch information
Showing
33 changed files
with
1,656 additions
and
1,571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# To run all pre-commit checks, use: | ||
# | ||
# pre-commit run -a | ||
# | ||
# To install pre-commit hooks that run every time you commit: | ||
# | ||
# pre-commit install | ||
# | ||
|
||
ci: | ||
autoupdate_commit_msg: "⬆️ Bump pre-commit hooks" | ||
autofix_commit_msg: "🎨 Incorporated pre-commit fixes" | ||
|
||
exclude: "^libs/|^benchmarks/" | ||
|
||
repos: | ||
# Standard hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
# Handle unwanted unicode characters | ||
- repo: https://github.com/sirosen/texthooks | ||
rev: 0.6.2 | ||
hooks: | ||
- id: fix-ligatures | ||
- id: fix-smartquotes | ||
|
||
# Check for common RST mistakes | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
|
||
# clang-format the C++ part of the code base | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v17.0.4 | ||
hooks: | ||
- id: clang-format | ||
types_or: [ c++, c ] | ||
args: [ "-style=file" ] | ||
|
||
# CMake format and lint the CMakeLists.txt files | ||
- repo: https://github.com/cheshirekow/cmake-format-precommit | ||
rev: v0.6.13 | ||
hooks: | ||
- id: cmake-format | ||
additional_dependencies: [ pyyaml ] | ||
- id: cmake-lint | ||
additional_dependencies: [ pyyaml ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
# Enable cache if available | ||
function(fiction_enable_cache) | ||
set(CACHE_OPTION | ||
"ccache" | ||
CACHE STRING "Compiler cache to be used") | ||
set(CACHE_OPTION_VALUES "ccache" "sccache") | ||
set_property(CACHE CACHE_OPTION PROPERTY STRINGS ${CACHE_OPTION_VALUES}) | ||
list( | ||
FIND | ||
CACHE_OPTION_VALUES | ||
${CACHE_OPTION} | ||
CACHE_OPTION_INDEX) | ||
set(CACHE_OPTION | ||
"ccache" | ||
CACHE STRING "Compiler cache to be used") | ||
set(CACHE_OPTION_VALUES "ccache" "sccache") | ||
set_property(CACHE CACHE_OPTION PROPERTY STRINGS ${CACHE_OPTION_VALUES}) | ||
list(FIND CACHE_OPTION_VALUES ${CACHE_OPTION} CACHE_OPTION_INDEX) | ||
|
||
if (${CACHE_OPTION_INDEX} EQUAL -1) | ||
message( | ||
STATUS | ||
"Using custom compiler cache system: '${CACHE_OPTION}', explicitly supported entries are ${CACHE_OPTION_VALUES}" | ||
) | ||
endif () | ||
if(${CACHE_OPTION_INDEX} EQUAL -1) | ||
message( | ||
STATUS | ||
"Using custom compiler cache system: '${CACHE_OPTION}', explicitly supported entries are ${CACHE_OPTION_VALUES}" | ||
) | ||
endif() | ||
|
||
find_program(CACHE_BINARY NAMES ${CACHE_OPTION_VALUES}) | ||
if (CACHE_BINARY) | ||
message(STATUS "${CACHE_BINARY} found and enabled") | ||
set(CMAKE_CXX_COMPILER_LAUNCHER | ||
${CACHE_BINARY} | ||
CACHE FILEPATH "CXX compiler cache used") | ||
set(CMAKE_C_COMPILER_LAUNCHER | ||
${CACHE_BINARY} | ||
CACHE FILEPATH "C compiler cache used") | ||
else () | ||
message(WARNING "${CACHE_OPTION} is enabled but was not found. Not using it") | ||
endif () | ||
find_program(CACHE_BINARY NAMES ${CACHE_OPTION_VALUES}) | ||
if(CACHE_BINARY) | ||
message(STATUS "${CACHE_BINARY} found and enabled") | ||
set(CMAKE_CXX_COMPILER_LAUNCHER | ||
${CACHE_BINARY} | ||
CACHE FILEPATH "CXX compiler cache used") | ||
set(CMAKE_C_COMPILER_LAUNCHER | ||
${CACHE_BINARY} | ||
CACHE FILEPATH "C compiler cache used") | ||
else() | ||
message( | ||
WARNING "${CACHE_OPTION} is enabled but was not found. Not using it") | ||
endif() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# check whether the submodule ``modulename`` is correctly cloned in the ``/libs`` directory. | ||
# check whether the submodule ``modulename`` is correctly cloned in the | ||
# ``/libs`` directory. | ||
macro(check_if_present modulename) | ||
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/libs/${modulename}/CMakeLists.txt") | ||
message( | ||
FATAL_ERROR | ||
"Submodule `${modulename}` not cloned properly. Please run `git submodule update --init --recursive` from the main project directory to fix this issue.") | ||
endif () | ||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/libs/${modulename}/CMakeLists.txt") | ||
message( | ||
FATAL_ERROR | ||
"Submodule `${modulename}` not cloned properly. Please run `git submodule update --init --recursive` from the main project directory to fix this issue." | ||
) | ||
endif() | ||
endmacro() |
Oops, something went wrong.