clang-tidy: Enable readability-simplify-boolean-expr check
This check looks for boolean expressions involving boolean
constants and simplifies them to use the appropriate boolean
expression directly.
Change-Id: I79d7e4486bd0ea5f5b9b5a1644af99384e41e251
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index 24f78f0..1dec9a7 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -247,6 +247,7 @@
readability-redundant-member-init,
readability-redundant-preprocessor,
readability-redundant-smartptr-get,
+readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
diff --git a/activation.cpp b/activation.cpp
index 8f4c4c0..cd44cc0 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -206,7 +206,7 @@
// can be re-programmed.
parent.createUpdateableAssociation(path);
- if (Activation::checkApplyTimeImmediate() == true)
+ if (Activation::checkApplyTimeImmediate())
{
info("Image Active and ApplyTime is immediate; rebooting BMC.");
Activation::rebootBmc();
diff --git a/image_verify.cpp b/image_verify.cpp
index 4d874b4..12e938e 100644
--- a/image_verify.cpp
+++ b/image_verify.cpp
@@ -147,7 +147,7 @@
bool valid;
// Verify the MANIFEST and publickey file using available
// public keys and hash on the system.
- if (false == systemLevelVerify())
+ if (!systemLevelVerify())
{
error("System level Signature Validation failed");
return false;
@@ -211,7 +211,7 @@
}
}
- if (verifyFullImage() == false)
+ if (!verifyFullImage())
{
error("Image full file Signature Validation failed");
return false;
@@ -436,7 +436,7 @@
// Verify the signature.
valid = verifyFile(file, sigFile, publicKeyPath, hashType);
- if (valid == false)
+ if (!valid)
{
error("Image file Signature Validation failed on {PATH}", "PATH",
bmcImage);
diff --git a/msl_verify.cpp b/msl_verify.cpp
index cf05ea3..d578281 100644
--- a/msl_verify.cpp
+++ b/msl_verify.cpp
@@ -120,11 +120,7 @@
{
std::string msl = getMinimumVersion();
std::string mslRegex{REGEX_BMC_MSL};
- if (!msl.empty() && !mslRegex.empty())
- {
- return true;
- }
- return false;
+ return !msl.empty() && !mslRegex.empty();
}
std::string minimum_ship_level::getMinimumVersion()