multicloud_rule_manager 1.1.27 → 1.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/ruleValidator.js +6 -6
package/package.json
CHANGED
package/utils/ruleValidator.js
CHANGED
|
@@ -81,20 +81,20 @@ function hasValidWhenThenBlock(content, fileName) {
|
|
|
81
81
|
const matches = content.match(regex);
|
|
82
82
|
|
|
83
83
|
if (!matches || matches.length === 0) {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
return { valid: false, message: `❌ Il file ${fileName} deve contenere un blocco "when {} then {}"`};
|
|
85
|
+
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (matches.length > 1) {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
return { valid: false, message: `❌ Il file ${fileName} contiene più blocchi "when {} then {}", è consentito solo uno`};
|
|
90
|
+
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// opzionale: controlla se ci sono altre parole 'when' o 'then' nel file fuori dal blocco principale
|
|
94
94
|
const cleaned = content.replace(regex, ''); // rimuove il blocco valido
|
|
95
95
|
if (/when|then/.test(cleaned)) {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
return { valid: false, message: `❌ Il file ${fileName} contiene 'when' o 'then' extra fuori dal blocco principale`};
|
|
97
|
+
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
return true;
|