Skip to content

Commit

Permalink
Fix clang-tidy not running and fix clang-tidy findings
Browse files Browse the repository at this point in the history
  • Loading branch information
evan1026 committed Oct 11, 2022
1 parent 6d58f05 commit a28f21f
Showing 7 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Checks: '-*,bugprone-*,cert-dcl21-cpp,cert-dcl50-cpp,cert-env33-c,cert-err34-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cppcoreguidelines-*,google-build-using-namespace,google-explicit-constructor,google-global-names-in-headers,google-readability-casting,google-runtime-int,google-runtime-operator,hicpp-*,misc-*,modernize-*,performance-*,readability-*,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-hicpp-special-member-functions,-hicpp-use-override,-readability-identifier-length'
Checks: '-*,bugprone-*,cert-dcl21-cpp,cert-dcl50-cpp,cert-env33-c,cert-err34-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cppcoreguidelines-*,google-build-using-namespace,google-explicit-constructor,google-global-names-in-headers,google-readability-casting,google-runtime-int,google-runtime-operator,hicpp-*,misc-*,modernize-*,performance-*,readability-*,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-hicpp-special-member-functions,-hicpp-use-override,-readability-identifier-length,-bugprone-easily-swappable-parameters'
CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: 1
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -159,7 +159,7 @@ if(NOT HAS_PARENT)
add_definitions(-DDEBUG_PRINTF)

set_target_properties(
${EXECUTABLE_NAME}
blink1
PROPERTIES
CXX_CLANG_TIDY "clang-tidy"
)
2 changes: 1 addition & 1 deletion src/PatternLine.cpp
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ namespace blink1_lib {
}

std::ostream& operator<<(std::ostream& os, const PatternLine& patternLine) {
os << "PatternLine{rgb=" << patternLine.rgb << ", fadeMillis=" << unsigned(patternLine.fadeMillis) << "}";
os << "PatternLine{rgb=" << patternLine.rgb << ", fadeMillis=" << static_cast<unsigned>(patternLine.fadeMillis) << "}";
return os;
}
}
2 changes: 1 addition & 1 deletion src/PatternLineN.cpp
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ namespace blink1_lib {
}

std::ostream& operator<<(std::ostream& os, const PatternLineN& patternLine) {
os << "PatternLine{rgbn=" << patternLine.rgbn << ", fadeMillis=" << unsigned(patternLine.fadeMillis) << "}";
os << "PatternLine{rgbn=" << patternLine.rgbn << ", fadeMillis=" << static_cast<unsigned>(patternLine.fadeMillis) << "}";
return os;
}
}
8 changes: 4 additions & 4 deletions src/PlayState.cpp
Original file line number Diff line number Diff line change
@@ -20,10 +20,10 @@ namespace blink1_lib {
std::ostream& operator<<(std::ostream& os, const PlayState& playState) {
os << "PlayState{"
<< "playing=" << (playState.playing ? "true" : "false")
<< ", playStart=" << unsigned(playState.playStart)
<< ", playEnd=" << unsigned(playState.playEnd)
<< ", playCount=" << unsigned(playState.playCount)
<< ", playPos=" << unsigned(playState.playPos)
<< ", playStart=" << static_cast<unsigned>(playState.playStart)
<< ", playEnd=" << static_cast<unsigned>(playState.playEnd)
<< ", playCount=" << static_cast<unsigned>(playState.playCount)
<< ", playPos=" << static_cast<unsigned>(playState.playPos)
<< "}";
return os;
}
4 changes: 3 additions & 1 deletion src/RGB.cpp
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@ namespace blink1_lib {
}

std::ostream& operator<<(std::ostream& os, const RGB& rgb) {
os << "RGB{r=" << unsigned(rgb.r) << ", g=" << unsigned(rgb.g) << ", b=" << unsigned(rgb.b) << "}";
os << "RGB{r=" << static_cast<unsigned>(rgb.r)
<< ", g=" << static_cast<unsigned>(rgb.g)
<< ", b=" << static_cast<unsigned>(rgb.b) << "}";
return os;
}
}
5 changes: 4 additions & 1 deletion src/RGBN.cpp
Original file line number Diff line number Diff line change
@@ -13,7 +13,10 @@ namespace blink1_lib {
}

std::ostream& operator<<(std::ostream& os, const RGBN& rgb) {
os << "RGBN{r=" << unsigned(rgb.r) << ", g=" << unsigned(rgb.g) << ", b=" << unsigned(rgb.b) << ", n=" << unsigned(rgb.n) << "}";
os << "RGBN{r=" << static_cast<unsigned>(rgb.r)
<< ", g=" << static_cast<unsigned>(rgb.g)
<< ", b=" << static_cast<unsigned>(rgb.b)
<< ", n=" << static_cast<unsigned>(rgb.n) << "}";
return os;
}
}

0 comments on commit a28f21f

Please sign in to comment.