Skip to content

Commit

Permalink
Linting: Upgrade to latest version of yscope-dev-utils and add C++ li…
Browse files Browse the repository at this point in the history
…nt configs from yscope-dev-utils. (#537)
  • Loading branch information
kirkrodrigues authored Sep 13, 2024
1 parent 8ea88fc commit 3ceb17e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 153 deletions.
151 changes: 2 additions & 149 deletions components/core/.clang-format
Original file line number Diff line number Diff line change
@@ -1,75 +1,5 @@
# yamllint disable-line rule:document-start
---
ColumnLimit: 100
IndentWidth: 4
# yamllint disable-line rule:document-start
---
Language: "Cpp"
AccessModifierOffset: -4
AlignAfterOpenBracket: "BlockIndent"
AlignArrayOfStructures: "None"
AlignConsecutiveAssignments: "None"
AlignConsecutiveBitFields: "None"
AlignConsecutiveDeclarations: "None"
AlignConsecutiveMacros: "None"
AlignEscapedNewlines: "DontAlign"
AlignOperands: "Align"
AlignTrailingComments:
Kind: "Never"
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowBreakBeforeNoexceptSpecifier: "OnlyWithParen"
AllowShortBlocksOnASingleLine: "Always"
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: "Inline"
AllowShortIfStatementsOnASingleLine: "Never"
AllowShortLambdasOnASingleLine: "All"
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: "None"
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: "Yes"
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: "Both"
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: "MultiLine"
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterExternBlock: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyNamespace: false
SplitEmptyRecord: false
BreakAfterAttributes: "Never"
BreakBeforeBinaryOperators: "All"
BreakBeforeBraces: "Custom"
BreakBeforeConceptDeclarations: "Always"
BreakBeforeInlineASMColon: "OnlyMultiline"
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: "BeforeColon"
BreakInheritanceList: "BeforeColon"
BreakStringLiterals: true
CompactNamespaces: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: "Never"
EmptyLineBeforeAccessModifier: "LogicalBlock"
FixNamespaceComments: true
IncludeBlocks: "Regroup"
BasedOnStyle: "InheritParentConfig"

IncludeCategories:
# NOTE: A header is grouped by first matching regex
# Library headers. Update when adding new libraries.
Expand All @@ -86,80 +16,3 @@ IncludeCategories:
# Project headers
- Regex: "^\".+\""
Priority: 4
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: "Indent"
IndentGotoLabels: false
IndentPPDirectives: "BeforeHash"
IndentRequiresClause: false
IndentWrappedFunctionNames: false
InsertBraces: true
InsertNewlineAtEOF: true
IntegerLiteralSeparator:
Binary: 4
BinaryMinDigits: 4
Decimal: 3
DecimalMinDigits: 5
Hex: 4
HexMinDigits: 4
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: "Signature"
LineEnding: "LF"
MaxEmptyLinesToKeep: 1
NamespaceIndentation: "None"
PPIndentWidth: -1
PackConstructorInitializers: "CurrentLine"
PenaltyBreakOpenParenthesis: 25
PenaltyBreakBeforeFirstCallParameter: 25
PenaltyReturnTypeOnItsOwnLine: 100
PointerAlignment: "Left"
QualifierAlignment: "Custom"
QualifierOrder:
- "static"
- "friend"
- "inline"
# constexpr west as explained in https://www.youtube.com/watch?v=z6s6bacI424
- "constexpr"
- "type"
- "const"
- "volatile"
ReferenceAlignment: "Pointer"
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: true
RequiresClausePosition: "OwnLine"
RequiresExpressionIndentation: "OuterScope"
SeparateDefinitionBlocks: "Always"
ShortNamespaceLines: 0
SortIncludes: "CaseInsensitive"
SortUsingDeclarations: "Lexicographic"
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: "Default"
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: "ControlStatements"
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: "Custom"
SpacesInParensOptions:
InConditionalStatements: false
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: "Latest"
TabWidth: 4
UseTab: "Never"
8 changes: 7 additions & 1 deletion lint-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ tasks:

cpp-check:
sources: &cpp_source_files
- "{{.ROOT_DIR}}/.clang-format"
- "{{.ROOT_DIR}}/.clang-tidy"
- "{{.TASKFILE}}"
- ".clang-format"
- "src/**/*.cpp"
Expand Down Expand Up @@ -119,7 +121,7 @@ tasks:
requires:
vars: ["FLAGS"]
dir: "components/core"
deps: ["venv"]
deps: ["cpp-lint-configs", "venv"]
cmds:
- |-
. "{{.G_LINT_VENV_DIR}}/bin/activate"
Expand All @@ -129,6 +131,10 @@ tasks:
-print0 | \
xargs -0 clang-format {{.FLAGS}} -Werror
cpp-lint-configs:
internal: true
cmd: "{{.ROOT_DIR}}/tools/yscope-dev-utils/lint-configs/symlink-cpp-lint-configs.sh"

js:
internal: true
requires:
Expand Down
4 changes: 2 additions & 2 deletions tools/scripts/deps-download/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project_root_dir="$script_dir/../../../"
download_dep_script="$script_dir/download-dep.py"

python3 "${download_dep_script}" \
https://github.com/y-scope/yscope-dev-utils/archive/ff1611e6.zip \
yscope-dev-utils-ff1611e6f9b116da27dc7f8f71797829c22d0b1a \
https://github.com/y-scope/yscope-dev-utils/archive/2caa3dcf.zip \
yscope-dev-utils-2caa3dcfbbccff052d179e643a509d8ad05bc217 \
"${project_root_dir}/tools/yscope-dev-utils" \
--extract

0 comments on commit 3ceb17e

Please sign in to comment.