From 95829c63ce0527742adf6d8789c9cb4dc7b56b91 Mon Sep 17 00:00:00 2001 From: VAM7686 Date: Sat, 20 Nov 2021 16:17:19 -0500 Subject: [PATCH] Added clang rules --- .clang-format | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ .clang-tidy | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .clang-format create mode 100644 .clang-tidy diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..e8de7c27 --- /dev/null +++ b/.clang-format @@ -0,0 +1,48 @@ +--- +BasedOnStyle: Google +BreakBeforeBraces: Allman +AccessModifierOffset: -2 +AlignEscapedNewlines: Right +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackParameters: true +BraceWrapping: + AfterUnion: true +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: false +BreakConstructorInitializers: BeforeComma +ColumnLimit: 120 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 60 +PenaltyBreakFirstLessLess: 1000 +PenaltyBreakString: 1 +PenaltyExcessCharacter: 1000 +PenaltyReturnTypeOnItsOwnLine: 90 +PointerAlignment: Left +SortIncludes: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpacesBeforeTrailingComments: 2 +SpaceInEmptyParentheses: false +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +Standard: Auto +TabWidth: 2 +UseTab: Never diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..ec374530 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,46 @@ +--- +Checks: '-*, + performance-*, + llvm-namespace-comment, + modernize-*, + readability-*, + bugprone-* + -clang-diagnostic-unused-command-line-argument, + ' +WarningsAsErrors: '*' +HeaderFilterRegex: 'src/igvc-software/igvc_(navigation)/.*\.h' +AnalyzeTemporaryDtors: false +CheckOptions: + - key: llvm-namespace-comment.ShortNamespaceLines + value: '10' + - key: llvm-namespace-comment.SpacesBeforeComments + value: '2' + - key: readability-braces-around-statements.ShortStatementLines + value: '2' + # Type names are CamelCase + - key: readability-identifier-naming.ClassCase + value: CamelCase + - key: readability-identifier-naming.EnumCase + value: CamelCase + - key: readability-identifier-naming.UnionCase + value: CamelCase + # Method names are camelBack + - key: readability-identifier-naming.MethodCase + value: camelBack + # Variable names snake_case + - key: readability-identifier-naming.VariableCase + value: lower_case + # Member variables are snake_case_ + - key: readability-identifier-naming.ClassMemberSuffix + value: '_' + # Except for constexpr + - key: readability-identifier-naming.ConstexprVariableCase + value: lower_case + - key: readability-identifier-naming.ConstexprVariableSuffix + value: '' + # Gobal variables are g_lower_case + - key: readability-identifier-naming.GlobalVariableCase + value: lower_case + - key: readability-identifier-naming.GlobalVariablePrefix + value: 'g_' +...