Skip to content

Commit

Permalink
refactor: Adjust report details for CSP
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Apr 4, 2024
1 parent bc5df42 commit 19abbf2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/linter/html/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export async function lintHtml(resourceName: string, contentStream: ReadStream):
if (scriptContent) {
report.addMessage({
node: tag,
severity: LintMessageSeverity.Error,
ruleId: "ui5-linter-csp-compliance",
message: `Use of inline javascript`,
messageDetails: "In order to avoid CSP errors, remove the usage of inline javascript",
severity: LintMessageSeverity.Warning,
ruleId: "ui5-linter-csp-unsafe-inline-script",
message: `Use of unsafe inline script`,
messageDetails: "{@link topic:fe1a6dba940e479fb7c3bc753f92b28c Content Security Policy}",
});
}
});
Expand Down
28 changes: 14 additions & 14 deletions test/lib/linter/rules/snapshots/CSPCompliance.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,39 @@ Generated by [AVA](https://avajs.dev).
[
{
coverageInfo: [],
errorCount: 3,
errorCount: 0,
fatalErrorCount: 0,
filePath: 'NoInlineJS.html',
messages: [
{
column: 2,
fatal: undefined,
line: 9,
message: 'Use of inline javascript',
messageDetails: 'In order to avoid CSP errors, remove the usage of inline javascript',
ruleId: 'ui5-linter-csp-compliance',
severity: 2,
message: 'Use of unsafe inline script',
messageDetails: 'Content Security Policy (https://ui5.sap.com/1.120/#/topic/fe1a6dba940e479fb7c3bc753f92b28c)',
ruleId: 'ui5-linter-csp-unsafe-inline-script',
severity: 1,
},
{
column: 2,
fatal: undefined,
line: 17,
message: 'Use of inline javascript',
messageDetails: 'In order to avoid CSP errors, remove the usage of inline javascript',
ruleId: 'ui5-linter-csp-compliance',
severity: 2,
message: 'Use of unsafe inline script',
messageDetails: 'Content Security Policy (https://ui5.sap.com/1.120/#/topic/fe1a6dba940e479fb7c3bc753f92b28c)',
ruleId: 'ui5-linter-csp-unsafe-inline-script',
severity: 1,
},
{
column: 2,
fatal: undefined,
line: 23,
message: 'Use of inline javascript',
messageDetails: 'In order to avoid CSP errors, remove the usage of inline javascript',
ruleId: 'ui5-linter-csp-compliance',
severity: 2,
message: 'Use of unsafe inline script',
messageDetails: 'Content Security Policy (https://ui5.sap.com/1.120/#/topic/fe1a6dba940e479fb7c3bc753f92b28c)',
ruleId: 'ui5-linter-csp-unsafe-inline-script',
severity: 1,
},
],
warningCount: 0,
warningCount: 3,
},
]

Expand Down
Binary file modified test/lib/linter/rules/snapshots/CSPCompliance.ts.snap
Binary file not shown.

0 comments on commit 19abbf2

Please sign in to comment.