@@ -18,25 +18,27 @@ class RapLPDiagnostic {
1818 constructor ( private context : RuleExecutionContext ) { }
1919 processRuleExecutionInformation (
2020 raplpCustomResult : RapLPCustomSpectralDiagnostic [ ] ,
21+ rules : Record < string , any > ,
2122 instanceCategoryMap : Map < string , any > ,
2223 ) : void {
23- this . processRuleExecutionLog ( this . context . ruleExecutionLogDictionary , raplpCustomResult , instanceCategoryMap ) ;
24+ this . processRuleExecutionLog ( this . context . ruleExecutionLogDictionary , raplpCustomResult , instanceCategoryMap , rules ) ;
2425 }
2526 private processRuleExecutionLog (
2627 log : RuleExecutionLog ,
2728 spectralResults : RapLPCustomSpectralDiagnostic [ ] ,
2829 instanceCategoryMap : Map < string , any > ,
30+ rules : Record < string , any > ,
2931 ) {
3032 let executedRuleIds = new Set < string > ( ) ; // Set to track executed rule IDs
3133 let executedRuleIdsWithError = new Set < string > ( ) ; // Set to track executed rule IDs with error
3234 let ruleIdsNotApplicable = new Set < string > ( ) ; // Set to track rules that are not applicable, that is the (Δ) between the two above sets
33-
35+ const ruleIdToMessage = new Map < string , string > ( ) ;
36+
3437 for ( const key in log ) {
3538 const rules = log [ key ] ;
3639 const { moduleName, className } = rules [ 0 ] ; // Get module and class name from the first entry
37-
3840 //console.log(`Rule execution status for ${moduleName}:${className}:`);
39-
41+
4042 rules . forEach ( ( rule ) => {
4143 const { customProperties, severity, passed, targetVal } = rule ;
4244 const status = passed ? 'PASSED' : 'FAILED' ;
@@ -52,6 +54,7 @@ class RapLPDiagnostic {
5254 this . _ruleSets . executedUniqueRulesWithError . push ( {
5355 id : customProperties . id , // Store some more diagnostic info (Duplicate NOT OK)
5456 område : customProperties . område ,
57+ krav : rules [ key ] ?. message ?? '' ,
5558 } ) ;
5659 }
5760 }
@@ -64,6 +67,7 @@ class RapLPDiagnostic {
6467 this . _ruleSets . executedUniqueRules . push ( {
6568 id : customProperties . id , // Store some more diagnostic info (Duplicate OK)
6669 område : customProperties . område ,
70+ krav :rules [ key ] ?. message ?? '' ,
6771 } ) ;
6872 }
6973 executedRuleIds . add ( customProperties . id ) ; // Store current ID of rule with NO error
@@ -78,7 +82,7 @@ class RapLPDiagnostic {
7882 } ) ;
7983 if ( ! ruleIdsNotApplicable . has ( customProperties . id ) && ! exists ) {
8084 // If not present, store the id and område in the not applicableRules
81- this . _ruleSets . notApplicableRules . push ( { id : customProperties . id , område : customProperties . område } ) ; // Rules
85+ this . _ruleSets . notApplicableRules . push ( { id : customProperties . id , område : customProperties . område , krav : rules [ key ] ?. message ?? '' } ) ; // Rules
8286 }
8387 }
8488 }
@@ -94,7 +98,7 @@ class RapLPDiagnostic {
9498 'N/A' ,
9599 'Godkända regler - RAP-LP' ,
96100 ) ,
97- ) ;
101+ ) ;
98102 }
99103 if (
100104 this . diagnosticInformation . executedUniqueRulesWithError &&
@@ -156,6 +160,7 @@ interface DiagnosticRuleinfoSet {
156160interface DiagnosticRuleInfo {
157161 id : string ;
158162 område : string ;
163+ krav : string ;
159164}
160165interface PopulatedDiagnosticRuleInfo extends DiagnosticRuleInfo {
161166 status : string ;
0 commit comments