Skip to content

Commit 1b46aab

Browse files
committed
refactor: Fix readability-simplify-boolean-expr
1 parent 47d05a2 commit 1b46aab

18 files changed

+21
-35
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Checks: >
5050
readability-redundant-member-init,
5151
cppcoreguidelines-init-variables,
5252
readability-static-accessed-through-instance,
53+
readability-simplify-boolean-expr,
5354
5455
CheckOptions:
5556
- key: readability-identifier-naming.ClassCase

src/core/application.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,7 @@ namespace swift::core
405405
if (CBuildConfig::isLocalDeveloperDebugBuild()) { return true; }
406406

407407
const CDistribution d(this->getOwnDistribution());
408-
if (d.isRestricted() && this->isSet(m_cmdDevelopment)) { return true; }
409-
410-
return false;
408+
return d.isRestricted() && this->isSet(m_cmdDevelopment);
411409
}
412410

413411
CStatusMessage CApplication::initLocalSettings()

src/core/context/contextsimulator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ namespace swift::core::context
5353

5454
bool IContextSimulator::isSimulatorSimulating() const
5555
{
56-
if (!isSimulatorAvailable() || !getSimulatorStatus().testFlag(ISimulator::Simulating)) { return false; }
57-
return true;
56+
return isSimulatorAvailable() && getSimulatorStatus().testFlag(ISimulator::Simulating);
5857
}
5958
} // namespace swift::core::context

src/core/fsd/servererror.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ namespace swift::core::fsd
2626
ServerErrorCode::AuthTimeout,
2727
};
2828

29-
if (fatalErrors.contains(m_errorNumber)) { return true; }
30-
else { return false; }
29+
return fatalErrors.contains(m_errorNumber);
3130
}
3231

3332
QStringList ServerError::toTokens() const

src/gui/components/atcstationcomponent.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ namespace swift::gui::components
419419

420420
bool CAtcStationComponent::canAccessContext() const
421421
{
422-
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork()) { return false; }
423-
return true;
422+
return sGui && !sGui->isShuttingDown() && sGui->getIContextNetwork();
424423
}
425424

426425
void CAtcStationComponent::clearOnlineViews()

src/gui/dockwidgetinfoarea.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ namespace swift::gui
4848
if (!this->isVisible()) { return false; }
4949

5050
// further checks
51-
if (this->isFloating())
52-
{
53-
if (this->isMinimized()) { return false; }
54-
return true;
55-
}
51+
if (this->isFloating()) { return !this->isMinimized(); }
5652
else { return isSelectedDockWidget(); }
5753
}
5854

src/gui/infoarea.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ namespace swift::gui
543543
{
544544
if (!sGui || sGui->isShuttingDown()) { return; }
545545
this->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::East);
546-
const bool init = m_tabBar ? false : true;
546+
const bool init = m_tabBar == nullptr;
547547

548548
for (int i = 0; i < m_dockWidgetInfoAreas.size(); i++)
549549
{

src/gui/managedstatusbar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace swift::gui
4040
void CManagedStatusBar::initStatusBar(QStatusBar *statusBar)
4141
{
4242
if (m_statusBar) { return; }
43-
m_ownedStatusBar = statusBar ? false : true;
43+
m_ownedStatusBar = statusBar == nullptr;
4444
m_statusBar = statusBar ? statusBar : new QStatusBar();
4545
if (m_statusBar->objectName().isEmpty()) { m_statusBar->setObjectName("sb_ManagedStatusBar"); }
4646

src/gui/models/airlineicaofilter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ namespace swift::gui::models
1414
: m_id(id), m_vDesignator(vDesignator.trimmed().toUpper()), m_name(name.trimmed()),
1515
m_countryIso(countryIso.trimmed().toUpper()), m_real(isReal), m_va(isVa)
1616
{
17-
this->m_valid = !(m_id < 0 && this->m_countryIso.isEmpty() && this->m_vDesignator.isEmpty() &&
18-
this->m_name.isEmpty() && !this->m_va && !this->m_real);
17+
this->m_valid = m_id >= 0 || !this->m_countryIso.isEmpty() || !this->m_vDesignator.isEmpty() ||
18+
!this->m_name.isEmpty() || this->m_va || this->m_real;
1919
}
2020

2121
CAirlineIcaoCodeList CAirlineIcaoFilter::filter(const CAirlineIcaoCodeList &inContainer) const

src/gui/models/listmodelbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace swift::gui::models
112112
bool CListModelBase<T, UseCompare>::setData(const QModelIndex &index, const QVariant &value, int role)
113113
{
114114
auto dataRole = static_cast<Qt::ItemDataRole>(role);
115-
if (!(dataRole == Qt::UserRole || dataRole == Qt::EditRole)) { return false; }
115+
if (dataRole != Qt::UserRole && dataRole != Qt::EditRole) { return false; }
116116

117117
// check / init
118118
if (!this->isValidIndex(index)) { return false; }

0 commit comments

Comments
 (0)