Skip to content

Add .clang-format file #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
49 changes: 49 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
Language: Cpp
Standard: Cpp11
BasedOnStyle: Chromium
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
SplitEmptyFunction: false
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: AfterColon
ColumnLimit: 100
ConstructorInitializerIndentWidth: 2
IncludeCategories:
- Regex: '^".*'
Priority: 1
- Regex: '^<boost.*'
Priority: 98
- Regex: '^<.*\.h>'
Priority: 2
- Regex: '^<.*'
Priority: 99
- Regex: '.*'
Priority: 4
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 4
ContinuationIndentWidth: 4
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakAssignment: 1
PenaltyBreakComment: 50
TabWidth: 2
...
9 changes: 9 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ defaults:
sudo pip3 install codespell
codespell --skip=".git"

clangformat: &clangformat
run:
name: "Run clang-format"
command: |
clang-format --version
find include src test -name '*.hpp' -o -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format -i
git diff --color --exit-code

build: &build
run:
name: "Build"
Expand Down Expand Up @@ -325,6 +333,7 @@ jobs:
steps:
- checkout
- *codespell
- *clangformat

# The job collects built packages (available in the workspace) and
# uploads them to the GitHub release matching the git tag.
Expand Down