Skip to content

Commit

Permalink
chore: Add clang-format to pre-commit.
Browse files Browse the repository at this point in the history
Also intends to replace `make check-src-include-order` and
`make check-hdr-include-order` by adding configuration to check
for include ordering.
  • Loading branch information
s373nZ committed Dec 16, 2024
1 parent 24b0339 commit 3182d79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
SortIncludes: CaseSensitive
IncludeBlocks: Preserve
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ repos:
- id: shellcheck
args: [ -fgcc ]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
hooks:
- id: clang-format
description: Runs formatting checks on the c code and and throws errors if suggestions
are detected, without modifying the code. Style is defined in `.clang-format`. When
encountering formatting-related errors, run `clang-format -i <path-to-file>` to make
(destructively) the suggestions and evalute the resulting diff for more context.
args: [ --dry-run, -Werror ]
entry: clang-format
types: [ c ]

- repo: local
hooks:
# Reimplementation of `make check-amount-access` for pygrep.
Expand Down

0 comments on commit 3182d79

Please sign in to comment.