-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from SiliconLabs/add-coding-convention-check-w…
…orkflow Add coding convention check workflow
- Loading branch information
Showing
8 changed files
with
194 additions
and
141 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,49 @@ | ||
|
||
name: Coding Convention | ||
on: | ||
push: | ||
branches: | ||
- '*' # matches every branch that doesn't contain a '/' | ||
- '*/*' # matches every branch containing a single '/' | ||
- '**' # matches every branch | ||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
REPO_LINK: https://github.com/${{ github.repository }}.git | ||
jobs: | ||
job1: | ||
name: Check coding convention | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
ref: update-source-code-lib-iec60730 | ||
- name: Install python3.11 | ||
if: always() | ||
run: | | ||
sudo apt update | ||
sudo apt upgrade | ||
sudo add-apt-repository ppa:deadsnakes/ppa -y | ||
sudo apt update | ||
sudo apt install python3.11 | ||
python3.11 --version | ||
which python3.11 | ||
sudo apt install python3.11-full | ||
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.11 | ||
- name: Install Pre-commmit | ||
run: | | ||
python3.11 -m pip install pre-commit | ||
sudo apt install uncrustify clang-tidy cppcheck | ||
- name: Run test | ||
run: | | ||
pre-commit install | ||
pre-commit run --all-files > CodingConventionTool.txt | ||
- name: Upload Result | ||
if: always() | ||
uses: actions/[email protected] | ||
with: | ||
name: CodingConventionResult | ||
path: CodingConventionTool.txt | ||
warn: Output a warning but do not fail the action | ||
retention-days: 90 |
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,76 +1,76 @@ | ||
--- | ||
BasedOnStyle: LLVM | ||
IndentWidth: 2 | ||
TabWidth: 2 | ||
UseTab: Never | ||
|
||
|
||
# General formatting | ||
AccessModifierOffset: -2 | ||
MaxEmptyLinesToKeep: 1 | ||
# BreakBeforeBraces: Allman | ||
|
||
# Line length | ||
ColumnLimit: 80 | ||
|
||
# Bracing style | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: true | ||
AfterControlStatement: Never | ||
AfterFunction: true | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
|
||
# Use of spaces | ||
SpacesBeforeTrailingComments: 1 | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
|
||
# Use of comments | ||
CommentPragmas: "^ IWYU pragma:" | ||
|
||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveMacros: true | ||
AlignEscapedNewlines: Right | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: false | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: No | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeTernaryOperators: true | ||
BreakStringLiterals: true | ||
Cpp11BracedListStyle: true | ||
IncludeBlocks: Regroup | ||
IndentCaseLabels: true | ||
IndentGotoLabels: false | ||
IndentPPDirectives: None | ||
IndentWrappedFunctionNames: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
PointerAlignment: Right | ||
ReflowComments: false | ||
SortIncludes: false | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterLogicalNot: false | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: false | ||
--- | ||
BasedOnStyle: LLVM | ||
IndentWidth: 2 | ||
TabWidth: 2 | ||
UseTab: Never | ||
|
||
|
||
# General formatting | ||
AccessModifierOffset: -2 | ||
MaxEmptyLinesToKeep: 1 | ||
# BreakBeforeBraces: Allman | ||
|
||
# Line length | ||
ColumnLimit: 80 | ||
|
||
# Bracing style | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: true | ||
AfterControlStatement: Never | ||
AfterFunction: true | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
|
||
# Use of spaces | ||
SpacesBeforeTrailingComments: 1 | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
|
||
# Use of comments | ||
CommentPragmas: "^ IWYU pragma:" | ||
|
||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveMacros: true | ||
AlignEscapedNewlines: Right | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: false | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: No | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeTernaryOperators: true | ||
BreakStringLiterals: true | ||
Cpp11BracedListStyle: true | ||
IncludeBlocks: Regroup | ||
IndentCaseLabels: true | ||
IndentGotoLabels: false | ||
IndentPPDirectives: None | ||
IndentWrappedFunctionNames: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
PointerAlignment: Right | ||
ReflowComments: false | ||
SortIncludes: false | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterLogicalNot: false | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: false |
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,50 +1,50 @@ | ||
Checks: > | ||
-*, | ||
readability-identifier-naming, | ||
readability-magic-numbers, | ||
readability-braces-around-statements | ||
WarningsAsErrors: > | ||
readability-identifier-naming, | ||
readability-magic-numbers, | ||
readability-braces-around-statements | ||
HeaderFilterRegex: '' | ||
FormatStyle: none | ||
InheritParentConfig: true | ||
User: user | ||
CheckOptions: | ||
- key: readability-identifier-naming.VariableCase | ||
value: lower_case | ||
- key: readability-identifier-naming.GlobalConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.GlobalConstantPrefix | ||
value: SL_ | ||
- key: readability-identifier-naming.ConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.ConstantPrefix | ||
value: SL_ | ||
- key: readability-identifier-naming.EnumConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.EnumConstantPrefix | ||
value: SL_ | ||
- key: readability-identifier-naming.EnumCase | ||
value: lower_case | ||
- key: readability-identifier-naming.EnumPrefix | ||
value: sl_ | ||
- key: readability-identifier-naming.FunctionIgnoredRegexp | ||
value: 'sli_.*' | ||
- key: readability-identifier-naming.FunctionCase | ||
value: lower_case | ||
- key: readability-identifier-naming.FunctionPrefix | ||
value: 'sl_' | ||
- key: readability-identifier-naming.StructCase | ||
value: lower_case | ||
- key: readability-identifier-naming.StructPrefix | ||
value: 'sl_' | ||
- key: readability-identifier-naming.StructMemberCase | ||
value: lower_case | ||
- key: readability-identifier-naming.TypedefCase | ||
value: lower_case | ||
- key: readability-identifier-naming.TypedefPrefix | ||
value: 'sl_' | ||
Checks: > | ||
-*, | ||
readability-identifier-naming, | ||
readability-magic-numbers, | ||
readability-braces-around-statements | ||
WarningsAsErrors: > | ||
readability-identifier-naming, | ||
readability-magic-numbers, | ||
readability-braces-around-statements | ||
HeaderFilterRegex: '' | ||
FormatStyle: none | ||
InheritParentConfig: true | ||
User: user | ||
CheckOptions: | ||
- key: readability-identifier-naming.VariableCase | ||
value: lower_case | ||
- key: readability-identifier-naming.GlobalConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.GlobalConstantPrefix | ||
value: SL_ | ||
- key: readability-identifier-naming.ConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.ConstantPrefix | ||
value: SL_ | ||
- key: readability-identifier-naming.EnumConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.EnumConstantPrefix | ||
value: SL_ | ||
- key: readability-identifier-naming.EnumCase | ||
value: lower_case | ||
- key: readability-identifier-naming.EnumPrefix | ||
value: sl_ | ||
- key: readability-identifier-naming.FunctionIgnoredRegexp | ||
value: 'sli_.*' | ||
- key: readability-identifier-naming.FunctionCase | ||
value: lower_case | ||
- key: readability-identifier-naming.FunctionPrefix | ||
value: 'sl_' | ||
- key: readability-identifier-naming.StructCase | ||
value: lower_case | ||
- key: readability-identifier-naming.StructPrefix | ||
value: 'sl_' | ||
- key: readability-identifier-naming.StructMemberCase | ||
value: lower_case | ||
- key: readability-identifier-naming.TypedefCase | ||
value: lower_case | ||
- key: readability-identifier-naming.TypedefPrefix | ||
value: 'sl_' |
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,10 +1,10 @@ | ||
# See: https://github.com/codespell-project/codespell#using-a-config-file | ||
[codespell] | ||
# In the event of a false positive, add the problematic word, in all lowercase, to 'ignore-words.txt' (one word per line). | ||
# Or copy & paste the whole problematic line to 'exclude-file.txt' | ||
ignore-words = ./tools/.codespell/ignore-words.txt | ||
exclude-file = ./tools/.codespell/exclude-file.txt | ||
check-filenames = | ||
check-hidden = | ||
count = | ||
skip = .git,*.a, | ||
# See: https://github.com/codespell-project/codespell#using-a-config-file | ||
[codespell] | ||
# In the event of a false positive, add the problematic word, in all lowercase, to 'ignore-words.txt' (one word per line). | ||
# Or copy & paste the whole problematic line to 'exclude-file.txt' | ||
ignore-words = ./tools/.codespell/ignore-words.txt | ||
exclude-file = ./tools/.codespell/exclude-file.txt | ||
check-filenames = | ||
check-hidden = | ||
count = | ||
skip = .git,*.a, |
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 @@ | ||
|
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,2 @@ | ||
tools/** | ||
.github/** |
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,5 +1,5 @@ | ||
teh | ||
foobar | ||
pris | ||
bu | ||
dout | ||
teh | ||
foobar | ||
pris | ||
bu | ||
dout |
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 @@ | ||
|