Skip to content

Commit c00c97c

Browse files
committed
Remove empty last line in rule description
Also separate violations in info logging
1 parent aa4326c commit c00c97c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/annotations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const processSarifReport = function (report) {
2121
const logFunction = mapPriority(rule.properties.priority);
2222
violation.locations.forEach(location => {
2323
const annotation = createAnnotation(location.physicalLocation, basedir, violation.message.text);
24-
core.info(`${annotation.file}:${annotation.startLine}:${rule.id} (Priority: ${rule.properties.priority}):${violation.message.text}`);
24+
core.info(`\n${annotation.file}:${annotation.startLine}:${rule.id} (Priority: ${rule.properties.priority}):${violation.message.text}`);
2525
logFunction(createDescription(rule), annotation);
2626
});
2727
});
@@ -76,7 +76,7 @@ function createDescription(rule) {
7676
}
7777
}
7878
// remove empty last line
79-
if (lines.length > 0 && lines[lines.length - 1] === '') {
79+
if (lines.length > 0 && lines[lines.length - 1].trim() === '') {
8080
lines.splice(lines.length - 1, 1);
8181
}
8282
const description = lines.join('\n');

tests/data/pmd-report.sarif

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"text": "Variable 'x' defined but not used"
1616
},
1717
"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 "
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 "
1919
},
2020
"helpUri": "https://pmd.github.io/pmd-6.40.0/pmd_rules_apex_bestpractices.html#unusedlocalvariable",
2121
"help": {

0 commit comments

Comments
 (0)