Skip to content

Commit

Permalink
Add a github action to check tidy (#93)
Browse files Browse the repository at this point in the history
* Add a tidy script and a foramt file

* This format is based on Google Style
* check-tidy came from Samsusng/escargot
* How to run: tools/check_tidy.py
  You can specify clang-format using '--clang-format'
  The clang-format being used by vscode is usually in
  ~/.vscode/extensions/ms-vscode.cpptools-{VERSION}-insiders/LLVM/bin/

Signed-off-by: Boram Bae <boram21.bae@samsung.com>

* Add an action to check tidy

Signed-off-by: Boram Bae <boram21.bae@samsung.com>

* Update tidy for all packages

Signed-off-by: Boram Bae <boram21.bae@samsung.com>

* Use config file strictly

Signed-off-by: Boram Bae <boram21.bae@samsung.com>

* Specify target directory to check tidy

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
  • Loading branch information
bbrto21 authored May 13, 2021
1 parent b305f45 commit 12de1b3
Show file tree
Hide file tree
Showing 13 changed files with 990 additions and 657 deletions.
183 changes: 183 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# This file is generated by the following command
# clang-format(v11.0.1, in vscode v1.55.0) -style=Google -dump-config > .clang-format

---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: "^<.*"
Priority: 2
SortPriority: 0
- Regex: ".*"
Priority: 3
SortPriority: 0
IncludeIsMainRegex: "([-_](test|unittest))?$"
IncludeIsMainSourceRegex: ""
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
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: ""
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
23 changes: 16 additions & 7 deletions .github/workflows/dart.yml → .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: Dart
name: Format

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request]

jobs:
analysis:
dart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -22,3 +18,16 @@ jobs:
done
- name: Verify formatting
run: flutter format --set-exit-if-changed packages
clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "2.7"
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install clang-format-11
- name: Check tidy
run: tools/check_tidy.py --dir packages
3 changes: 2 additions & 1 deletion packages/audioplayers/tizen/src/audio_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ void AudioPlayer::SetDataSource(std::vector<uint8_t> &data) {
}

void AudioPlayer::SetVolume(double volume) {
LOG_INFO("AudioPlayer %s is setting volume %f...", player_id_.c_str(), volume);
LOG_INFO("AudioPlayer %s is setting volume %f...", player_id_.c_str(),
volume);
if (volume_ != volume) {
volume_ = volume;
if (GetPlayerState() != PLAYER_STATE_NONE) {
Expand Down
2 changes: 1 addition & 1 deletion packages/audioplayers/tizen/src/audio_player_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class AudioPlayerError {
std::string message_;
};

#endif // AUDIO_PLAYER_ERROR_H_
#endif // AUDIO_PLAYER_ERROR_H_
2 changes: 1 addition & 1 deletion packages/audioplayers/tizen/src/audio_player_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

enum ReleaseMode { RELEASE, LOOP, STOP };

#endif // AUDIO_PLAYER_OPTIONS_H_
#endif // AUDIO_PLAYER_OPTIONS_H_
7 changes: 4 additions & 3 deletions packages/audioplayers/tizen/src/audioplayers_tizen_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ class AudioplayersTizenPlugin : public flutter::Plugin {
flutter::EncodableValue &release_mode_value =
encodables[flutter::EncodableValue("releaseMode")];
if (std::holds_alternative<std::string>(release_mode_value)) {
std::string release_mode = std::get<std::string>(release_mode_value);
std::string release_mode =
std::get<std::string>(release_mode_value);
if (release_mode.compare("ReleaseMode.RELEASE") == 0) {
player->SetReleaseMode(RELEASE);
} else if (release_mode.compare("ReleaseMode.LOOP") == 0) {
Expand Down Expand Up @@ -240,8 +241,8 @@ class AudioplayersTizenPlugin : public flutter::Plugin {
};

ErrorListener error_listener = [channel = channel_.get()](
const std::string &player_id,
const std::string &message) {
const std::string &player_id,
const std::string &message) {
flutter::EncodableMap wrapped = {
{flutter::EncodableValue("playerId"),
flutter::EncodableValue(player_id)},
Expand Down
Loading

0 comments on commit 12de1b3

Please sign in to comment.