Skip to content

Commit

Permalink
Fix SonarQube issues
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Sep 24, 2023
1 parent 56e9725 commit 2fce486
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cpp/piscsi/piscsi_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ bool Piscsi::SetLogLevel(const string& log_level) const
int lun = -1;
string level = log_level;

const auto& components = Split(log_level, COMPONENT_SEPARATOR, 2);
if (!components.empty()) {
if (const auto& components = Split(log_level, COMPONENT_SEPARATOR, 2); !components.empty()) {
level = components[0];

if (components.size() > 1) {
Expand Down
3 changes: 1 addition & 2 deletions cpp/scsictl/scsictl_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ bool ScsictlCommands::CommandOperationInfo()

bool ScsictlCommands::EvaluateParams(string_view image_params, const string& key1, const string& key2)
{
const auto& components = Split(string(image_params), COMPONENT_SEPARATOR, 2);
if (components.size() == 2) {
if (const auto& components = Split(string(image_params), COMPONENT_SEPARATOR, 2); components.size() == 2) {
SetParam(command, key1, components[0]);
SetParam(command, key2, components[1]);

Expand Down
6 changes: 2 additions & 4 deletions cpp/shared/protobuf_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ void protobuf_util::ParseParameters(PbDeviceDefinition& device, const string& pa
}

for (const auto& p : Split(params, COMPONENT_SEPARATOR)) {
const auto& param = Split(p, KEY_VALUE_SEPARATOR, 2);
if (param.size() == 2) {
if (const auto& param = Split(p, KEY_VALUE_SEPARATOR, 2); param.size() == 2) {
SetParam(device, param[0], param[1]);
}
}
Expand All @@ -48,8 +47,7 @@ void protobuf_util::SetPatternParams(PbCommand& command, const string& patterns)
string folder_pattern;
string file_pattern;

const auto& components = Split(patterns, ':', 2);
if (components.size() == 2) {
if (const auto& components = Split(patterns, ':', 2); components.size() == 2) {
folder_pattern = components[0];
file_pattern = components[1];
}
Expand Down

0 comments on commit 2fce486

Please sign in to comment.