Skip to content

Commit 8185f80

Browse files
FIX: @W-19420771@: Workaround PMD Suppress whitespace issue (#274)
1 parent 9ae9e49 commit 8185f80

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/lib/pmd/pmd-suppressions-code-action-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function generateClassLevelSuppression(document: vscode.TextDocument, diag: Code
9090
const existingSuppressionTags = suppressionMatch[1].split(',').map(rule => rule.trim());
9191
if (!existingSuppressionTags.includes(suppressionTag)) {
9292
// If the rule is not present, add it to the existing @SuppressWarnings
93-
const updatedSuppressionTagsList = [...existingSuppressionTags, suppressionTag].join(', ');
93+
const updatedSuppressionTagsList = [...existingSuppressionTags, suppressionTag].join(',');
9494
const updatedSuppression = `@SuppressWarnings('${updatedSuppressionTagsList}')`;
9595
const suppressionStartPosition = document.positionAt(classText.indexOf(suppressionMatch[0]));
9696
const suppressionEndPosition = document.positionAt(classText.indexOf(suppressionMatch[0]) + suppressionMatch[0].length);

src/test/unit/lib/pmd/pmd-suppressions-code-action-provider.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('PMDSupressionsCodeActionProvider Tests', () => {
116116
const classEdits: vscode.TextEdit[] = codeActions[1].edit.get(sampleApexUri);
117117
expect(classEdits).toHaveLength(1);
118118
expect(classEdits[0].range).toEqual(new vscode.Range(0, 0, 0, 40));
119-
expect(classEdits[0].newText).toEqual("@SuppressWarnings('PMD.EmptyCatchBlock, PMD.ApexDoc')");
119+
expect(classEdits[0].newText).toEqual("@SuppressWarnings('PMD.EmptyCatchBlock,PMD.ApexDoc')");
120120
expect(codeActions[1].command.command).toEqual("sfca.removeDiagnosticsOnSelectedFile"); // TODO: This is wrong. It should only clear the PMD diagnostics within the class instead of all diagnostics within the file
121121
});
122122

0 commit comments

Comments
 (0)