style: run clang-format and configure pre-commit hooks
This commit is contained in:
51
.pre-commit-config.yaml
Normal file
51
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
# Pre-commit configuration for FCES-native
|
||||
repos:
|
||||
# 1. Standard hooks for general file cleanliness
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
|
||||
# 2. C++ Formatting using clang-format (fetched dynamically)
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v18.1.5
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c++, c]
|
||||
|
||||
# 3. C++ Static Analysis using local cppcheck
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: cppcheck
|
||||
name: cppcheck
|
||||
entry: cppcheck
|
||||
language: system
|
||||
types_or: [c++, c]
|
||||
args: [
|
||||
"--enable=warning,portability",
|
||||
"--suppress=missingIncludeSystem",
|
||||
"--suppress=unusedFunction",
|
||||
"--suppress=normalCheckLevelMaxBranches",
|
||||
"--inline-suppr",
|
||||
"--error-exitcode=1",
|
||||
"-Iinclude"
|
||||
]
|
||||
|
||||
# 4. Python Linter and Formatter (ruff)
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.4.4
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [ --fix ]
|
||||
- id: ruff-format
|
||||
|
||||
# 5. Python Type Checking (mypy)
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.10.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: [ "--ignore-missing-imports", "--strict" ]
|
||||
additional_dependencies: [ "types-requests", "pydantic" ]
|
||||
Reference in New Issue
Block a user