multicloud_rule_manager 1.1.7 → 1.1.8
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 +5 -5
package/package.json
CHANGED
package/utils/ruleValidator.js
CHANGED
|
@@ -36,7 +36,7 @@ export function validateRule(fileName, content) {
|
|
|
36
36
|
if (char === "{") stack.push("{");
|
|
37
37
|
if (char === "}") {
|
|
38
38
|
if (stack.length === 0) {
|
|
39
|
-
console.error(`❌ Parentesi graffe non bilanciate in ${
|
|
39
|
+
console.error(`❌ Parentesi graffe non bilanciate in ${fileName} riga ${i+1}`);
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
42
|
stack.pop();
|
|
@@ -47,18 +47,18 @@ export function validateRule(fileName, content) {
|
|
|
47
47
|
const singleQuotes = (line.match(/'/g) || []).length;
|
|
48
48
|
const doubleQuotes = (line.match(/"/g) || []).length;
|
|
49
49
|
if (singleQuotes % 2 !== 0 || doubleQuotes % 2 !== 0) {
|
|
50
|
-
console.error(`❌ Apici non bilanciati in ${
|
|
50
|
+
console.error(`❌ Apici non bilanciati in ${fileName} riga ${i+1}`);
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (!hasWhen || !hasThen) {
|
|
56
|
-
console.error(`❌ Il file ${
|
|
56
|
+
console.error(`❌ Il file ${fileName} deve contenere un blocco "when {} then {}"`);
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
if (stack.length > 0) {
|
|
61
|
-
console.error(`❌ Parentesi graffe aperte non chiuse in ${
|
|
61
|
+
console.error(`❌ Parentesi graffe aperte non chiuse in ${fileName}`);
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -66,7 +66,7 @@ export function validateRule(fileName, content) {
|
|
|
66
66
|
try {
|
|
67
67
|
if (thenCode.trim()) esprima.parseScript(thenCode, { tolerant: true });
|
|
68
68
|
} catch (err) {
|
|
69
|
-
console.error(`❌ Errore sintassi JS in ${
|
|
69
|
+
console.error(`❌ Errore sintassi JS in ${fileName}: ${err.message}`);
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
72
|
|