refactor(clang-tidy): Apply fixes

This commit is contained in:
Michael Carlberg
2016-11-25 13:55:15 +01:00
parent 0128014d44
commit ff9be848c7
119 changed files with 1752 additions and 1046 deletions

View File

@ -21,18 +21,22 @@ namespace modules {
m_path = string_util::replace(PATH_TEMPERATURE_INFO, "%zone%", to_string(m_zone));
if (!file_util::exists(m_path))
if (!file_util::exists(m_path)) {
throw module_error("The file '" + m_path + "' does not exist");
}
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_RAMP});
m_formatter->add(FORMAT_WARN, TAG_LABEL_WARN, {TAG_LABEL_WARN, TAG_RAMP});
if (m_formatter->has(TAG_LABEL))
if (m_formatter->has(TAG_LABEL)) {
m_label[temp_state::NORMAL] = load_optional_label(m_conf, name(), TAG_LABEL, "%temperature%");
if (m_formatter->has(TAG_LABEL_WARN))
}
if (m_formatter->has(TAG_LABEL_WARN)) {
m_label[temp_state::WARN] = load_optional_label(m_conf, name(), TAG_LABEL_WARN, "%temperature%");
if (m_formatter->has(TAG_RAMP))
}
if (m_formatter->has(TAG_RAMP)) {
m_ramp = load_ramp(m_conf, name(), TAG_RAMP);
}
}
bool temperature_module::update() {
@ -44,30 +48,34 @@ namespace modules {
label->replace_token("%temperature%", to_string(m_temp) + "°C");
};
if (m_label[temp_state::NORMAL])
if (m_label[temp_state::NORMAL]) {
replace_tokens(m_label[temp_state::NORMAL]);
if (m_label[temp_state::WARN])
}
if (m_label[temp_state::WARN]) {
replace_tokens(m_label[temp_state::WARN]);
}
return true;
}
string temperature_module::get_format() const {
if (m_temp > m_tempwarn)
if (m_temp > m_tempwarn) {
return FORMAT_WARN;
else
} else {
return DEFAULT_FORMAT;
}
}
bool temperature_module::build(builder* builder, string tag) const {
if (tag == TAG_LABEL)
bool temperature_module::build(builder* builder, const string& tag) const {
if (tag == TAG_LABEL) {
builder->node(m_label.at(temp_state::NORMAL));
else if (tag == TAG_LABEL_WARN)
} else if (tag == TAG_LABEL_WARN) {
builder->node(m_label.at(temp_state::WARN));
else if (tag == TAG_RAMP)
} else if (tag == TAG_RAMP) {
builder->node(m_ramp->get_by_percentage(m_perc));
else
} else {
return false;
}
return true;
}
}