Skip to content

Commit

Permalink
analyzers fixed Clang Tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Apr 11, 2024
1 parent e69b188 commit 69ca87c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 34 deletions.
10 changes: 5 additions & 5 deletions src/orm/concerns/managestransactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, Commit, ("COMMIT")) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, RollBack, ("ROLLBACK")) // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
#ifdef TINYORM_USING_QTSQLDRIVERS
/*! QString constant for the "ManagesTransactions::beginTransaction" function name. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, BeginTransactionFunction, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, BeginTransactionFunction, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
("ManagesTransactions::beginTransaction"))
/*! QString constant for the "ManagesTransactions::commit" function name. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CommitFunction, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CommitFunction, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
("ManagesTransactions::commit"))
/*! QString constant for the "ManagesTransactions::rollBack" function name. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, RollBackFunction, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, RollBackFunction, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
("ManagesTransactions::rollBack"))
/*! QString constant for the "ManagesTransactions::savepoint" function name. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SavepointFunction, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SavepointFunction, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
("ManagesTransactions::savepoint"))
/*! QString constant for the "ManagesTransactions::rollbackToSavepoint" function name. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, RollbackToSavepointFunction, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, RollbackToSavepointFunction, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
("ManagesTransactions::rollbackToSavepoint"))
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/orm/utils/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace
void setCurrentThreadName(const char *name)
{
# if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
prctl(PR_SET_NAME, reinterpret_cast<quint64>(name), 0, 0, 0);
prctl(PR_SET_NAME, reinterpret_cast<quint64>(name), 0, 0, 0); // NOLINT(cppcoreguidelines-pro-type-vararg, cppcoreguidelines-pro-type-reinterpret-cast)
# elif defined(Q_OS_MAC)
pthread_setname_np(name);
# elif defined(Q_OS_QNX)
Expand Down
8 changes: 4 additions & 4 deletions tests/TinyUtils/src/databases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ using Orm::Constants::PUBLIC;
using Orm::Constants::QMYSQL;
using Orm::Constants::QPSQL;
using Orm::Constants::QSQLITE;
using Orm::Constants::SEMICOLON;
using Orm::Constants::SSL_CA;
using Orm::Constants::SSL_CERT;
using Orm::Constants::SSL_KEY;
using Orm::Constants::ROOT;
using Orm::Constants::TZ00;
using Orm::Constants::UTC;
Expand Down Expand Up @@ -62,6 +58,10 @@ using Orm::Constants::username_;

#ifdef TINYORM_USING_TINYDRIVERS
using Orm::Constants::EQ_C;
using Orm::Constants::SEMICOLON;
using Orm::Constants::SSL_CA;
using Orm::Constants::SSL_CERT;
using Orm::Constants::SSL_KEY;
using Orm::Constants::SSL_MODE;
#endif

Expand Down
14 changes: 0 additions & 14 deletions tests/auto/functional/orm/databasemanager/tst_databasemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,28 @@
#include "databases.hpp"

using Orm::Constants::EMPTY;
using Orm::Constants::H127001;
using Orm::Constants::NAME;
using Orm::Constants::NOSPACE;
using Orm::Constants::P5432;
using Orm::Constants::PUBLIC;
using Orm::Constants::QMYSQL;
using Orm::Constants::QPSQL;
using Orm::Constants::QSQLITE;
using Orm::Constants::SSL_CA;
using Orm::Constants::SSL_CERT;
using Orm::Constants::SSL_KEY;
using Orm::Constants::SSL_MODE;
using Orm::Constants::UTF8;
using Orm::Constants::UTF8MB4;
using Orm::Constants::UTF8MB40900aici;
using Orm::Constants::VerifyCA;
using Orm::Constants::Version;
using Orm::Constants::application_name;
using Orm::Constants::charset_;
using Orm::Constants::check_database_exists;
using Orm::Constants::collation_;
using Orm::Constants::database_;
using Orm::Constants::dont_drop;
using Orm::Constants::driver_;
using Orm::Constants::host_;
using Orm::Constants::in_memory;
using Orm::Constants::options_;
using Orm::Constants::password_;
using Orm::Constants::port_;
using Orm::Constants::postgres_;
using Orm::Constants::prefix_;
using Orm::Constants::prefix_indexes;
using Orm::Constants::qt_timezone;
using Orm::Constants::return_qdatetime;
using Orm::Constants::search_path;
using Orm::Constants::spatial_ref_sys;
using Orm::Constants::ssl_ca;
using Orm::Constants::ssl_cert;
Expand All @@ -53,7 +40,6 @@ using Orm::Constants::sslcert;
using Orm::Constants::sslkey;
using Orm::Constants::sslmode_;
using Orm::Constants::sslrootcert;
using Orm::Constants::username_;
using Orm::Constants::verify_full;

using Orm::DatabaseManager;
Expand Down
13 changes: 8 additions & 5 deletions tom/src/tom/commands/completecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,34 @@ namespace fs = std::filesystem;

using Orm::Constants::COMMA_C;
using Orm::Constants::DASH;
using Orm::Constants::EMPTY;
using Orm::Constants::EQ_C;
using Orm::Constants::NEWLINE;
using Orm::Constants::NOSPACE;
using Orm::Constants::SPACE;

#ifdef _MSC_VER
using Orm::Constants::EMPTY;
using Orm::Constants::NOSPACE;
using Orm::Constants::database_;
#endif

using StringUtils = Orm::Utils::String;

using Tom::Constants::About;
using Tom::Constants::DoubleDash;
using Tom::Constants::Env;
using Tom::Constants::Help;
using Tom::Constants::Integrate;
using Tom::Constants::List;
using Tom::Constants::LongOption;
using Tom::Constants::ShPwsh;
using Tom::Constants::commandline;
using Tom::Constants::commandline_up;
using Tom::Constants::only_;
using Tom::Constants::word_;
using Tom::Constants::word_up;

#ifdef _MSC_VER
using Tom::Constants::About;
using Tom::Constants::Env;
using Tom::Constants::LongOptionValue;
using Tom::Constants::only_;
using Tom::Constants::position_;
using Tom::Constants::position_up;
#else
Expand Down
8 changes: 4 additions & 4 deletions tom/src/tom/commands/integratecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ int IntegrateCommand::integrateBash() const
}

/*! Bash completions directory path. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, BashCompletionsDirPath, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, BashCompletionsDirPath, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
("/usr/share/bash-completion/completions"))

/*! Path to the TinyORM tom bash completion file. */
Q_GLOBAL_STATIC_WITH_ARGS(const QString, TomBashCompletionFilepath, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QString, TomBashCompletionFilepath, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
(QString("%1/tom").arg(*BashCompletionsDirPath)))

void IntegrateCommand::throwIfBashCompletionDirNotExists()
Expand Down Expand Up @@ -362,7 +362,7 @@ int IntegrateCommand::integrateZsh() const
}

/*! Zsh completions directory path. */
Q_GLOBAL_STATIC_WITH_ARGS(const QStringList, ZshCompletionsDirPaths, // NOLINT(misc-use-anonymous-namespace)
Q_GLOBAL_STATIC_WITH_ARGS(const QStringList, ZshCompletionsDirPaths, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
({"/usr/local/share/zsh/site-functions",
"/usr/share/zsh/site-functions"}))

Expand All @@ -377,7 +377,7 @@ struct ZshCompletionPathsItem

/*! Paths to the TinyORM tom zsh completion files. */
Q_GLOBAL_STATIC_WITH_ARGS(
QVector<ZshCompletionPathsItem>, TomZshCompletionPaths, // NOLINT(misc-use-anonymous-namespace)
QVector<ZshCompletionPathsItem>, TomZshCompletionPaths, // NOLINT(misc-use-anonymous-namespace, cppcoreguidelines-avoid-non-const-global-variables)
({{ZshCompletionsDirPaths->constFirst(),
QString("%1/_tom").arg(ZshCompletionsDirPaths->constFirst())},
{ZshCompletionsDirPaths->at(1),
Expand Down
2 changes: 1 addition & 1 deletion tom/src/tom/terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Terminal::TerminalSize Terminal::terminalSize() noexcept
height = (csbi.srWindow.Bottom - csbi.srWindow.Top) + 1;
#elif defined(__linux__)
winsize w {};
ioctl(fileno(stdout), TIOCGWINSZ, &w);
ioctl(fileno(stdout), TIOCGWINSZ, &w); // NOLINT(cppcoreguidelines-pro-type-vararg)

width = w.ws_col;
height = w.ws_row;
Expand Down

0 comments on commit 69ca87c

Please sign in to comment.