Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Apr 18, 2024
1 parent f26efae commit 8ef4ddd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
25 changes: 13 additions & 12 deletions src/modules/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ static bool status_gt(const std::string& a, const std::string& b) {
return false;
}

std::tuple<uint8_t, float, std::string, float, uint16_t, float> waybar::modules::Battery::getInfos() {
std::tuple<uint8_t, float, std::string, float, uint16_t, float>
waybar::modules::Battery::getInfos() {

Check warning on line 185 in src/modules/battery.cpp

View workflow job for this annotation

GitHub Actions / build

src/modules/battery.cpp:185:27 [readability-function-cognitive-complexity]

function 'getInfos' has cognitive complexity of 224 (threshold 25)
std::lock_guard<std::mutex> guard(battery_list_mutex_);

try {
Expand Down Expand Up @@ -596,7 +597,8 @@ std::tuple<uint8_t, float, std::string, float, uint16_t, float> waybar::modules:
// still charging but not yet done
if (cap == 100 && status == "Charging") status = "Full";

return {cap, time_remaining, status, total_power / 1e6, mainBatCycleCount, mainBatHealthPercent};
return {
cap, time_remaining, status, total_power / 1e6, mainBatCycleCount, mainBatHealthPercent};
#endif
} catch (const std::exception& e) {
spdlog::error("Battery: {}", e.what());
Expand Down Expand Up @@ -686,12 +688,11 @@ auto waybar::modules::Battery::update() -> void {
} else if (config_["tooltip-format"].isString()) {
tooltip_format = config_["tooltip-format"].asString();
}
label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format),
fmt::arg("timeTo", tooltip_text_default),
fmt::arg("power", power), fmt::arg("capacity", capacity),
fmt::arg("time", time_remaining_formatted),
fmt::arg("cycles", cycles),
fmt::arg("health", fmt::format("{:.3}", health))));
label_.set_tooltip_text(
fmt::format(fmt::runtime(tooltip_format), fmt::arg("timeTo", tooltip_text_default),
fmt::arg("power", power), fmt::arg("capacity", capacity),
fmt::arg("time", time_remaining_formatted), fmt::arg("cycles", cycles),
fmt::arg("health", fmt::format("{:.3}", health))));
}
if (!old_status_.empty()) {
label_.get_style_context()->remove_class(old_status_);
Expand All @@ -710,10 +711,10 @@ auto waybar::modules::Battery::update() -> void {
} else {
event_box_.show();
auto icons = std::vector<std::string>{status + "-" + state, status, state};
label_.set_markup(fmt::format(
fmt::runtime(format), fmt::arg("capacity", capacity), fmt::arg("power", power),
fmt::arg("icon", getIcon(capacity, icons)), fmt::arg("time", time_remaining_formatted),
fmt::arg("cycles", cycles)));
label_.set_markup(
fmt::format(fmt::runtime(format), fmt::arg("capacity", capacity), fmt::arg("power", power),
fmt::arg("icon", getIcon(capacity, icons)),
fmt::arg("time", time_remaining_formatted), fmt::arg("cycles", cycles)));
}
// Call parent update
ALabel::update();
Expand Down
4 changes: 1 addition & 3 deletions src/modules/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@ void waybar::modules::Clock::cldShift_up() {
void waybar::modules::Clock::cldShift_down() {
cldCurrShift_ -= (months)((cldMode_ == CldMode::YEAR) ? 12 : 1) * cldShift_;
}
void waybar::modules::Clock::cldShift_reset() {
cldCurrShift_ = (months)0;
}
void waybar::modules::Clock::cldShift_reset() { cldCurrShift_ = (months)0; }
void waybar::modules::Clock::tz_up() {
const auto tzSize{tzList_.size()};
if (tzSize == 1) return;
Expand Down

0 comments on commit 8ef4ddd

Please sign in to comment.