Skip to content

Commit

Permalink
feat: Add clang-format to lint the C++ codebase (#578)
Browse files Browse the repository at this point in the history
* feat: Add clang-format to lint the C++ codebase

* Lint cpp
  • Loading branch information
mrousavy authored Sep 1, 2023
1 parent b9b65b4 commit d097084
Show file tree
Hide file tree
Showing 14 changed files with 817 additions and 872 deletions.
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Config for clang-format version 16

# Standard
BasedOnStyle: llvm
Standard: c++14

# Indentation
IndentWidth: 2
ColumnLimit: 100

# Includes
SortIncludes: true
SortUsingDeclarations: true

# Pointer and reference alignment
PointerAlignment: Left
ReferenceAlignment: Left
ReflowComments: true

# Line breaking options
BreakBeforeBraces: Attach
BreakConstructorInitializers: BeforeColon
AllowShortFunctionsOnASingleLine: Empty
IndentCaseLabels: true
NamespaceIndentation: Inner

29 changes: 14 additions & 15 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,30 @@ on:
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'MMKV/**'
- 'android/src/main/cpp/**'
- 'ios/**'
pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'MMKV/**'
- 'android/src/main/cpp/**'
- 'ios/**'

jobs:
lint:
name: cpplint
name: Check clang-format
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'cpp'
- 'android/src/main/cpp'
- 'ios'
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-cpplint@master
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --linelength=230
targets: --recursive cpp android/src/main/cpp
filter: "-legal/copyright\
,-readability/todo\
,-build/namespaces\
,-whitespace/comments\
,-runtime/references\
,-build/include_order\
"
clang-format-version: '16'
check-path: ${{ matrix.path }}

Loading

0 comments on commit d097084

Please sign in to comment.