-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce basic linting infrastructure (#34)
* introduce clang-format * update format * initalized pre-commit config * apply precommit * cmake format config * format cmake * add CI * format pre-commit config * remove cmake format * update ci dependency * format * format CMmakeList with gersemi * use gersemi to format cmake file in precommit * reformat * enable auto-formatting * add markdown lint * switch to igorshubovych/markdownlint-cli * update markdown linter config * format README * remove duplicative clang-format * add more documentation * using more up-to-date clang-format config * Update .pre-commit-config.yaml Co-authored-by: David Sankel <[email protected]> * update pre-commit version * update CI * revert breaking change in CI * reformat directory * update doc on ColumnLimit --------- Co-authored-by: David Sankel <[email protected]>
- Loading branch information
Showing
13 changed files
with
399 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
--- | ||
Language: Cpp | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: Align | ||
AlignArrayOfStructures: None | ||
AlignConsecutiveAssignments: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: true | ||
AlignConsecutiveBitFields: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignConsecutiveDeclarations: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: true | ||
AlignConsecutiveMacros: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignConsecutiveShortCaseStatements: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCaseColons: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: Align | ||
AlignTrailingComments: | ||
Kind: Always | ||
OverEmptyLines: 0 | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: Yes | ||
AttributeMacros: | ||
- __capability | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
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 | ||
BreakAfterAttributes: Never | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakArrays: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeConceptDeclarations: Always | ||
BreakBeforeBraces: Custom | ||
BreakBeforeInlineASMColon: OnlyMultiline | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
BreakStringLiterals: true | ||
# Please update .markdownlint.yaml if this line is to be updated | ||
ColumnLimit: 119 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
EmptyLineAfterAccessModifier: Never | ||
EmptyLineBeforeAccessModifier: LogicalBlock | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IfMacros: | ||
- KJ_IF_MAYBE | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' | ||
Priority: 2 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '^(<|"(gtest|isl|json)/)' | ||
Priority: 3 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '.*' | ||
Priority: 1 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
IncludeIsMainRegex: '$' | ||
IncludeIsMainSourceRegex: '' | ||
IndentAccessModifiers: false | ||
IndentCaseBlocks: false | ||
IndentCaseLabels: false | ||
IndentExternBlock: AfterExternBlock | ||
IndentGotoLabels: true | ||
IndentPPDirectives: None | ||
IndentRequiresClause: true | ||
IndentWidth: 4 | ||
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: true | ||
KeepEmptyLinesAtEOF: false | ||
LambdaBodyIndentation: Signature | ||
LineEnding: DeriveLF | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 4 | ||
ObjCBreakBeforeNestedBlockParam: true | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PackConstructorInitializers: NextLine | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakOpenParenthesis: 0 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyIndentedWhitespace: 0 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Left | ||
PPIndentWidth: -1 | ||
QualifierAlignment: Custom | ||
QualifierOrder: | ||
- inline | ||
- static | ||
- constexpr | ||
- const | ||
- volatile | ||
- type | ||
ReferenceAlignment: Pointer | ||
ReflowComments: true | ||
RemoveBracesLLVM: false | ||
RemoveParentheses: Leave | ||
RemoveSemicolon: false | ||
RequiresClausePosition: OwnLine | ||
RequiresExpressionIndentation: OuterScope | ||
SeparateDefinitionBlocks: Leave | ||
ShortNamespaceLines: 1 | ||
SortIncludes: Never | ||
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 | ||
AfterRequiresInClause: false | ||
AfterRequiresInExpression: false | ||
BeforeNonEmptyParentheses: false | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: Never | ||
SpacesInContainerLiterals: true | ||
SpacesInLineCommentPrefix: | ||
Minimum: 1 | ||
Maximum: -1 | ||
SpacesInParens: Never | ||
SpacesInParensOptions: | ||
InCStyleCasts: false | ||
InConditionalStatements: false | ||
InEmptyParentheses: false | ||
Other: false | ||
SpacesInSquareBrackets: false | ||
Standard: Auto | ||
StatementAttributeLikeMacros: | ||
- Q_EMIT | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
TabWidth: 8 | ||
UseTab: Never | ||
VerilogBreakBetweenInstancePorts: true | ||
WhitespaceSensitiveMacros: | ||
- STRINGIZE | ||
- PP_STRINGIZE | ||
- BOOST_PP_STRINGIZE | ||
- NS_SWIFT_NAME | ||
- CF_SWIFT_NAME | ||
... |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# Codeowners for reviews on PRs | ||
|
||
* @bretbrownjr @camio @dietmarkuehl @neatudarius @steve-downey | ||
* @bretbrownjr @camio @dietmarkuehl @neatudarius @steve-downey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Lint Check (pre-commit) | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
|
||
- name: Get Changed Files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v45 | ||
|
||
# See: | ||
# https://github.com/tj-actions/changed-files?tab=readme-ov-file#using-local-git-directory- | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md033.md | ||
# Disable inline html linter is needed for <details> <summary> | ||
MD033: false | ||
|
||
# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md | ||
# Conforms to .clang-format ColumnLimit | ||
# Update the comment in .clang-format if we no-longer tie these two column limits. | ||
MD013: | ||
line_length: 119 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
|
||
# Clang-format for C++ | ||
# This brings in a portable version of clang-format. | ||
# See also: https://github.com/ssciwr/clang-format-wheel | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v18.1.8 | ||
hooks: | ||
- id: clang-format | ||
types_or: [c++, c] | ||
|
||
# CMake linting and formatting | ||
- repo: https://github.com/BlankSpruce/gersemi | ||
rev: 0.15.1 | ||
hooks: | ||
- id: gersemi | ||
name: CMake linting | ||
|
||
# Markdown linting | ||
# Config file: .markdownlint.yaml | ||
- repo: https://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.42.0 | ||
hooks: | ||
- id: markdownlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.