Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ jobs:
CX_TENANT: ${{ secrets.CX_TENANT }}
CX_APIKEY: ${{ secrets.CX_APIKEY }}

- name: Print total coverage percentage
run: |
COVERED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@covered)" target/site/jacoco/jacoco.xml)
MISSED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@missed)" target/site/jacoco/jacoco.xml)
TOTAL_LINES=$((COVERED_LINES + MISSED_LINES))
COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERED_LINES / $TOTAL_LINES * 100" | bc)
echo "Total coverage percentage: $COVERAGE_PERCENTAGE%"
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0
with:
jacoco-csv-file: target/site/jacoco/jacoco.csv

- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4
Expand Down
29 changes: 23 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<configuration>
<excludes>
<exclude>**/com/checkmarx/ast/results/**</exclude>
<exclude>**/com/checkmarx/ast/kicsRealtimeResults/**</exclude>
<exclude>**/com/checkmarx/ast/asca/**</exclude>
<exclude>**/com/checkmarx/ast/learnMore/**</exclude>
<exclude>**/com/checkmarx/ast/predicate/**</exclude>
<exclude>**/com/checkmarx/ast/scan/**</exclude>
<exclude>**/com/checkmarx/ast/codebashing/**</exclude>
<exclude>**/com/checkmarx/ast/remediation/**</exclude>
<exclude>**/com/checkmarx/ast/project/**</exclude>
<exclude>**/com/checkmarx/ast/tenant/**</exclude>
<exclude>**/com/checkmarx/ast/wrapper/CxConstants.class</exclude>
<exclude>**/com/checkmarx/ast/wrapper/CxException.class</exclude>
<exclude>**/com/checkmarx/ast/wrapper/CxConfig.class</exclude>
<exclude>**/com/checkmarx/ast/wrapper/CxBaseObject.class</exclude>
<exclude>**/com/checkmarx/ast/wrapper/CxConfig$*.class</exclude>


<!-- Add other patterns as needed -->
</excludes>
</configuration>
<executions>
<execution>
<goals>
Expand All @@ -77,15 +99,10 @@
<goals>
<goal>report</goal>
</goals>
<configuration>
<includes>
<include>**/src/main/java/**</include>
<!-- Add other patterns as needed -->
</includes>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/checkmarx/ast/wrapper/CxConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ List<String> toArguments() {
return commands;
}

public static final class InvalidCLIConfigException extends Exception {
public InvalidCLIConfigException(String message) {
super(message);
}
}

@SuppressWarnings("ALL")
public static class CxConfigBuilder {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/checkmarx/ast/AuthTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AuthTest extends BaseTest {
void testAuthValidate() throws CxException, IOException, InterruptedException {
Assertions.assertNotNull(wrapper.authValidate());
}

//
@Test
void testAuthFailure() {
CxConfig cxConfig = getConfig();
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/com/checkmarx/ast/BuildResultsArgumentsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.checkmarx.ast;

import com.checkmarx.ast.results.ReportFormat;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.UUID;

class BuildResultsArgumentsTest extends BaseTest {

@Test
void testBuildResultsArguments_CreatesValidArguments() {
UUID scanId = UUID.randomUUID();
ReportFormat format = ReportFormat.json;

List<String> arguments = wrapper.buildResultsArguments(scanId, format);
//

Assertions.assertNotNull(arguments, "Arguments list should not be null");
Assertions.assertFalse(arguments.isEmpty(), "Arguments list should not be empty");
Assertions.assertTrue(arguments.contains(scanId.toString()), "Arguments should contain scan ID");
Assertions.assertTrue(arguments.contains(format.toString()), "Arguments should contain the report format");
}
}