Skip to content

Commit

Permalink
REPO: Add clang pre-commit workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mkmer committed Jan 26, 2025
1 parent e4dee90 commit 7eefcc8
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Pre-commit checks

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
codespell:
name: "Check for spelling errors"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
skip: "./include, ./configs"
ignore_words_file: ./support/.codespellignore

format:
name: "Clang format"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 2

- name: Run clang-format check
id: clang_check
uses: mkmer/clang-format-action@v1
with:
check: true
style: file:./dev/
extensions: h,c
clang-version: latest

35 changes: 35 additions & 0 deletions dev/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BasedOnStyle: Microsoft
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Linux
ColumnLimit: 120
Cpp11BracedListStyle: false
PackConstructorInitializers: Never
IndentCaseLabels: true
IndentCaseBlocks: true
KeepEmptyLinesAtTheStartOfBlocks: false
PenaltyReturnTypeOnItsOwnLine: 60
SortIncludes: Never
SpaceAfterCStyleCast: true
SpaceBeforeCpp11BracedList: true
TabWidth: 4
UseTab: Always

0 comments on commit 7eefcc8

Please sign in to comment.