add codestyle guide

This commit is contained in:
Sebastian Krzyszkowiak 2017-09-10 23:54:47 +02:00
parent ca33fd7752
commit 6115818773
2 changed files with 62 additions and 0 deletions

41
.clang-format Normal file
View file

@ -0,0 +1,41 @@
---
AccessModifierOffset: '-2'
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignOperands: 'false'
AlignTrailingComments: 'false'
AllowShortBlocksOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: 'true'
AllowShortIfStatementsOnASingleLine: 'true'
AllowShortLoopsOnASingleLine: 'false'
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: 'true'
ColumnLimit: '0'
ContinuationIndentWidth: '2'
Cpp11BracedListStyle: 'true'
DerivePointerAlignment: 'false'
IndentCaseLabels: 'true'
IndentWidth: '2'
IndentWrappedFunctionNames: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: All
PointerAlignment: Left
SortIncludes: 'true'
SpaceAfterCStyleCast: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '1'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '2'
UseTab: Always

21
README_codestyle.md Normal file
View file

@ -0,0 +1,21 @@
# libsuperderpy codestyle
## clang-format
See [the configuration file](.clang-format).
## clang-tidy
```
-checks=*,-clang-analyzer-alpha.*,-google-readability-todo,-performance-type-promotion-in-math-fn,
-misc-unused-parameters,-cert-msc30-c,-cert-msc50-cpp
```
*Note:* clang-tidy runs automatically during compilation if found by CMake (can be disabled with `-DUSE_CLANG_TIDY=no`)
## Qt Creator's Code Model
```
-Weverything -Wno-missing-field-initializers -Wno-unused-parameter -Wno-padded -Wno-conversion
-Wno-double-promotion -Wno-bad-function-cast -Wno-pedantic -Wno-unused-macros -std=c11 -D__codemodel__
```