Skip to content

Commit cc178be

Browse files
author
Mithilesh Pawar
authored
Removed validate() method to allow the use of EnvVars for the plugins. (#133)
* Removed the validate() that checks for presence of base url and credentials. * Updated version of slf4j-simple to satisfy Enforcer rule in Jenkins plugin.
1 parent ffc6387 commit cc178be

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<dependency>
4949
<groupId>org.slf4j</groupId>
5050
<artifactId>slf4j-simple</artifactId>
51-
<version>1.7.25</version>
51+
<version>1.7.30</version>
5252
</dependency>
5353
<dependency>
5454
<groupId>org.junit.jupiter</groupId>

src/main/java/com/checkmarx/ast/wrapper/CxConfig.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
import lombok.Data;
66
import lombok.Setter;
77
import org.apache.commons.lang3.StringUtils;
8-
98
import java.util.ArrayList;
109
import java.util.List;
1110
import java.util.regex.Matcher;
1211
import java.util.regex.Pattern;
1312

1413
@Data
1514
@Builder
16-
public class CxConfig {
15+
public class CxConfig {
1716

1817
private static final Pattern pattern = Pattern.compile("([^\"]\\S*|\".+?\")\\s*");
1918

@@ -31,17 +30,6 @@ public void setAdditionalParameters(String additionalParameters) {
3130
this.additionalParameters = parseAdditionalParameters(additionalParameters);
3231
}
3332

34-
void validate() throws InvalidCLIConfigException {
35-
if (StringUtils.isBlank(getBaseUri())) {
36-
throw new InvalidCLIConfigException("Checkmarx server URL is not set");
37-
}
38-
39-
if (StringUtils.isBlank(getApiKey())
40-
&& (StringUtils.isBlank(getClientId()) || StringUtils.isBlank(getClientSecret()))) {
41-
throw new InvalidCLIConfigException("Credentials are not set");
42-
}
43-
}
44-
4533
List<String> toArguments() {
4634
List<String> commands = new ArrayList<>();
4735

src/main/java/com/checkmarx/ast/wrapper/CxWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public CxWrapper(CxConfig cxConfig)
4242

4343
public CxWrapper(@NonNull CxConfig cxConfig, @NonNull Logger logger) throws CxConfig.InvalidCLIConfigException,
4444
IOException {
45-
cxConfig.validate();
4645
this.cxConfig = cxConfig;
4746
this.logger = logger;
4847
this.executable = StringUtils.isBlank(this.cxConfig.getPathToExecutable())
@@ -305,7 +304,7 @@ public int getResultsBfl(@NonNull UUID scanId, @NonNull String queryId, List<Nod
305304

306305
}
307306

308-
public kicsRealtimeResults kicsRealtimeScan(@NonNull String fileSources,String engine ,String additionalParams)
307+
public kicsRealtimeResults kicsRealtimeScan(@NonNull String fileSources, String engine, String additionalParams)
309308
throws IOException, InterruptedException, CxException {
310309
this.logger.info("Executing 'scan kics-realtime' command using the CLI.");
311310
this.logger.info("Fetching the results for fileSources {} and additionalParams {}", fileSources, additionalParams);
@@ -317,14 +316,15 @@ public kicsRealtimeResults kicsRealtimeScan(@NonNull String fileSources,String e
317316
arguments.add(fileSources);
318317
arguments.add(CxConstants.ADDITONAL_PARAMS);
319318
arguments.add(additionalParams);
320-
if(engine.length()>0){
319+
if (engine.length() > 0) {
321320
arguments.add(CxConstants.ENGINE);
322321
arguments.add(engine);
323322
}
324323
kicsRealtimeResults kicsResults = Execution.executeCommand(withConfigArguments(arguments), logger, kicsRealtimeResults::fromLine);
325324
return kicsResults;
326325

327326
}
327+
328328
private int getIndexOfBfLNode(List<Node> bflNodes, List<Node> resultNodes) {
329329

330330
int bflNodeNotFound = -1;

0 commit comments

Comments
 (0)