Skip to content

Commit bd11188

Browse files
feat: add guideline-link to report
Signed-off-by: Fredrik Nordlander <fredrik.nordlander@digg.se>
1 parent 5a0e8bb commit bd11188

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/util/RapLPDiagnostic.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import { RapLPCustomSpectralDiagnostic } from './RapLPCustomSpectralDiagnostic.js';
66
import { RuleExecutionLog, RuleExecutionContext } from './RuleExecutionContext.js';
7+
import { buildRuleHelpUrl } from '../rulesets/util/rules-doc.config.js';
78

89
class RapLPDiagnostic {
910
private _ruleSets: DiagnosticRuleinfoSet = {
@@ -55,6 +56,7 @@ class RapLPDiagnostic {
5556
id: customProperties.id, // Store some more diagnostic info (Duplicate NOT OK)
5657
område: customProperties.område,
5758
krav: rules[key]?.message ?? '',
59+
helpUrl: customProperties.id ? buildRuleHelpUrl(customProperties.id) : undefined,
5860
});
5961
}
6062
}
@@ -68,6 +70,7 @@ class RapLPDiagnostic {
6870
id: customProperties.id, // Store some more diagnostic info (Duplicate OK)
6971
område: customProperties.område,
7072
krav:rules[key]?.message ?? '',
73+
helpUrl: customProperties.id ? buildRuleHelpUrl(customProperties.id) : undefined,
7174
});
7275
}
7376
executedRuleIds.add(customProperties.id); // Store current ID of rule with NO error
@@ -82,7 +85,12 @@ class RapLPDiagnostic {
8285
});
8386
if (!ruleIdsNotApplicable.has(customProperties.id) && !exists) {
8487
// If not present, store the id and område in the not applicableRules
85-
this._ruleSets.notApplicableRules.push({ id: customProperties.id, område: customProperties.område, krav: rules[key]?.message ?? ''}); // Rules
88+
this._ruleSets.notApplicableRules.push({
89+
id: customProperties.id,
90+
område: customProperties.område,
91+
krav: rules[key]?.message ?? '',
92+
helpUrl: customProperties.id ? buildRuleHelpUrl(customProperties.id) : undefined,
93+
}); // Rules
8694
}
8795
}
8896
}
@@ -161,6 +169,9 @@ interface DiagnosticRuleInfo {
161169
id: string;
162170
område: string;
163171
krav: string;
172+
/**Helper Url for guidelines */
173+
helpUrl?: string;
174+
164175
}
165176
interface PopulatedDiagnosticRuleInfo extends DiagnosticRuleInfo {
166177
status: string;

0 commit comments

Comments
 (0)