Skip to content

Commit 7a0e212

Browse files
committed
Merge branch 'main' into typescript
2 parents 030b93c + edec7cf commit 7a0e212

File tree

19 files changed

+5727
-7412
lines changed

19 files changed

+5727
-7412
lines changed

.github/workflows/generate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && git push origin main
5555
5656
- name: Setup Node.js
57-
uses: actions/[email protected].0
57+
uses: actions/[email protected].2
5858
with:
5959
node-version: 20
6060

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
ref: ${{ github.event.release.tag_name }}
2020

2121
- name: Setup Node
22-
uses: actions/[email protected].0
22+
uses: actions/[email protected].2
2323
with:
2424
node-version: 20
2525

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
- name: Setup Node.js
24-
uses: actions/[email protected].0
24+
uses: actions/[email protected].2
2525
with:
2626
node-version: 20
2727
- run: npm ci

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,27 @@
66

77
**🚀 Implemented enhancements:**
88

9+
- Fix artifact upload, new parameter `uploadSarifReport` [\#250](https://github.com/pmd/pmd-github-action/pull/250) (@adangel)
910
- Upgrade to node20 [\#221](https://github.com/pmd/pmd-github-action/pull/221) (@adangel)
1011

12+
**🐛 Fixed bugs:**
13+
14+
- Annotations are not shown in PR / commit [\#249](https://github.com/pmd/pmd-github-action/issues/249)
15+
1116
**📦 Dependency updates:**
1217

18+
- Bump @actions/artifact from 2.0.1 to 2.1.4 [\#263](https://github.com/pmd/pmd-github-action/pull/263) (@dependabot[bot])
19+
- Bump nock from 13.5.0 to 13.5.4 [\#262](https://github.com/pmd/pmd-github-action/pull/262) (@dependabot[bot])
20+
- Bump eslint from 8.56.0 to 8.57.0 [\#259](https://github.com/pmd/pmd-github-action/pull/259) (@dependabot[bot])
21+
- Bump actions/setup-node from 4.0.1 to 4.0.2 [\#256](https://github.com/pmd/pmd-github-action/pull/256) (@dependabot[bot])
22+
- Bump semver from 7.5.4 to 7.6.0 [\#255](https://github.com/pmd/pmd-github-action/pull/255) (@dependabot[bot])
23+
- Bump nock from 13.4.0 to 13.5.0 [\#248](https://github.com/pmd/pmd-github-action/pull/248) (@dependabot[bot])
24+
- Bump @actions/artifact from 2.0.0 to 2.0.1 [\#247](https://github.com/pmd/pmd-github-action/pull/247) (@dependabot[bot])
25+
- Bump actions/setup-node from 4.0.0 to 4.0.1 [\#245](https://github.com/pmd/pmd-github-action/pull/245) (@dependabot[bot])
26+
- Bump eslint from 8.55.0 to 8.56.0 [\#244](https://github.com/pmd/pmd-github-action/pull/244) (@dependabot[bot])
27+
- Bump @actions/artifact from 1.1.2 to 2.0.0 [\#243](https://github.com/pmd/pmd-github-action/pull/243) (@dependabot[bot])
28+
- Bump eslint from 8.54.0 to 8.55.0 [\#242](https://github.com/pmd/pmd-github-action/pull/242) (@dependabot[bot])
29+
- Bump nock from 13.3.8 to 13.4.0 [\#241](https://github.com/pmd/pmd-github-action/pull/241) (@dependabot[bot])
1330
- Bump eslint from 8.53.0 to 8.54.0 [\#240](https://github.com/pmd/pmd-github-action/pull/240) (@dependabot[bot])
1431
- Bump eslint from 8.52.0 to 8.53.0 [\#238](https://github.com/pmd/pmd-github-action/pull/238) (@dependabot[bot])
1532
- Bump nock from 13.3.7 to 13.3.8 [\#237](https://github.com/pmd/pmd-github-action/pull/237) (@dependabot[bot])
@@ -18,6 +35,7 @@
1835
- Bump eslint from 8.51.0 to 8.52.0 [\#234](https://github.com/pmd/pmd-github-action/pull/234) (@dependabot[bot])
1936
- Bump nock from 13.3.4 to 13.3.6 [\#233](https://github.com/pmd/pmd-github-action/pull/233) (@dependabot[bot])
2037
- Bump @vercel/ncc from 0.38.0 to 0.38.1 [\#232](https://github.com/pmd/pmd-github-action/pull/232) (@dependabot[bot])
38+
- Bump @actions/github from 5.1.1 to 6.0.0 [\#231](https://github.com/pmd/pmd-github-action/pull/231) (@dependabot[bot])
2139
- Bump nock from 13.3.3 to 13.3.4 [\#230](https://github.com/pmd/pmd-github-action/pull/230) (@dependabot[bot])
2240
- Bump eslint from 8.50.0 to 8.51.0 [\#229](https://github.com/pmd/pmd-github-action/pull/229) (@dependabot[bot])
2341
- Bump @octokit/rest from 20.0.1 to 20.0.2 [\#227](https://github.com/pmd/pmd-github-action/pull/227) (@dependabot[bot])
@@ -52,6 +70,14 @@
5270
- Bump convert-action from 0.2.0 to 0.2.2 [\#194](https://github.com/pmd/pmd-github-action/pull/194) (@dependabot[bot])
5371
- Bump eslint from 8.41.0 to 8.42.0 [\#192](https://github.com/pmd/pmd-github-action/pull/192) (@dependabot[bot])
5472

73+
**✔️ Closed issues:**
74+
75+
- Getting Warning in Node version only for PMD [\#253](https://github.com/pmd/pmd-github-action/issues/253)
76+
77+
**🎉 Merged pull requests:**
78+
79+
- Relativize paths if Sarif report already contains URIs [\#266](https://github.com/pmd/pmd-github-action/pull/266) (@adangel)
80+
5581
## [v1.4.1](https://github.com/pmd/pmd-github-action/tree/v1.4.1) (2023-05-26)
5682

5783
[Full Changelog](https://github.com/pmd/pmd-github-action/compare/v1.4.0...v1.4.1)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ See also [Uploading a SARIF file to GitHub](https://docs.github.com/en/code-secu
8484
|`rulesets` |yes| |Comma separated list of ruleset names to use.|
8585
|`analyzeModifiedFilesOnly`|no|"true"|Instead of analyze all files under "sourcePath", only the files that have been touched in a pull request or push will be analyzed. This makes the analysis faster and helps especially bigger projects which gradually want to introduce PMD. This helps in enforcing that no new code violation is introduced.<br>Depending on the analyzed language, the results might be less accurate results. At the moment, this is not a problem, as PMD mostly analyzes each file individually, but that might change in the future.<br>If the change is very big, not all files might be analyzed. Currently the maximum number of modified files is 300.<br>Note: When using PMD as a code scanner in order to create "Code scanning alerts" on GitHub, all files should be analyzed in order to produce a complete picture of the project. Otherwise alerts might get closed too soon.|
8686
|`createGitHubAnnotations`|no|"true"|By default, all detected violations are added as annotations to the pull request. You can disable this by setting FALSE. This can be useful if you are using another tool for this purpose.|
87+
|`uploadSarifReport`|no|"true"|By default, the generated SARIF report will be uploaded as an artifact named "PMD Report". This can be disabled, e.g. if there are multiple executions on multiple os of this action.|
8788

8889
## Outputs
8990

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
3+
"version": "2.1.0",
4+
"runs": [
5+
{
6+
"tool": {
7+
"driver": {
8+
"name": "PMD",
9+
"version": "6.40.0",
10+
"informationUri": "https://pmd.github.io/pmd/",
11+
"rules": [
12+
{
13+
"id": "UnusedLocalVariable",
14+
"shortDescription": {
15+
"text": "Variable 'x' defined but not used"
16+
},
17+
"fullDescription": {
18+
"text": "\n Detects when a local variable is declared and/or assigned but not used.\n Second line.\n Third line with additional indentation.\n Fourth line with less indentation.\n "
19+
},
20+
"helpUri": "https://pmd.github.io/pmd-6.40.0/pmd_rules_apex_bestpractices.html#unusedlocalvariable",
21+
"help": {
22+
"text": "\nDetects when a local variable is declared and/or assigned but not used.\n "
23+
},
24+
"properties": {
25+
"ruleset": "Best Practices",
26+
"priority": 5,
27+
"tags": [
28+
"Best Practices"
29+
]
30+
}
31+
}
32+
]
33+
}
34+
},
35+
"results": [
36+
{
37+
"ruleId": "UnusedLocalVariable",
38+
"ruleIndex": 0,
39+
"message": {
40+
"text": "Variable 'x' defined but not used"
41+
},
42+
"locations": [
43+
{
44+
"physicalLocation": {
45+
"artifactLocation": {
46+
"uri": "file:///home/andreas/PMD/source/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls"
47+
},
48+
"region": {
49+
"startLine": 3,
50+
"startColumn": 16,
51+
"endLine": 3,
52+
"endColumn": 16
53+
}
54+
}
55+
}
56+
]
57+
}
58+
],
59+
"invocations": [
60+
{
61+
"executionSuccessful": true,
62+
"toolConfigurationNotifications": [],
63+
"toolExecutionNotifications": []
64+
}
65+
]
66+
}
67+
]
68+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
3+
"version": "2.1.0",
4+
"runs": [
5+
{
6+
"tool": {
7+
"driver": {
8+
"name": "PMD",
9+
"version": "6.40.0",
10+
"informationUri": "https://pmd.github.io/pmd/",
11+
"rules": [
12+
{
13+
"id": "UnusedLocalVariable",
14+
"shortDescription": {
15+
"text": "Variable 'x' defined but not used"
16+
},
17+
"fullDescription": {
18+
"text": "\n Detects when a local variable is declared and/or assigned but not used.\n Second line.\n Third line with additional indentation.\n Fourth line with less indentation.\n "
19+
},
20+
"helpUri": "https://pmd.github.io/pmd-6.40.0/pmd_rules_apex_bestpractices.html#unusedlocalvariable",
21+
"help": {
22+
"text": "\nDetects when a local variable is declared and/or assigned but not used.\n "
23+
},
24+
"properties": {
25+
"ruleset": "Best Practices",
26+
"priority": 5,
27+
"tags": [
28+
"Best Practices"
29+
]
30+
}
31+
}
32+
]
33+
}
34+
},
35+
"results": [
36+
{
37+
"ruleId": "UnusedLocalVariable",
38+
"ruleIndex": 0,
39+
"message": {
40+
"text": "Variable 'x' defined but not used"
41+
},
42+
"locations": [
43+
{
44+
"physicalLocation": {
45+
"artifactLocation": {
46+
"uri": "file:///D:/a/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls"
47+
},
48+
"region": {
49+
"startLine": 3,
50+
"startColumn": 16,
51+
"endLine": 3,
52+
"endColumn": 16
53+
}
54+
}
55+
}
56+
]
57+
}
58+
],
59+
"invocations": [
60+
{
61+
"executionSuccessful": true,
62+
"toolConfigurationNotifications": [],
63+
"toolExecutionNotifications": []
64+
}
65+
]
66+
}
67+
]
68+
}

__tests__/sarif.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,36 @@ describe('pmd-github-action-sarif', function () {
121121
)
122122
})
123123

124+
test('can properly relativize report which contains already uris', async () => {
125+
const isWindows = os.platform() === 'win32'
126+
127+
const reportPath = path.join(tempPath, 'pmd-report-uris.sarif')
128+
await io.cp(
129+
path.join(
130+
__dirname,
131+
'data',
132+
isWindows ? 'pmd-report-win-uris.sarif' : 'pmd-report-uris.sarif'
133+
),
134+
reportPath
135+
)
136+
137+
const reportBefore = sarif.loadReport(reportPath)
138+
const fullPath = isWindows
139+
? 'file:///D:/a/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls'
140+
: 'file:///home/andreas/PMD/source/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls'
141+
expect(extractFirstViolationLocationUri(reportBefore)).toBe(fullPath)
142+
143+
process.env['GITHUB_WORKSPACE'] = isWindows
144+
? 'D:\\a\\pmd-github-action-test'
145+
: '/home/andreas/PMD/source/pmd-github-action-test'
146+
sarif.relativizeReport(reportPath)
147+
const reportAfter = sarif.loadReport(reportPath)
148+
// note: not normalizing the paths to platform dependent paths - it must be a valid URI
149+
expect(extractFirstViolationLocationUri(reportAfter)).toBe(
150+
'src/classes/UnusedLocalVariableSample.cls'
151+
)
152+
})
153+
124154
test('can properly relativize report - windows paths - issue #51', async () => {
125155
const reportPath = path.join(tempPath, 'pmd-report.sarif')
126156
await io.cp(

0 commit comments

Comments
 (0)