From 527815f3a2f77e2785cb9c1e478cf360a16d66b9 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Fri, 1 Nov 2024 11:45:36 -0400 Subject: [PATCH 01/17] dummy change --- src/hello_world.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hello_world.cpp b/src/hello_world.cpp index c3c357c..84344af 100644 --- a/src/hello_world.cpp +++ b/src/hello_world.cpp @@ -2,16 +2,18 @@ namespace { -int factorials(int n) { +int factorials(int n) +{ if (n <= 1) - return 1; - return n * factorials(n - 1); + return 1; + return n * factorials(n - 1); } -int factorials2(int n) { +int factorials2(int n) +{ if (n <= 1) return 1; - return n * factorials2(n - 1); + return n * factorials2(n - 1); } } // namespace From 7e2bb80039cce122587fc21997dcfd87ad4fa796 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Fri, 1 Nov 2024 15:13:44 -0400 Subject: [PATCH 02/17] test ignore --- .github/workflows/clang-format.yml | 4 ++-- generated/dummy.cpp | 26 ++++++++++++++++++++++++++ src/hello_world.cpp | 12 +++++------- 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 generated/dummy.cpp diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index b23d6db..87c1931 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -37,7 +37,7 @@ jobs: git fetch origin ${{ env.BASE_BRANCH }} git fetch origin ${{ env.HEAD_BRANCH }} - #get differences on the PR branch + #get differences on the PR branch excluding generated folder in the root - name: git diff id: diffstep env: @@ -45,7 +45,7 @@ jobs: run: | # Format only the changed lines using clang-format-diff.py set -e - git diff -U0 --no-color origin/${{ env.BASE_BRANCH }}...origin/${{ env.HEAD_BRANCH }} > diff_output.patch + git diff -U0 --no-color origin/${{ env.BASE_BRANCH }}...origin/${{ env.HEAD_BRANCH }} -- . ':!generated/' > diff_output.patch cat diff_output.patch # run formatter on the differences if any diff --git a/generated/dummy.cpp b/generated/dummy.cpp new file mode 100644 index 0000000..2cef686 --- /dev/null +++ b/generated/dummy.cpp @@ -0,0 +1,26 @@ +#include + +namespace { + +int awful_____code(int n) +{ + int y = n+3; + return y ; +} +int factorials2(int n) { + if (n <= 1) + return 1; + return n * factorials2(n - 1); +} + +} // namespace + +int main() { + int number = 5; + std::cout + << awful_____code(number) + << "\n"; + return 0; +} + +// dummy diff --git a/src/hello_world.cpp b/src/hello_world.cpp index 84344af..c3c357c 100644 --- a/src/hello_world.cpp +++ b/src/hello_world.cpp @@ -2,18 +2,16 @@ namespace { -int factorials(int n) -{ +int factorials(int n) { if (n <= 1) - return 1; - return n * factorials(n - 1); + return 1; + return n * factorials(n - 1); } -int factorials2(int n) -{ +int factorials2(int n) { if (n <= 1) return 1; - return n * factorials2(n - 1); + return n * factorials2(n - 1); } } // namespace From 301299a8b150dccebc8381ccf3aad9485ed49255 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:26:38 -0500 Subject: [PATCH 03/17] clang format file --- .github/workflows/.clang-format | 308 +++++++++++++++++++++++++++++ .github/workflows/clang-format.yml | 2 +- 2 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/.clang-format diff --git a/.github/workflows/.clang-format b/.github/workflows/.clang-format new file mode 100644 index 0000000..649454e --- /dev/null +++ b/.github/workflows/.clang-format @@ -0,0 +1,308 @@ +--- +Language: Cpp +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowBreakBeforeNoexceptSpecifier: Never +AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: false +BreakAfterReturnType: None +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +BreakTemplateDeclarations: Yes +ColumnLimit: 140 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: true +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 3 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '([-_](test|unittest))?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequiresClause: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: false + AtStartOfFile: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF +MacroBlockBegin: '' +MacroBlockEnd: '' +MainIncludeChar: Quote +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: NextLine +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +PPIndentWidth: -1 +QualifierAlignment: Leave +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + - ParseTestProto + - ParsePartialTestProto + CanonicalDelimiter: pb + BasedOnStyle: google +ReferenceAlignment: Pointer +ReflowComments: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + ExceptDoubleParentheses: false + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false +SpacesInSquareBrackets: false +Standard: Auto +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TableGenBreakInsideDAGArg: DontBreak +TabWidth: 8 +UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE +... + diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 87c1931..a8dff4f 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -55,7 +55,7 @@ jobs: ACTIONS_RUNNER_DEBUG: true run: | if [ -s diff_output.patch ]; then - python3 clang-format-diff.py -p1 < diff_output.patch > formatted_differences.patch 2> error.log || true + python3 clang-format-diff.py -p1 --style=file:.github/workflows/.clang-format < diff_output.patch > formatted_differences.patch 2> error.log || true if [ -s error.log ]; then echo "Errors from clang-format-diff.py:" cat error.log From 6bac97b68b89031aed5c2f543aa5b1d23b0f75ce Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:29:03 -0500 Subject: [PATCH 04/17] fix --- .github/workflows/clang-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index a8dff4f..2ec52d6 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -55,7 +55,7 @@ jobs: ACTIONS_RUNNER_DEBUG: true run: | if [ -s diff_output.patch ]; then - python3 clang-format-diff.py -p1 --style=file:.github/workflows/.clang-format < diff_output.patch > formatted_differences.patch 2> error.log || true + python3 clang-format-diff.py -p1 -style=file:.github/workflows/.clang-format < diff_output.patch > formatted_differences.patch 2> error.log || true if [ -s error.log ]; then echo "Errors from clang-format-diff.py:" cat error.log From 6f0bb3bdaa679ac9d88bfdaf6ba9deef8a70eaf4 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:34:29 -0500 Subject: [PATCH 05/17] formatted --- src/hello_world.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/hello_world.cpp b/src/hello_world.cpp index c3c357c..0491a19 100644 --- a/src/hello_world.cpp +++ b/src/hello_world.cpp @@ -3,23 +3,20 @@ namespace { int factorials(int n) { - if (n <= 1) - return 1; + if (n <= 1) return 1; return n * factorials(n - 1); } int factorials2(int n) { - if (n <= 1) - return 1; + if (n <= 1) return 1; return n * factorials2(n - 1); } -} // namespace +} // namespace int main() { int number = 5; - std::cout << "Factorial of " << number << " is " << factorials(number) - << "\n"; + std::cout << "Factorial of " << number << " is " << factorials(number) << "\n"; return 0; } From d1dd364454db93b237e743949c9be492bc2c09c6 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:43:53 -0500 Subject: [PATCH 06/17] f --- .github/workflows/clang-format.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 2ec52d6..a4de9d5 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -54,6 +54,7 @@ jobs: env: ACTIONS_RUNNER_DEBUG: true run: | + clang-format --version if [ -s diff_output.patch ]; then python3 clang-format-diff.py -p1 -style=file:.github/workflows/.clang-format < diff_output.patch > formatted_differences.patch 2> error.log || true if [ -s error.log ]; then From e2b2c51e1e6411ceb54137407d037b6cdbb7b61b Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:53:12 -0500 Subject: [PATCH 07/17] f --- .github/workflows/.clang-format | 41 +++++---------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/.github/workflows/.clang-format b/.github/workflows/.clang-format index 649454e..d5045eb 100644 --- a/.github/workflows/.clang-format +++ b/.github/workflows/.clang-format @@ -1,5 +1,6 @@ --- Language: Cpp +# BasedOnStyle: Google AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignArrayOfStructures: None @@ -35,29 +36,7 @@ AlignConsecutiveShortCaseStatements: Enabled: false AcrossEmptyLines: false AcrossComments: false - AlignCaseArrows: false AlignCaseColons: false -AlignConsecutiveTableGenBreakingDAGArgColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveTableGenCondOperatorColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveTableGenDefinitionColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: false AlignEscapedNewlines: Left AlignOperands: Align AlignTrailingComments: @@ -67,7 +46,6 @@ AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never -AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false AllowShortCompoundRequirementOnASingleLine: true AllowShortEnumsOnASingleLine: true @@ -76,7 +54,9 @@ AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes AttributeMacros: - __capability BinPackArguments: true @@ -104,7 +84,6 @@ BraceWrapping: BreakAdjacentStringLiterals: true BreakAfterAttributes: Leave BreakAfterJavaFieldAnnotations: false -BreakAfterReturnType: None BreakArrays: true BreakBeforeBinaryOperators: None BreakBeforeConceptDeclarations: Always @@ -112,10 +91,8 @@ BreakBeforeBraces: Attach BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeColon -BreakFunctionDefinitionParameters: false BreakInheritanceList: BeforeColon BreakStringLiterals: true -BreakTemplateDeclarations: Yes ColumnLimit: 140 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false @@ -175,15 +152,12 @@ IntegerLiteralSeparator: HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true -KeepEmptyLines: - AtEndOfFile: false - AtStartOfBlock: false - AtStartOfFile: true +KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' -MainIncludeChar: Quote MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCBinPackProtocolList: Never @@ -282,7 +256,6 @@ SpacesInLineCommentPrefix: Maximum: -1 SpacesInParens: Never SpacesInParensOptions: - ExceptDoubleParentheses: false InCStyleCasts: false InConditionalStatements: false InEmptyParentheses: false @@ -294,7 +267,6 @@ StatementAttributeLikeMacros: StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION -TableGenBreakInsideDAGArg: DontBreak TabWidth: 8 UseTab: Never VerilogBreakBetweenInstancePorts: true @@ -304,5 +276,4 @@ WhitespaceSensitiveMacros: - NS_SWIFT_NAME - PP_STRINGIZE - STRINGIZE -... - +... \ No newline at end of file From 8c1cd723ee2e1826aab2c036af02af8580985e92 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:54:55 -0500 Subject: [PATCH 08/17] f --- .github/workflows/.clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.clang-format b/.github/workflows/.clang-format index d5045eb..a7b3188 100644 --- a/.github/workflows/.clang-format +++ b/.github/workflows/.clang-format @@ -276,4 +276,4 @@ WhitespaceSensitiveMacros: - NS_SWIFT_NAME - PP_STRINGIZE - STRINGIZE -... \ No newline at end of file +... From 67811622c3098b85e1913509fb4af0684ecbf6b6 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 11:57:55 -0500 Subject: [PATCH 09/17] f --- .github/workflows/clang-format.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index a4de9d5..a728813 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,7 +19,16 @@ jobs: - name: Install clang-format - run: sudo apt-get install -y clang-format + run: | + sudo apt-get update + sudo apt-get install -y wget + + # Add LLVM APT repository and the key for secure installation + wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc + sudo apt-get update + + # Install clang-format (latest version available, e.g., clang-format-16) + sudo apt-get install -y clang-format-16 - name: Download clang-format-diff.py run: | From 36e0eb5c877129d1bedd57f171508f6303de9b58 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 12:00:49 -0500 Subject: [PATCH 10/17] f --- .github/workflows/clang-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index a728813..648b94f 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -28,7 +28,7 @@ jobs: sudo apt-get update # Install clang-format (latest version available, e.g., clang-format-16) - sudo apt-get install -y clang-format-16 + sudo apt install -y clang-format - name: Download clang-format-diff.py run: | From c46fef63501129683295e5f917b6fd77702f4a44 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 12:02:48 -0500 Subject: [PATCH 11/17] f --- .github/workflows/clang-format.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 648b94f..e8da735 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -9,7 +9,7 @@ on: jobs: format-check: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code @@ -19,16 +19,7 @@ jobs: - name: Install clang-format - run: | - sudo apt-get update - sudo apt-get install -y wget - - # Add LLVM APT repository and the key for secure installation - wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc - sudo apt-get update - - # Install clang-format (latest version available, e.g., clang-format-16) - sudo apt install -y clang-format + run: sudo apt-get install -y clang-format - name: Download clang-format-diff.py run: | From b162ebb21b08e64e58d00c40af7b1ac32cb2feb1 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 12:05:31 -0500 Subject: [PATCH 12/17] f --- .github/workflows/clang-format.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index e8da735..bbe8c3c 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,7 +19,18 @@ jobs: - name: Install clang-format - run: sudo apt-get install -y clang-format + run: | + sudo apt-get update + sudo apt-get install -y wget + + # Add LLVM APT repository and the key for secure installation + wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc + sudo apt-get update + + # Install clang-format (latest version available, e.g., clang-format-16) + sudo apt-get install -y clang-format-16 # You can change the version if a newer version is available + + - name: Download clang-format-diff.py run: | From 3b9518b652a9b4a77b9ea96117539c2981568f90 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 12:13:22 -0500 Subject: [PATCH 13/17] f --- .github/workflows/clang-format.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index bbe8c3c..e8da735 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,18 +19,7 @@ jobs: - name: Install clang-format - run: | - sudo apt-get update - sudo apt-get install -y wget - - # Add LLVM APT repository and the key for secure installation - wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc - sudo apt-get update - - # Install clang-format (latest version available, e.g., clang-format-16) - sudo apt-get install -y clang-format-16 # You can change the version if a newer version is available - - + run: sudo apt-get install -y clang-format - name: Download clang-format-diff.py run: | From 96b047e53b2f0ee5cb35a93b68331adb025e4519 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 12:14:53 -0500 Subject: [PATCH 14/17] f --- .github/workflows/clang-format.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index e8da735..95ef68b 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,7 +19,18 @@ jobs: - name: Install clang-format - run: sudo apt-get install -y clang-format + run: | + sudo apt-get update + sudo apt-get install -y wget + + # Add LLVM APT repository and the key for secure installation + wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc + sudo apt-get update + + # Install clang-format (latest version available, e.g., clang-format-16) + sudo apt-get install -y clang-format-15 # You can change the version if a newer version is available + + - name: Download clang-format-diff.py run: | From 7a76d3281ffbe7e374324185f4113e54bb206f24 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 12:15:59 -0500 Subject: [PATCH 15/17] f --- .github/workflows/clang-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 95ef68b..e13a12a 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -20,7 +20,7 @@ jobs: - name: Install clang-format run: | - sudo apt-get update + sudo apt-get update sudo apt-get install -y wget # Add LLVM APT repository and the key for secure installation From c073898cacdb1c50e0d6930b108c21699b348a7d Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 13:18:36 -0500 Subject: [PATCH 16/17] f --- .github/workflows/.clang-format | 127 +++++++++-------------------- .github/workflows/clang-format.yml | 15 +--- 2 files changed, 39 insertions(+), 103 deletions(-) diff --git a/.github/workflows/.clang-format b/.github/workflows/.clang-format index a7b3188..b1392af 100644 --- a/.github/workflows/.clang-format +++ b/.github/workflows/.clang-format @@ -4,54 +4,21 @@ Language: Cpp AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignArrayOfStructures: None -AlignConsecutiveAssignments: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: true -AlignConsecutiveBitFields: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveDeclarations: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveMacros: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveShortCaseStatements: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCaseColons: false +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None AlignEscapedNewlines: Left AlignOperands: Align -AlignTrailingComments: - Kind: Always - OverEmptyLines: 0 +AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowBreakBeforeNoexceptSpecifier: Never +AllowShortEnumsOnASingleLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false -AllowShortCompoundRequirementOnASingleLine: true -AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -61,18 +28,17 @@ AttributeMacros: - __capability BinPackArguments: true BinPackParameters: true -BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false AfterClass: false AfterControlStatement: Never AfterEnum: false - AfterExternBlock: false AfterFunction: false AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false AfterUnion: false + AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false @@ -81,29 +47,33 @@ BraceWrapping: SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true -BreakAdjacentStringLiterals: true -BreakAfterAttributes: Leave -BreakAfterJavaFieldAnnotations: false -BreakArrays: true BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: Always +BreakBeforeConceptDeclarations: true BreakBeforeBraces: Attach -BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon -BreakInheritanceList: BeforeColon +BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true -ColumnLimit: 140 +ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' +QualifierAlignment: Leave CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true +DeriveLineEnding: true DerivePointerAlignment: true DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false +PackConstructorInitializers: NextLine +BasedOnStyle: '' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +AllowAllConstructorInitializersOnNextLine: true FixNamespaceComments: true ForEachMacros: - foreach @@ -132,30 +102,19 @@ IncludeCategories: IncludeIsMainRegex: '([-_](test|unittest))?$' IncludeIsMainSourceRegex: '' IndentAccessModifiers: false -IndentCaseBlocks: false IndentCaseLabels: true -IndentExternBlock: AfterExternBlock +IndentCaseBlocks: false IndentGotoLabels: true IndentPPDirectives: None -IndentRequiresClause: true +IndentExternBlock: AfterExternBlock +IndentRequires: false IndentWidth: 2 IndentWrappedFunctionNames: false -InsertBraces: false -InsertNewlineAtEOF: false InsertTrailingCommas: None -IntegerLiteralSeparator: - Binary: 0 - BinaryMinDigits: 0 - Decimal: 0 - DecimalMinDigits: 0 - Hex: 0 - HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: false -KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature -LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -165,21 +124,18 @@ ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true -PackConstructorInitializers: NextLine PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakOpenParenthesis: 0 -PenaltyBreakScopeResolution: 500 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 -PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 200 +PenaltyIndentedWhitespace: 0 PointerAlignment: Left PPIndentWidth: -1 -QualifierAlignment: Leave RawStringFormats: - Language: Cpp Delimiters: @@ -213,26 +169,19 @@ RawStringFormats: ReferenceAlignment: Pointer ReflowComments: true RemoveBracesLLVM: false -RemoveParentheses: Leave -RemoveSemicolon: false -RequiresClausePosition: OwnLine -RequiresExpressionIndentation: OuterScope SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 -SkipMacroDefinitionBody: false SortIncludes: CaseSensitive SortJavaStaticImport: Before -SortUsingDeclarations: LexicographicNumeric +SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true -SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true -SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements SpaceBeforeParensOptions: AfterControlStatements: true @@ -241,26 +190,23 @@ SpaceBeforeParensOptions: AfterFunctionDeclarationName: false AfterIfMacros: true AfterOverloadedOperator: false - AfterPlacementOperator: true - AfterRequiresInClause: false - AfterRequiresInExpression: false BeforeNonEmptyParentheses: false +SpaceAroundPointerQualifiers: Default SpaceBeforeRangeBasedForLoopColon: true -SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 SpacesInAngles: Never +SpacesInConditionalStatement: false SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: -1 -SpacesInParens: Never -SpacesInParensOptions: - InCStyleCasts: false - InConditionalStatements: false - InEmptyParentheses: false - Other: false +SpacesInParentheses: false SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +BitFieldColonSpacing: Both Standard: Auto StatementAttributeLikeMacros: - Q_EMIT @@ -268,12 +214,13 @@ StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 8 +UseCRLF: false UseTab: Never -VerilogBreakBetweenInstancePorts: true WhitespaceSensitiveMacros: + - STRINGIZE + - PP_STRINGIZE - BOOST_PP_STRINGIZE - - CF_SWIFT_NAME - NS_SWIFT_NAME - - PP_STRINGIZE - - STRINGIZE + - CF_SWIFT_NAME ... + diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index e13a12a..a4de9d5 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -9,7 +9,7 @@ on: jobs: format-check: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout code @@ -19,18 +19,7 @@ jobs: - name: Install clang-format - run: | - sudo apt-get update - sudo apt-get install -y wget - - # Add LLVM APT repository and the key for secure installation - wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc - sudo apt-get update - - # Install clang-format (latest version available, e.g., clang-format-16) - sudo apt-get install -y clang-format-15 # You can change the version if a newer version is available - - + run: sudo apt-get install -y clang-format - name: Download clang-format-diff.py run: | From 039a1707054aca842888fd4ee652fbb87a49effc Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 5 Nov 2024 13:24:40 -0500 Subject: [PATCH 17/17] f --- src/hello_world.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hello_world.cpp b/src/hello_world.cpp index 0491a19..960dac7 100644 --- a/src/hello_world.cpp +++ b/src/hello_world.cpp @@ -16,7 +16,8 @@ int factorials2(int n) { int main() { int number = 5; - std::cout << "Factorial of " << number << " is " << factorials(number) << "\n"; + std::cout << "Factorial of " << number << " is " << factorials(number) + << "\n"; return 0; }