From 997a1db06012d4867373d5c982f2d9dc9c7dfb6f Mon Sep 17 00:00:00 2001 From: L-diy Date: Tue, 24 Oct 2023 18:17:15 +0200 Subject: [PATCH] Add configuration files for code formatter tools --- .clang-format | 69 ++++++++++++++++ README.md | 22 +++++- eclipse_format.xml | 193 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 .clang-format create mode 100644 eclipse_format.xml diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a71906b --- /dev/null +++ b/.clang-format @@ -0,0 +1,69 @@ +--- +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: true +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: true +BinPackParameters: false +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakStringLiterals: true +ColumnLimit: 120 +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +IncludeBlocks: Preserve +IncludeCategories: + - Regex: "^<(.*)>" + Priority: 0 + - Regex: ^"(.*)" + Priority: 1 + - Regex: "(.*)" + Priority: 2 +IncludeIsMainRegex: "(_test)?$" +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +Language: Cpp +MaxEmptyLinesToKeep: 1 +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 1000 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never +UseCRLF: false +... diff --git a/README.md b/README.md index 569ecce..489eac3 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,29 @@ ## Used Libs, compiler and apps - lwip version 2.1.2 - - CubeIDE version 1.12.1 + - CubeIDE version 1.12.1 - Firmware Lib (stm32f7) 1.17.1 ## Tasks Maak per taak een apparte c en h file aan. De naam van de file is de naam van de taak. Zo kunnen we de code proper houden. - [taken_en_verdeling.md](Taken_en_Verdeling.md) \ No newline at end of file + [taken_en_verdeling.md](Taken_en_Verdeling.md) + +## Style Guide +To maintain a consistent and clean codebase, follow the [style guide](style_guide.md). This document provides detailed instructions on naming conventions, code structure, and commenting practices. + +Please read the [style_guide.md](style_guide.md) carefully before making contributions. + +### Editor Configuration + +To help you adhere to the style guide, use the provided configuration files for the code formatters in your code editor. +You can choose from the following options: + +- `.clang-format`: + - For [Visual Studio Code](https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting) and [CLion](https://www.jetbrains.com/help/clion/clangformat-as-alternative-formatter.html#clion-support) users + - Or use the [clang-format](https://clang.llvm.org/docs/ClangFormat.html) tool directly + +- `eclipse_format.xml`: + - For Eclipse-based editors, including STM32CubeIDE. + - You can import it within eclipse settings, `Preferences -> LANGUAGE -> Code Style -> Formatter` tab. diff --git a/eclipse_format.xml b/eclipse_format.xml new file mode 100644 index 0000000..f3364ec --- /dev/null +++ b/eclipse_format.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +