Чистка кода

This commit is contained in:
Andrei Astafev 2020-03-30 14:13:27 +03:00
parent 44466b80de
commit 8f7a08bea6
6 changed files with 17 additions and 10 deletions

View File

@ -1,5 +1,5 @@
--- ---
Checks: '-*,bugprone-*,cppcoreguidelines-*,google-*,clang-analyzer-*,misc-*,modernize-*,readability-*,performance-*,portability-*,readability-identifier-naming,-cppcoreguidelines-owning-memory' Checks: '-*,bugprone-*,cppcoreguidelines-*,google-*,clang-analyzer-*,misc-*,modernize-*,readability-*,performance-*,portability-*,readability-identifier-naming,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type'
CheckOptions: CheckOptions:
- key: readability-identifier-naming.AbstractClassCase - key: readability-identifier-naming.AbstractClassCase
value: CamelCase value: CamelCase

View File

@ -59,12 +59,11 @@ void Paths::setLogDirectory( const QString& logDirectory )
} }
Paths::Paths( const QString& configFileExtension ) : Paths::Paths( QString configFileExtension ) :
m_configFileExtension( configFileExtension ) m_prefixDirectory ( "/opt/" + QCoreApplication::organizationName().toLower() +
"/" + QCoreApplication::applicationName().toLower() ),
m_configFileExtension( std::move( configFileExtension ) )
{ {
m_prefixDirectory = "/opt/" + QCoreApplication::organizationName().toLower() +
"/" + QCoreApplication::applicationName().toLower();
auto pd = m_prefixDirectory.absolutePath(); auto pd = m_prefixDirectory.absolutePath();
m_binaryDirectory = pd + "/bin"; m_binaryDirectory = pd + "/bin";
m_configDirectory = pd + "/etc"; m_configDirectory = pd + "/etc";

View File

@ -49,7 +49,7 @@ public:
* @brief Конструктор * @brief Конструктор
* @param configFileExtension Расширение для файла настройки * @param configFileExtension Расширение для файла настройки
*/ */
Paths( const QString& configFileExtension = "conf" ); Paths( QString configFileExtension = "conf" );
/** /**
* @brief Получение пути к базовому каталогу * @brief Получение пути к базовому каталогу
*/ */

View File

@ -14,6 +14,7 @@ bool almost_equal_ulps( const float a, const float b,
float_cmp_t uB( b ); float_cmp_t uB( b );
// Если знаки разные, то числа не равны. // Если знаки разные, то числа не равны.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
if ( uA.negative() != uB.negative() ) if ( uA.negative() != uB.negative() )
{ {
// Кроме случая, когда +0==-0 // Кроме случая, когда +0==-0
@ -32,6 +33,7 @@ bool almost_equal_ulps( const float a, const float b,
} }
// Разница в младших битах. // Разница в младших битах.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
auto ulpsDiff = std::abs( uA.i - uB.i ); auto ulpsDiff = std::abs( uA.i - uB.i );
if ( ulpsDiff <= maxUlpsDiff ) if ( ulpsDiff <= maxUlpsDiff )
{ {
@ -48,6 +50,7 @@ bool almost_equal_ulps( const double a, const double b,
double_cmp_t uB( b ); double_cmp_t uB( b );
// Если знаки разные, то числа не равны. // Если знаки разные, то числа не равны.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
if ( uA.negative() != uB.negative() ) if ( uA.negative() != uB.negative() )
{ {
// Кроме случая, когда +0==-0 // Кроме случая, когда +0==-0
@ -66,6 +69,7 @@ bool almost_equal_ulps( const double a, const double b,
} }
// Разница в младших битах. // Разница в младших битах.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
auto ulpsDiff = std::abs( uA.i - uB.i ); auto ulpsDiff = std::abs( uA.i - uB.i );
if ( ulpsDiff <= maxUlpsDiff ) if ( ulpsDiff <= maxUlpsDiff )
{ {

View File

@ -22,12 +22,14 @@ bool almost_equal_ulps_and_abs( const float a, const float b,
float_cmp_t uB( b ); float_cmp_t uB( b );
// Different signs means they do not match. // Different signs means they do not match.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
if ( uA.negative() != uB.negative() ) if ( uA.negative() != uB.negative() )
{ {
return( false ); return( false );
} }
// Find the difference in ULPs. // Find the difference in ULPs.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
int ulpsDiff = std::abs( uA.i - uB.i ); int ulpsDiff = std::abs( uA.i - uB.i );
if ( ulpsDiff <= maxUlpsDiff ) if ( ulpsDiff <= maxUlpsDiff )
{ {
@ -53,12 +55,14 @@ bool almost_equal_ulps_and_abs( const double a, const double b,
double_cmp_t uB( b ); double_cmp_t uB( b );
// Different signs means they do not match. // Different signs means they do not match.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
if ( uA.negative() != uB.negative() ) if ( uA.negative() != uB.negative() )
{ {
return( false ); return( false );
} }
// Find the difference in ULPs. // Find the difference in ULPs.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
auto ulpsDiff = std::abs( uA.i - uB.i ); auto ulpsDiff = std::abs( uA.i - uB.i );
if ( ulpsDiff <= maxUlpsDiff ) if ( ulpsDiff <= maxUlpsDiff )
{ {

View File

@ -13,8 +13,8 @@ void append_translators( QTranslatorsList& translators, const QString& appName )
{ {
auto* translator = new QTranslator( qApp ); auto* translator = new QTranslator( qApp );
if ( translator->load( QLocale(), appName, QStringLiteral( "_" ), if ( translator->load( QLocale(),
QStringLiteral( ":/qm" ) ) ) appName, QStringLiteral( "_" ), QStringLiteral( ":/qm" ) ) )
{ {
translators.append( translator ); translators.append( translator );
} }
@ -50,7 +50,7 @@ void append_translators( QTranslatorsList& translators, const QString& appName )
{ {
qApp->installTranslator( i ); qApp->installTranslator( i );
} }
} // install_translators } // append_translators
} // namespace qt } // namespace qt