Skip to content

Commit 5b30de3

Browse files
committed
Remove error codes from message to avoid dupes
ref: microsoft/vscode#62373
1 parent 287686c commit 5b30de3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

server/src/__tests__/linter.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ describe('linter', () => {
4444

4545
const expected: LSP.Diagnostic[] = [
4646
{
47-
message: 'SC2154: foo is referenced but not assigned.',
47+
message: 'foo is referenced but not assigned.',
4848
severity: 2,
4949
code: 2154,
5050
source: 'shellcheck',
5151
range: { start: { line: 1, character: 5 }, end: { line: 1, character: 9 } },
5252
},
5353
{
54-
message: 'SC2086: Double quote to prevent globbing and word splitting.',
54+
message: 'Double quote to prevent globbing and word splitting.',
5555
severity: 3,
5656
code: 2086,
5757
source: 'shellcheck',
@@ -82,8 +82,8 @@ describe('linter', () => {
8282
})
8383
// prettier-ignore
8484
const expected = [
85-
{ message: 'SC1091: Not following: shellcheck/sourced.sh: openBinaryFile: does not exist (No such file or directory)', severity: 3, code: 1091, source: 'shellcheck', range: { start: { line: 3, character: 7 }, end: { line: 3, character: 19 } }, },
86-
{ message: 'SC2154: foo is referenced but not assigned.', severity: 2, code: 2154, source: 'shellcheck', range: { start: { line: 5, character: 6 }, end: { line: 5, character: 10 } }, },
85+
{ message: 'Not following: shellcheck/sourced.sh: openBinaryFile: does not exist (No such file or directory)', severity: 3, code: 1091, source: 'shellcheck', range: { start: { line: 3, character: 7 }, end: { line: 3, character: 19 } }, },
86+
{ message: 'foo is referenced but not assigned.', severity: 2, code: 2154, source: 'shellcheck', range: { start: { line: 5, character: 6 }, end: { line: 5, character: 10 } }, },
8787
]
8888
const result = await linter.lint(FIXTURE_DOCUMENT.SHELLCHECK_SOURCE, [])
8989
expect(result).toEqual(expected)

server/src/linter.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { spawn } from 'child_process'
22
import * as LSP from 'vscode-languageserver'
33

4-
function formatMessage(comment: ShellcheckComment): string {
5-
return (comment.code ? `SC${comment.code}: ` : '') + comment.message
6-
}
7-
84
type LinterOptions = {
95
executablePath: string | null
106
console: LSP.RemoteConsole
@@ -50,7 +46,7 @@ export class Linter {
5046
}
5147

5248
diags.push({
53-
message: formatMessage(comment),
49+
message: comment.message,
5450
severity: mapSeverity(comment.level),
5551
code: comment.code,
5652
source: 'shellcheck',

0 commit comments

Comments
 (0)