mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 07:50:04 +00:00
Archive warnings clang-tidy fixes
This commit is contained in:
parent
8cdd8526eb
commit
81f09e07f0
14 changed files with 43 additions and 46 deletions
|
|
@ -96,7 +96,7 @@ public:
|
|||
TextProductMessage(TextProductMessage&&) noexcept;
|
||||
TextProductMessage& operator=(TextProductMessage&&) noexcept;
|
||||
|
||||
boost::uuids::uuid uuid() const;
|
||||
[[nodiscard]] boost::uuids::uuid uuid() const;
|
||||
std::string message_content() const;
|
||||
std::shared_ptr<WmoHeader> wmo_header() const;
|
||||
std::vector<std::string> mnd_header() const;
|
||||
|
|
|
|||
|
|
@ -593,8 +593,8 @@ std::optional<Vtec> TryParseVtecString(std::istream& is)
|
|||
|
||||
if (RE2::PartialMatch(line, *rePVtecString))
|
||||
{
|
||||
vtec = Vtec();
|
||||
bool vtecValid = vtec->pVtec_.Parse(line);
|
||||
vtec = Vtec();
|
||||
const bool vtecValid = vtec->pVtec_.Parse(line);
|
||||
|
||||
isBegin = is.tellg();
|
||||
|
||||
|
|
|
|||
|
|
@ -143,9 +143,11 @@ std::chrono::sys_time<std::chrono::minutes> WmoHeader::GetDateTime(
|
|||
{
|
||||
std::chrono::sys_time<std::chrono::minutes> wmoDateTime {};
|
||||
|
||||
if (p->absoluteDateTime_.has_value())
|
||||
const auto absoluteDateTime = p->absoluteDateTime_;
|
||||
|
||||
if (absoluteDateTime.has_value())
|
||||
{
|
||||
wmoDateTime = p->absoluteDateTime_.value();
|
||||
wmoDateTime = absoluteDateTime.value();
|
||||
}
|
||||
else if (endTimeHint.has_value())
|
||||
{
|
||||
|
|
@ -160,8 +162,8 @@ std::chrono::sys_time<std::chrono::minutes> WmoHeader::GetDateTime(
|
|||
{
|
||||
using namespace std::chrono;
|
||||
|
||||
auto endDays = floor<days>(endTimeHint.value());
|
||||
year_month_day endDate {endDays};
|
||||
const auto endDays = floor<days>(endTimeHint.value());
|
||||
const year_month_day endDate {endDays};
|
||||
|
||||
// Combine end date year and month with WMO date time
|
||||
wmoDateTime =
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ IemApiProvider::ListTextProducts(std::chrono::sys_days date,
|
|||
std::optional<std::string_view> optionalCccc,
|
||||
std::optional<std::string_view> optionalPil)
|
||||
{
|
||||
std::string_view cccc =
|
||||
const std::string_view cccc =
|
||||
optionalCccc.has_value() ? optionalCccc.value() : std::string_view {};
|
||||
std::string_view pil =
|
||||
const std::string_view pil =
|
||||
optionalPil.has_value() ? optionalPil.value() : std::string_view {};
|
||||
|
||||
const auto dateArray = std::array {date};
|
||||
|
|
@ -72,7 +72,7 @@ IemApiProvider::ProcessTextProductLists(
|
|||
{
|
||||
auto response = asyncResponse.get();
|
||||
|
||||
boost::json::value json = util::json::ReadJsonString(response.text);
|
||||
const boost::json::value json = util::json::ReadJsonString(response.text);
|
||||
|
||||
if (response.status_code == cpr::status::HTTP_OK)
|
||||
{
|
||||
|
|
@ -161,7 +161,7 @@ IemApiProvider::ProcessTextProductFiles(
|
|||
{
|
||||
// Load file
|
||||
auto& productId = asyncResponse.first;
|
||||
std::shared_ptr<awips::TextProductFile> textProductFile {
|
||||
const std::shared_ptr<awips::TextProductFile> textProductFile {
|
||||
std::make_shared<awips::TextProductFile>()};
|
||||
std::istringstream responseBody {response.text};
|
||||
if (textProductFile->LoadData(productId, responseBody))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
// Enable chrono formatters
|
||||
#ifndef __cpp_lib_format
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier, cppcoreguidelines-macro-usage)
|
||||
# define __cpp_lib_format 202110L
|
||||
#endif
|
||||
|
||||
|
|
@ -106,7 +107,7 @@ WarningsProvider::LoadUpdatedFiles(
|
|||
asyncCallbacks;
|
||||
std::vector<std::shared_ptr<awips::TextProductFile>> updatedFiles;
|
||||
|
||||
std::chrono::sys_time<std::chrono::hours> now =
|
||||
const std::chrono::sys_time<std::chrono::hours> now =
|
||||
std::chrono::floor<std::chrono::hours>(std::chrono::system_clock::now());
|
||||
std::chrono::sys_time<std::chrono::hours> currentHour =
|
||||
(startTime != std::chrono::sys_time<std::chrono::hours> {}) ?
|
||||
|
|
@ -130,7 +131,8 @@ WarningsProvider::LoadUpdatedFiles(
|
|||
{
|
||||
if (headResponse.status_code == cpr::status::HTTP_OK)
|
||||
{
|
||||
bool updated = p->UpdateFileRecord(headResponse, filename);
|
||||
const bool updated =
|
||||
p->UpdateFileRecord(headResponse, filename);
|
||||
|
||||
if (updated)
|
||||
{
|
||||
|
|
@ -173,7 +175,7 @@ WarningsProvider::LoadUpdatedFiles(
|
|||
logger_->debug("Loading file: {}", filename);
|
||||
|
||||
// Load file
|
||||
std::shared_ptr<awips::TextProductFile> textProductFile {
|
||||
const std::shared_ptr<awips::TextProductFile> textProductFile {
|
||||
std::make_shared<awips::TextProductFile>()};
|
||||
std::istringstream responseBody {response.text};
|
||||
if (textProductFile->LoadData(filename, responseBody))
|
||||
|
|
@ -218,7 +220,7 @@ bool WarningsProvider::Impl::UpdateFileRecord(const cpr::Response& response,
|
|||
lastModified = lastModifiedIt->second;
|
||||
}
|
||||
|
||||
std::unique_lock lock(filesMutex_);
|
||||
const std::unique_lock lock(filesMutex_);
|
||||
|
||||
auto it = files_.find(filename);
|
||||
if (it != files_.cend())
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@
|
|||
# include <date/date.h>
|
||||
#endif
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace util
|
||||
namespace scwx::util
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::util::time";
|
||||
|
|
@ -48,6 +46,7 @@ std::chrono::system_clock::time_point TimePoint(uint32_t modifiedJulianDate,
|
|||
using sys_days = time_point<system_clock, days>;
|
||||
constexpr auto epoch = sys_days {1969y / December / 31d};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers): literals are used
|
||||
return epoch + (modifiedJulianDate * 24h) +
|
||||
std::chrono::milliseconds {milliseconds};
|
||||
}
|
||||
|
|
@ -154,5 +153,4 @@ template std::optional<std::chrono::sys_time<std::chrono::seconds>>
|
|||
TryParseDateTime<std::chrono::seconds>(const std::string& dateTimeFormat,
|
||||
const std::string& str);
|
||||
|
||||
} // namespace util
|
||||
} // namespace scwx
|
||||
} // namespace scwx::util
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue