Keep clang-tidy happy
This commit is contained in:
parent
c000a6164c
commit
38f6b5ea71
@ -1,4 +1,4 @@
|
||||
Checks: 'modernize-*,modernize-use-override,google-*,-google-runtime-references,misc-*,clang-analyzer-*'
|
||||
Checks: 'modernize-*,modernize-use-override,google-*,-google-runtime-references,misc-*,clang-analyzer-*,-misc-non-private-member-variables-in-classes'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: 'async.h|async_logger.h|common.h|details|formatter.h|logger.h|sinks|spdlog.h|tweakme.h|version.h'
|
||||
AnalyzeTemporaryDtors: false
|
||||
|
@ -16,8 +16,6 @@ namespace details {
|
||||
class file_helper
|
||||
{
|
||||
public:
|
||||
const int open_tries = 5;
|
||||
const int open_interval = 10;
|
||||
explicit file_helper() = default;
|
||||
|
||||
file_helper(const file_helper &) = delete;
|
||||
@ -49,6 +47,8 @@ public:
|
||||
static std::tuple<filename_t, filename_t> split_by_extension(const filename_t &fname);
|
||||
|
||||
private:
|
||||
const int open_tries = 5;
|
||||
const int open_interval = 10;
|
||||
std::FILE *fd_{nullptr};
|
||||
filename_t _filename;
|
||||
};
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <array>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -370,8 +371,8 @@ SPDLOG_INLINE bool is_color_terminal() SPDLOG_NOEXCEPT
|
||||
#ifdef _WIN32
|
||||
return true;
|
||||
#else
|
||||
static constexpr const char *Terms[] = {
|
||||
"ansi", "color", "console", "cygwin", "gnome", "konsole", "kterm", "linux", "msys", "putty", "rxvt", "screen", "vt100", "xterm"};
|
||||
static constexpr std::array<const char *, 14>Terms = {
|
||||
"ansi", "color", "console", "cygwin", "gnome", "konsole", "kterm", "linux", "msys", "putty", "rxvt", "screen", "vt100", "xterm"};
|
||||
|
||||
const char *env_p = std::getenv("TERM");
|
||||
if (env_p == nullptr)
|
||||
|
@ -163,7 +163,7 @@ static int to12h(const tm &t)
|
||||
}
|
||||
|
||||
// Abbreviated weekday name
|
||||
static const char *days[]{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
static std::array<const char*, 7> days{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
class a_formatter : public flag_formatter
|
||||
{
|
||||
public:
|
||||
@ -180,7 +180,7 @@ public:
|
||||
};
|
||||
|
||||
// Full weekday name
|
||||
static const char *full_days[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||
static std::array<const char *, 7> full_days{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||
class A_formatter : public flag_formatter
|
||||
{
|
||||
public:
|
||||
@ -197,7 +197,7 @@ public:
|
||||
};
|
||||
|
||||
// Abbreviated month
|
||||
static const char *months[]{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"};
|
||||
static const std::array<const char *, 12> months {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"};
|
||||
class b_formatter : public flag_formatter
|
||||
{
|
||||
public:
|
||||
@ -214,8 +214,9 @@ public:
|
||||
};
|
||||
|
||||
// Full month name
|
||||
static const char *full_months[]{
|
||||
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
|
||||
static const std::array<const char *, 12> full_months {
|
||||
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
|
||||
|
||||
class B_formatter : public flag_formatter
|
||||
{
|
||||
public:
|
||||
@ -575,7 +576,7 @@ public:
|
||||
explicit z_formatter(padding_info padinfo)
|
||||
: flag_formatter(padinfo){}
|
||||
|
||||
const std::chrono::seconds cache_refresh = std::chrono::seconds(5);
|
||||
|
||||
|
||||
z_formatter() = default;
|
||||
z_formatter(const z_formatter &) = delete;
|
||||
@ -617,7 +618,8 @@ private:
|
||||
|
||||
int get_cached_offset(const log_msg &msg, const std::tm &tm_time)
|
||||
{
|
||||
if (msg.time - last_update_ >= cache_refresh)
|
||||
// refresh every 10 seconds
|
||||
if (msg.time - last_update_ >= std::chrono::seconds(10))
|
||||
{
|
||||
offset_minutes_ = os::utc_minutes_offset(tm_time);
|
||||
last_update_ = msg.time;
|
||||
|
@ -32,9 +32,10 @@ class logger
|
||||
{
|
||||
public:
|
||||
// Empty logger
|
||||
logger(std::string name) :
|
||||
explicit logger(std::string name) :
|
||||
name_(std::move(name)),
|
||||
sinks_(){}
|
||||
sinks_()
|
||||
{}
|
||||
|
||||
// Logger with range on sinks
|
||||
template<typename It>
|
||||
|
@ -29,7 +29,7 @@ class ansicolor_sink final : public sink
|
||||
{
|
||||
public:
|
||||
using mutex_t = typename ConsoleMutex::mutex_t;
|
||||
ansicolor_sink(color_mode mode = color_mode::automatic);
|
||||
explicit ansicolor_sink(color_mode mode = color_mode::automatic);
|
||||
~ansicolor_sink() override = default;
|
||||
|
||||
ansicolor_sink(const ansicolor_sink &other) = delete;
|
||||
|
Loading…
Reference in New Issue
Block a user