style: Add braces to all control flow statements (#6887)

* style: Add braces to all control flow statements

  Standardize code style by adding explicit braces to all single-statement
  control flow blocks (if, else, for, while) across the entire codebase.

  Also documents the InsertBraces clang-format option (requires v15+) for
  future automated enforcement.

* InsertBraces-check-enabled
This commit is contained in:
DawnFire42 2026-05-16 13:19:53 -04:00 committed by GitHub
parent 7153f7d4c1
commit aadee34238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
173 changed files with 2725 additions and 1461 deletions

View file

@ -69,19 +69,22 @@ void testRNG()
for (int i = 0; i <= maxMax - min; ++i) {
std::cerr << (min + i);
for (auto &number : numbers) {
if (i < number.size())
if (i < number.size()) {
std::cerr << "\t" << number[i];
else
} else {
std::cerr << "\t";
}
}
std::cerr << std::endl;
}
std::cerr << std::endl << "Chi^2 =";
for (double j : chisq)
for (double j : chisq) {
std::cerr << "\t" << QString::number(j, 'f', 3).toStdString();
}
std::cerr << std::endl << "k =";
for (int j = 0; j < chisq.size(); ++j)
for (int j = 0; j < chisq.size(); ++j) {
std::cerr << "\t" << (j - min + minMax);
}
std::cerr << std::endl << std::endl;
}
@ -90,8 +93,9 @@ void testHash()
const int n = 5000;
std::cerr << "Benchmarking password hash function (n =" << n << ")..." << std::endl;
QDateTime startTime = QDateTime::currentDateTime();
for (int i = 0; i < n; ++i)
for (int i = 0; i < n; ++i) {
PasswordHasher::computeHash("aaaaaa", "aaaaaaaaaaaaaaaa");
}
QDateTime endTime = QDateTime::currentDateTime();
std::cerr << startTime.secsTo(endTime) << "secs" << std::endl;
}
@ -157,10 +161,11 @@ int main(int argc, char *argv[])
QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection,
Q_ARG(QString, settingsCache->value("server/logfile", QString("server.log")).toString()));
if (logToConsole)
if (logToConsole) {
qInstallMessageHandler(myMessageOutput);
else
} else {
qInstallMessageHandler(myMessageOutput2);
}
signalhandler = new SignalHandler();