fix lint warnings from SonarQube

This commit is contained in:
proddy
2026-08-02 14:41:46 +02:00
parent 36884867f7
commit e166db8b70
12 changed files with 80 additions and 72 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ void AnalogSensor::start(const bool factory_settings) {
Command::add(
EMSdevice::DeviceType::ANALOGSENSOR,
F_(setvalue),
[&](const char * value, const int8_t id, JsonObject output) { return command_setvalue(value, id); },
[&](const char * value, const int8_t id, JsonObject) { return command_setvalue(value, id); },
FL_(setiovalue_cmd),
CommandFlag::ADMIN_ONLY);
@@ -195,7 +195,7 @@ void AnalogSensor::reload(bool get_nvs) {
Command::add(
EMSdevice::DeviceType::ANALOGSENSOR,
sensor.name,
[&](const char * value, const int8_t id, JsonObject output) { return command_setvalue(value, sensor.gpio); },
[&](const char * value, const int8_t, JsonObject) { return command_setvalue(value, sensor.gpio); },
sensor.type == AnalogType::COUNTER || (sensor.type >= AnalogType::CNT_0 && sensor.type <= AnalogType::CNT_2) ? FL_(counter)
: sensor.type == AnalogType::DIGITAL_OUT ? FL_(digital_out)
: sensor.type == AnalogType::RGB ? FL_(RGB)
+5 -5
View File
@@ -104,7 +104,7 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
shell.printfln("Unknown show command");
}
},
[](Shell const & shell, const std::vector<std::string> & current_arguments, const std::string & next_argument) -> std::vector<std::string> {
[](Shell const &, const std::vector<std::string> &, const std::string &) -> std::vector<std::string> {
return std::vector<std::string>{"system", "users", "devices", "log", "ems", "values", "mqtt", "commands"};
});
@@ -191,7 +191,7 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
CommandFlags::ADMIN,
{F_(restart)},
{F_(partitionname_optional)},
[](Shell & shell, const std::vector<std::string> & arguments) {
[](Shell &, const std::vector<std::string> & arguments) {
if (arguments.size()) {
EMSESP::system_.system_restart(arguments.front().c_str());
} else {
@@ -202,7 +202,7 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
commands->add_command(ShellContext::MAIN,
CommandFlags::ADMIN,
string_vector{F_(wifi), F_(reconnect)},
[](Shell & shell, const std::vector<std::string> & arguments) { EMSESP::network_.reconnect(); });
[](Shell &, const std::vector<std::string> &) { EMSESP::network_.reconnect(); });
//
// SET commands
@@ -244,7 +244,7 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
commands->add_command(ShellContext::MAIN,
CommandFlags::ADMIN,
string_vector{F_(set), F_(wifi), F_(password)},
[](Shell & shell, const std::vector<std::string> & arguments) {
[](Shell & shell, const std::vector<std::string> &) {
shell.enter_password(F_(new_password_prompt1), [](Shell & shell, bool completed, const std::string & password1) {
if (completed) {
shell.enter_password(F_(new_password_prompt2), [password1](Shell & shell, bool completed, const std::string & password2) {
@@ -367,7 +367,7 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
// EMS device commands
//
commands->add_command(ShellContext::MAIN, CommandFlags::ADMIN, {F_(scan)}, [](Shell & shell, const std::vector<std::string> & arguments) {
commands->add_command(ShellContext::MAIN, CommandFlags::ADMIN, {F_(scan)}, [](Shell &, const std::vector<std::string> &) {
EMSESP::scan_devices();
});
+3 -3
View File
@@ -152,7 +152,7 @@ void Network::begin() {
}
// format the BSSID (MAC address) of the network interface
bool Network::formatBSSID(const String & bssid, uint8_t (&mac)[6]) {
bool Network::formatBSSID([[maybe_unused]] const String & bssid, [[maybe_unused]] uint8_t (&mac)[6]) {
#ifndef EMSESP_STANDALONE
uint tmp[6];
if (bssid.isEmpty() || sscanf(bssid.c_str(), "%X:%X:%X:%X:%X:%X", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) != 6) {
@@ -331,7 +331,7 @@ void Network::checkConnection() {
// 802.11ac - wifi5
// 802.11ax - wifi6
// tx_power is the Tx power to set, 0 for auto
void Network::setWiFiPower(uint8_t tx_power) {
void Network::setWiFiPower([[maybe_unused]] uint8_t tx_power) {
#ifndef EMSESP_STANDALONE
if (tx_power != 0) {
if (!WiFi.setTxPower(static_cast<wifi_power_t>(tx_power))) {
@@ -413,7 +413,7 @@ void Network::startmDNS() const {
}
// WiFi disconnect reason code to string
const char * Network::disconnectReason(uint8_t code) {
const char * Network::disconnectReason([[maybe_unused]] uint8_t code) {
#ifndef EMSESP_STANDALONE
switch (code) {
case WIFI_REASON_UNSPECIFIED: // = 1,
+9 -9
View File
@@ -110,7 +110,7 @@ bool System::command_send(const char * value, const int8_t id) {
}
// send email via SMTP
bool System::command_sendmail(const char * value, const int8_t id) {
bool System::command_sendmail(const char * value, const int8_t) {
bool enabled = false;
uint8_t security;
uint16_t port;
@@ -487,7 +487,7 @@ void System::set_partition_install_date() {
}
// sets the partition to use on the next restart
bool System::set_partition(const char * partitionname) {
bool System::set_partition([[maybe_unused]] const char * partitionname) {
#ifdef EMSESP_STANDALONE
return true;
#else
@@ -1694,7 +1694,7 @@ static const std::pair<const char *, const char *> SECTION_MAP[] = {
#endif
// convert a single config file into a section of the output json object
void System::exportSettings(const std::string & type, const char * filename, JsonObject output) {
void System::exportSettings(const std::string & type, [[maybe_unused]] const char * filename, JsonObject output) {
if (type != "settings") {
output["type"] = type; // add the type to the output, not for settings as it's already added because its grouped
}
@@ -1849,7 +1849,7 @@ void System::exportSystemBackup(JsonObject output) {
}
// write a settings file using input from a json object, called from upload/restore
bool System::saveSettings(const char * filename, JsonObject input) {
bool System::saveSettings([[maybe_unused]] const char * filename, [[maybe_unused]] JsonObject input) {
#ifndef EMSESP_STANDALONE
const char * section = nullptr;
for (const auto & [f, label] : SECTION_MAP) {
@@ -2819,7 +2819,7 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
// rgb for RGB
// For example: /api/system/led?data=red:blink1
// For older non-RGB models, the colour would default to just being on.
bool System::command_led(const char * value, const int8_t id) {
bool System::command_led(const char * value, const int8_t) {
if (!value) {
return false; // no argument
}
@@ -2842,7 +2842,7 @@ bool System::command_led(const char * value, const int8_t id) {
}
// txpause command - temporarily pause the TX, by setting Txmode to 0 (disabled)
bool System::command_txpause(const char * value, const int8_t id) {
bool System::command_txpause(const char * value, const int8_t) {
bool arg;
if (!Helpers::value2bool(value, arg)) {
return false; // argument not recognized
@@ -2985,7 +2985,7 @@ bool System::ntp_connected() {
}
// see if its a BBQKees Gateway by checking the eFuse values
String System::getBBQKeesGatewayDetails(uint8_t detail) {
String System::getBBQKeesGatewayDetails([[maybe_unused]] uint8_t detail) {
#ifndef EMSESP_STANDALONE
union {
struct {
@@ -3401,7 +3401,7 @@ bool System::readCommand(const char * data) {
}
// system read command
bool System::command_read(const char * value, const int8_t id) {
bool System::command_read(const char * value, const int8_t) {
return readCommand(value);
}
@@ -3696,7 +3696,7 @@ void System::restore_snapshot_gpios(std::vector<int8_t> & u_gpios, std::vector<i
}
// show the contents of a directory in the LittleFS filesystem
void System::listDir(const char * dirname, uint8_t levels) {
void System::listDir([[maybe_unused]] const char * dirname, [[maybe_unused]] uint8_t levels) {
#if defined(EMSESP_DEBUG)
#ifndef EMSESP_STANDALONE