Skip to content

Commit

Permalink
sonar changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Sep 25, 2023
1 parent d1b70f8 commit 72757ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ public HelmExecutionBuilder(final Path helmExecutable) {
this.flags = new ArrayList<>();
this.environmentVariables = new HashMap<>();

String workingDirectory = System.getenv("PWD");
this.workingDirectory =
workingDirectory == null ? this.helmExecutable.getParent() : new File(workingDirectory).toPath();
String workingDirectoryString = System.getenv("PWD");
this.workingDirectory = workingDirectoryString == null
? this.helmExecutable.getParent()
: new File(workingDirectoryString).toPath();
}

/**
Expand Down Expand Up @@ -132,6 +133,7 @@ public HelmExecutionBuilder argumentSet(final String name, final Set<String> val
this.argumentsSet.add(new KeyValuePair<>(name, value));
return this;
}

/**
* Adds a positional argument to the helm command.
*
Expand Down Expand Up @@ -161,13 +163,13 @@ public HelmExecutionBuilder environmentVariable(final String name, final String
}

/**
* Sets the working directory for the helm process.
* Sets the Path of the working directory for the helm process.
*
* @param workingDirectory the working directory.
* @param workingDirectoryPath the Path of the working directory.
* @return this builder.
*/
public HelmExecutionBuilder workingDirectory(final Path workingDirectory) {
this.workingDirectory = Objects.requireNonNull(workingDirectory, "workingDirectory must not be null");
public HelmExecutionBuilder workingDirectory(final Path workingDirectoryPath) {
this.workingDirectory = Objects.requireNonNull(workingDirectoryPath, "workingDirectoryPath must not be null");
return this;
}

Expand Down Expand Up @@ -230,7 +232,10 @@ private String[] buildCommand() {
command.addAll(positionals);

String[] commandArray = command.toArray(new String[0]);
LOGGER.debug("Helm command: {}", String.join(" ", Arrays.copyOfRange(commandArray, 1, commandArray.length)));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Helm command: {}", String.join(" ", Arrays.copyOfRange(commandArray, 1, commandArray.length)));
}

return commandArray;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

public class HelmExecutionBuilderTest {
class HelmExecutionBuilderTest {
@Test
@DisplayName("Test argumentSet null checks")
void testArgumentSetNullChecks() {
Expand Down

0 comments on commit 72757ac

Please sign in to comment.