Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
BasedOnStyle: LLVM

---
Language: Cpp
PointerAlignment: Left
AllowShortLoopsOnASingleLine: true

# If parameters don't fit on one line format(
# arg1, arg2
# );
AlignAfterOpenBracket: BlockIndent

# Try putting all constructor initializers
# on the next line if they don't fit, but,
# if they also don't fit on the next line,
# make them 1 per line
PackConstructorInitializers: NextLineOnly

# Function calls and init lists try to fit
# args on same line, else all on next line,
# else one arg per line
BinPackArguments: false
AllowAllArgumentsOnNextLine: true

# Don't reflow doxygen comment lines
CommentPragmas: '^\*? ?@'
23 changes: 23 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v3

- name: Lint
uses: pre-commit/actions@v3.0.1
continue-on-error: true

- name: Generate Suggestions
uses: reviewdog/action-suggester@v1.21.0
with:
tool_name: Linter
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ CMakeCache.txt
*Makefile
*.cmake
cmake_install.cmake

# Pre-commit files
pre-commit-*.pyz
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/crate-ci/typos
rev: v1.34.0
hooks:
- id: typos
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v20.1.8
hooks:
- id: clang-format
types_or: [c++, c]
16 changes: 16 additions & 0 deletions test/CI/install_prehooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

PRECOMMIT_VERSION="4.2.0"
PRECOMMIT_PYZ="pre-commit-${PRECOMMIT_VERSION}.pyz"
PRECOMMIT_URL="https://github.com/pre-commit/pre-commit/releases/download/v${PRECOMMIT_VERSION}/${PRECOMMIT_PYZ}"

if ! [[ -f "$PRECOMMIT_PYZ" ]]; then
wget --no-verbose --show-progress "$PRECOMMIT_URL"
chmod u+x "$PRECOMMIT_PYZ"
fi
PRECOMMIT=${PWD}/$PRECOMMIT_PYZ

#Go to git repo's root directory
cd $(git rev-parse --show-toplevel)

$PRECOMMIT install
Loading