Skip to content

Commit 6a8a3ea

Browse files
committed
Refactor script, update sarifs to with removed rules
1 parent d885d10 commit 6a8a3ea

10 files changed

Lines changed: 61 additions & 214 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Tool Tests'
2+
description: 'Run tool tests with specified shell'
3+
4+
inputs:
5+
shell:
6+
description: 'Shell to use (bash or wsl)'
7+
required: true
8+
default: 'bash'
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Run tool tests
14+
id: run_tests
15+
continue-on-error: true
16+
shell: ${{ inputs.shell }}
17+
run: |
18+
# Make the script executable
19+
chmod +x run-tool-tests.sh
20+
21+
# Initialize failed tools file
22+
rm -f /tmp/failed_tools.txt
23+
touch /tmp/failed_tools.txt
24+
25+
# Run tests for each tool directory
26+
for tool_dir in plugins/tools/*/; do
27+
tool_name=$(basename "$tool_dir")
28+
if [ -d "$tool_dir/test/src" ]; then
29+
echo "Running tests for $tool_name..."
30+
./run-tool-tests.sh "$tool_name" || {
31+
echo "❌ Test failed for $tool_name"
32+
echo "$tool_name" >> /tmp/failed_tools.txt
33+
}
34+
fi
35+
done
36+
37+
# Check if any tools failed
38+
if [ -s /tmp/failed_tools.txt ] && [ "$(wc -l < /tmp/failed_tools.txt)" -gt 0 ]; then
39+
echo -e "\n❌ The following tools failed their tests:"
40+
cat /tmp/failed_tools.txt
41+
echo "::error::Some tool tests failed. Please check the logs above for details."
42+
exit 1
43+
else
44+
echo "✅ All tool tests passed successfully!"
45+
fi

.github/workflows/it-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
if: matrix.os != 'windows-latest'
6969
run: chmod +x cli-v2
7070

71-
- name: Run init tests on Windows
71+
- name: Run init tests on Windows native
7272
if: matrix.os == 'windows-latest'
7373
id: run_init_tests_windows
7474
continue-on-error: true
@@ -96,13 +96,13 @@ jobs:
9696
9797
- name: Run tool tests on Unix
9898
if: matrix.os != 'windows-latest'
99-
uses: ./.github/workflows/tool-tests.yml
99+
uses: ./.github/actions/tool-tests
100100
with:
101101
shell: bash
102102

103-
- name: Run tool tests on Windows
103+
- name: Run tool tests on Windows WSL
104104
if: matrix.os == 'windows-latest'
105-
uses: ./.github/workflows/tool-tests.yml
105+
uses: ./.github/actions/tool-tests
106106
with:
107107
shell: wsl
108108

plugins/tools/codacy-enigma-cli/test/expected.sarif

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
{
66
"tool": {
77
"driver": {
8-
"name": "codacy-enigma-cli"
8+
"name": "codacy-enigma-cli",
9+
"rules": null
910
}
1011
},
1112
"results": [

plugins/tools/dartanalyzer/test/expected.sarif

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
],
4343
"tool": {
4444
"driver": {
45-
"name": "dartanalyzer"
45+
"name": "dartanalyzer",
46+
"rules": null
4647
}
4748
}
4849
}
4950
],
5051
"version": "2.1.0"
51-
}
52+
}

plugins/tools/eslint/test/expected.sarif

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
"driver": {
4545
"informationUri": "https://eslint.org",
4646
"name": "ESLint",
47-
"rules": [],
47+
"rules": null,
4848
"version": "8.57.0"
4949
}
5050
}
5151
}
5252
],
5353
"version": "2.1.0"
54-
}
54+
}

plugins/tools/lizard/test/expected.sarif

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,7 @@
88
"name": "Lizard",
99
"version": "1.17.10",
1010
"informationUri": "https://github.com/terryyin/lizard",
11-
"rules": [
12-
{
13-
"id": "Lizard_ccn-medium",
14-
"shortDescription": {
15-
"text": "Check the Cyclomatic Complexity value of a function or logic block. If the threshold is not met, raise a Medium issue. The default threshold is 8."
16-
},
17-
"properties": {
18-
"tags": [
19-
"warning"
20-
]
21-
}
22-
},
23-
{
24-
"id": "Lizard_file-nloc-medium",
25-
"shortDescription": {
26-
"text": "Check the number of lines of code (without comments) in a file. If the threshold is not met, raise a Medium issue. The default threshold is 500."
27-
},
28-
"properties": {
29-
"tags": [
30-
"warning"
31-
]
32-
}
33-
},
34-
{
35-
"id": "Lizard_nloc-medium",
36-
"shortDescription": {
37-
"text": "Check the number of lines of code (without comments) in a function. If the threshold is not met, raise a Medium issue. The default threshold is 50."
38-
},
39-
"properties": {
40-
"tags": [
41-
"warning"
42-
]
43-
}
44-
},
45-
{
46-
"id": "Lizard_parameter-count-medium",
47-
"shortDescription": {
48-
"text": "Check the number of parameters sent to a function. If the threshold is not met, raise a Medium issue. The default threshold is 8."
49-
},
50-
"properties": {
51-
"tags": [
52-
"warning"
53-
]
54-
}
55-
}
56-
]
11+
"rules": null
5712
}
5813
},
5914
"results": [

plugins/tools/pmd/test/expected.sarif

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,7 @@
88
"name": "PMD",
99
"version": "6.55.0",
1010
"informationUri": "https://pmd.github.io/pmd/",
11-
"rules": [
12-
{
13-
"id": "UnusedPrivateField",
14-
"shortDescription": {
15-
"text": "Avoid unused private fields such as 'unusedField'."
16-
},
17-
"fullDescription": {
18-
"text": "\nDetects when a private field is declared and/or assigned a value, but not used.\n\nSince PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the\nenclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking\nor e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis.\nPreviously these frameworks where explicitly allowed by listing their annotations in the property\n\"ignoredAnnotations\", but that turned out to be prone of false positive for any not explicitly considered framework.\n "
19-
},
20-
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield",
21-
"help": {
22-
"text": "\nDetects when a private field is declared and/or assigned a value, but not used.\n\nSince PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the\nenclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking\nor e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis.\nPreviously these frameworks where explicitly allowed by listing their annotations in the property\n\"ignoredAnnotations\", but that turned out to be prone of false positive for any not explicitly considered framework.\n "
23-
},
24-
"properties": {
25-
"ruleset": "Best Practices",
26-
"priority": 3,
27-
"tags": [
28-
"Best Practices"
29-
]
30-
}
31-
},
32-
{
33-
"id": "UnconditionalIfStatement",
34-
"shortDescription": {
35-
"text": "Do not use if statements that are always true or always false"
36-
},
37-
"fullDescription": {
38-
"text": "\nDo not use \"if\" statements whose conditionals are always true or always false.\n "
39-
},
40-
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_errorprone.html#unconditionalifstatement",
41-
"help": {
42-
"text": "\nDo not use \"if\" statements whose conditionals are always true or always false.\n "
43-
},
44-
"properties": {
45-
"ruleset": "Error Prone",
46-
"priority": 3,
47-
"tags": [
48-
"Error Prone"
49-
]
50-
}
51-
}
52-
]
11+
"rules": null
5312
}
5413
},
5514
"results": [

plugins/tools/pylint/test/expected.sarif

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
32
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
43
"version": "2.1.0",
54
"runs": [
@@ -116,4 +115,4 @@
116115
]
117116
}
118117
]
119-
}
118+
}

plugins/tools/semgrep/test/expected.sarif

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -188,92 +188,7 @@
188188
"tool": {
189189
"driver": {
190190
"name": "Semgrep OSS",
191-
"rules": [
192-
{
193-
"defaultConfiguration": {
194-
"level": "warning"
195-
},
196-
"fullDescription": {
197-
"text": "Unsafe command execution with os.system"
198-
},
199-
"help": {
200-
"markdown": "Unsafe command execution with os.system",
201-
"text": "Unsafe command execution with os.system"
202-
},
203-
"id": "codacy.tools-configs.python.lang.security.audit.os-system.os-system",
204-
"name": "codacy.tools-configs.python.lang.security.audit.os-system.os-system",
205-
"properties": {
206-
"precision": "very-high",
207-
"tags": []
208-
},
209-
"shortDescription": {
210-
"text": "Semgrep Finding: codacy.tools-configs.python.lang.security.audit.os-system.os-system"
211-
}
212-
},
213-
{
214-
"defaultConfiguration": {
215-
"level": "warning"
216-
},
217-
"fullDescription": {
218-
"text": "Unsafe deserialization with pickle"
219-
},
220-
"help": {
221-
"markdown": "Unsafe deserialization with pickle",
222-
"text": "Unsafe deserialization with pickle"
223-
},
224-
"id": "codacy.tools-configs.python.lang.security.audit.pickle.avoid-pickle",
225-
"name": "codacy.tools-configs.python.lang.security.audit.pickle.avoid-pickle",
226-
"properties": {
227-
"precision": "very-high",
228-
"tags": []
229-
},
230-
"shortDescription": {
231-
"text": "Semgrep Finding: codacy.tools-configs.python.lang.security.audit.pickle.avoid-pickle"
232-
}
233-
},
234-
{
235-
"defaultConfiguration": {
236-
"level": "warning"
237-
},
238-
"fullDescription": {
239-
"text": "Hardcoded password detected"
240-
},
241-
"help": {
242-
"markdown": "Hardcoded password detected",
243-
"text": "Hardcoded password detected"
244-
},
245-
"id": "codacy.tools-configs.python.lang.security.audit.hardcoded-password.hardcoded-password",
246-
"name": "codacy.tools-configs.python.lang.security.audit.hardcoded-password.hardcoded-password",
247-
"properties": {
248-
"precision": "very-high",
249-
"tags": []
250-
},
251-
"shortDescription": {
252-
"text": "Semgrep Finding: codacy.tools-configs.python.lang.security.audit.hardcoded-password.hardcoded-password"
253-
}
254-
},
255-
{
256-
"defaultConfiguration": {
257-
"level": "warning"
258-
},
259-
"fullDescription": {
260-
"text": "Unsafe command execution with shell=True"
261-
},
262-
"help": {
263-
"markdown": "Unsafe command execution with shell=True",
264-
"text": "Unsafe command execution with shell=True"
265-
},
266-
"id": "codacy.tools-configs.python.lang.security.audit.subprocess-shell-true.subprocess-shell-true",
267-
"name": "codacy.tools-configs.python.lang.security.audit.subprocess-shell-true.subprocess-shell-true",
268-
"properties": {
269-
"precision": "very-high",
270-
"tags": []
271-
},
272-
"shortDescription": {
273-
"text": "Semgrep Finding: codacy.tools-configs.python.lang.security.audit.subprocess-shell-true.subprocess-shell-true"
274-
}
275-
}
276-
],
191+
"rules": null,
277192
"semanticVersion": "1.78.0"
278193
}
279194
}

plugins/tools/trivy/test/expected.sarif

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,7 @@
88
"fullName": "Trivy Vulnerability Scanner",
99
"informationUri": "https://github.com/aquasecurity/trivy",
1010
"name": "Trivy",
11-
"rules": [
12-
{
13-
"id": "CVE-2024-21538",
14-
"name": "LanguageSpecificPackageVulnerability",
15-
"shortDescription": {
16-
"text": "cross-spawn: regular expression denial of service"
17-
},
18-
"fullDescription": {
19-
"text": "Versions of the package cross-spawn before 7.0.5 are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by crafting a very large and well crafted string."
20-
},
21-
"defaultConfiguration": {
22-
"level": "error"
23-
},
24-
"helpUri": "https://avd.aquasec.com/nvd/cve-2024-21538",
25-
"help": {
26-
"text": "Vulnerability CVE-2024-21538\nSeverity: HIGH\nPackage: cross-spawn\nFixed Version: 7.0.5, 6.0.6\nLink: [CVE-2024-21538](https://avd.aquasec.com/nvd/cve-2024-21538)\nVersions of the package cross-spawn before 7.0.5 are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by crafting a very large and well crafted string.",
27-
"markdown": "**Vulnerability CVE-2024-21538**\n| Severity | Package | Fixed Version | Link |\n| --- | --- | --- | --- |\n|HIGH|cross-spawn|7.0.5, 6.0.6|[CVE-2024-21538](https://avd.aquasec.com/nvd/cve-2024-21538)|\n\nVersions of the package cross-spawn before 7.0.5 are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by crafting a very large and well crafted string."
28-
},
29-
"properties": {
30-
"precision": "very-high",
31-
"security-severity": "7.5",
32-
"tags": [
33-
"vulnerability",
34-
"security",
35-
"HIGH"
36-
]
37-
}
38-
}
39-
],
11+
"rules": null,
4012
"version": "0.59.1"
4113
}
4214
},

0 commit comments

Comments
 (0)