Add readability-simplify-boolean-expr

* Add readability-simplify-boolean-expr
* Fixes based on review
This commit is contained in:
Magne Sjaastad
2023-06-26 13:12:41 +02:00
committed by GitHub
parent 34d83efaed
commit 59ca0b943c
116 changed files with 179 additions and 635 deletions
@@ -784,12 +784,7 @@ bool RiaApplication::saveProjectAs( const QString& fileName, gsl::not_null<QStri
//--------------------------------------------------------------------------------------------------
bool RiaApplication::hasValidProjectFileExtension( const QString& fileName )
{
if ( fileName.contains( ".rsp", Qt::CaseInsensitive ) || fileName.contains( ".rip", Qt::CaseInsensitive ) )
{
return true;
}
return false;
return fileName.contains( ".rsp", Qt::CaseInsensitive ) || fileName.contains( ".rip", Qt::CaseInsensitive );
}
//--------------------------------------------------------------------------------------------------
@@ -335,12 +335,9 @@ QString RiaDefines::defaultDirectoryLabel( RiaDefines::ImportFileType fileType )
//--------------------------------------------------------------------------------------------------
bool RiaDefines::isInjector( WellProductionType wellProductionType )
{
if ( wellProductionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::WATER_INJECTOR )
return true;
return false;
return wellProductionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::WATER_INJECTOR;
}
//--------------------------------------------------------------------------------------------------
@@ -113,10 +113,5 @@ bool RiaEclipseFileNameTools::hasMatchingSuffix( const QString& fileName, Eclips
QString suffix = fi.completeSuffix();
if ( suffix.compare( caf::AppEnum<EclipseFileType>::text( fileType ), Qt::CaseInsensitive ) == 0 )
{
return true;
}
return false;
return suffix.compare( caf::AppEnum<EclipseFileType>::text( fileType ), Qt::CaseInsensitive ) == 0;
}
@@ -146,9 +146,5 @@ bool RiaArgumentParser::parseArguments( cvf::ProgramOptions* progOpt )
// If positional parameter functionality is to be supported, the test for existence of positionalParameters must be
// removed This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162
if ( !parseOk || !progOpt->positionalParameters().empty() )
{
return false;
}
return true;
return parseOk && progOpt->positionalParameters().empty();
}
@@ -36,12 +36,7 @@
//--------------------------------------------------------------------------------------------------
bool RiaColorTools::isBrightnessAboveThreshold( cvf::Color3f backgroundColor )
{
if ( relativeLuminance( backgroundColor ) > 0.4 )
{
return true;
}
return false;
return relativeLuminance( backgroundColor ) > 0.4;
}
//--------------------------------------------------------------------------------------------------
@@ -163,10 +163,7 @@ std::string RiaStdStringTools::toUpper( const std::string& s )
//--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::endsWith( const std::string& mainStr, const std::string& toMatch )
{
if ( mainStr.size() >= toMatch.size() && mainStr.compare( mainStr.size() - toMatch.size(), toMatch.size(), toMatch ) == 0 )
return true;
else
return false;
return mainStr.size() >= toMatch.size() && mainStr.compare( mainStr.size() - toMatch.size(), toMatch.size(), toMatch ) == 0;
}
//--------------------------------------------------------------------------------------------------
@@ -32,12 +32,7 @@ bool RiaTextStringTools::compare( const QString& expected, const QString& actual
// 2. report line numbers for all changes
// 3. add support for compare with content of a text file on disk
if ( expected.compare( actual ) == 0 )
{
return true;
}
return false;
return expected.compare( actual ) == 0;
}
//--------------------------------------------------------------------------------------------------
@@ -198,12 +198,7 @@ void calculateNewStepsFromJacobi( double dR1_dq1,
//--------------------------------------------------------------------------------------------------
bool isZeroCrossing( double newError, double oldError, double maxError )
{
if ( ( newError < -maxError && maxError < oldError ) || ( newError > maxError && -maxError > oldError ) )
{
return true;
}
return false;
return ( newError < -maxError && maxError < oldError ) || ( newError > maxError && -maxError > oldError );
}
//--------------------------------------------------------------------------------------------------