From d6557c93f27e93e79944d2533c639e1b0654d8d0 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 30 Jan 2021 18:15:38 +0200 Subject: [PATCH 01/10] Create CONTRIBUTING.md --- CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a6fa6828 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,33 @@ +This contribution guide is in progress, improvements are welcome. + +### Code style + +Any C++ code PRs should aim to follow the style of existing code in the project. + +Using an autoformatter is heavily recommended, but make sure it's configured properly. + +There's currently preconfigured autoformatter rules for: + + * CLion (IntelliJ) in .idea/codeStyles/Project.xml + +You can use those to configure your own IDE if it's not already on the list. + +#### Linting errors and compiler warnings + +Try to avoid any currently enabled warnings and try to reduce the amount of linter errors. + +#### Spelling + +Make sure you spellcheck your code before commiting it. + +#### TODO, FIXME + +Check before commiting that you haven't forgotten anything, preferably don't leave these in your commits. + +#### Licence headers + +You should add your name to the comma-space separated list of contributors if there's a license header. + +### License + +By contributing you agree to licence your code under the repository's general license (which is currently GPL-v3+). From 04fd4a7d03fe88a44807ca62b3697dfe5864b56c Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 30 Jan 2021 18:48:06 +0200 Subject: [PATCH 02/10] Create .gitconfig --- .gitconfig | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitconfig diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 00000000..b2274475 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,5 @@ +[core] + whitespace = blank-at-eol,blank-at-eof,space-before-tab + autocrlf = input +[apply] + whitespace = fix From f6927548419542ce1540b6c1419b1c854fd17c8c Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 30 Jan 2021 18:52:14 +0200 Subject: [PATCH 03/10] Create .gitattributes --- .gitattributes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..2257cac4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.c text +*.cpp text +*.h text +*.hpp text + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.bin binary +*.jpg binary +*.jpeg binary From 4371b7fecced6b222dfa02cb71ecbb4ff54b6785 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 30 Jan 2021 19:11:07 +0200 Subject: [PATCH 04/10] Update CMakeLists.txt --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5955d393..4580609a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -610,7 +610,7 @@ include_directories( "${NRF5_SDK_PATH}/modules/nrfx/drivers/include" "${NRF5_SDK_PATH}/modules/nrfx/hal" "${NRF5_SDK_PATH}/modules/nrfx/mdk" - ${NRF5_SDK_PATH}/external/freertos/source/include + "${NRF5_SDK_PATH}/external/freertos/source/include" "${NRF5_SDK_PATH}/components/toolchain/cmsis/include" "${NRF5_SDK_PATH}/components/libraries/atomic" "${NRF5_SDK_PATH}/components/libraries/atomic_fifo" From f907fcbe614690fdffe2b27bcd1526c0f1d10b36 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 30 Jan 2021 23:42:46 +0200 Subject: [PATCH 05/10] Added Clang Format rules --- .clang-format | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..e7355499 --- /dev/null +++ b/.clang-format @@ -0,0 +1,136 @@ +--- +Language: Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: true +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortLambdasOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: true + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 140 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: true +DeriveLineEnding: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + - Regex: '.*' + Priority: 1 + SortPriority: 0 +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: true +IndentGotoLabels: true +IndentPPDirectives: BeforeHash +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +ReflowComments: true +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatementsExceptForEachMacros +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +# Needs new Clang: SpaceAroundPointerQualifiers: After +Standard: Latest +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseCRLF: false +UseTab: Never +... From 9be9ddca45c46969f0308271cb78667617fc8bb7 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 30 Jan 2021 23:50:40 +0200 Subject: [PATCH 06/10] Improve CLion's formatting rules --- .idea/codeStyles/Project.xml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 7bdfbcb1..33a4a045 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -8,10 +8,30 @@