Skip to content

Commit e73da48

Browse files
fix: minor refinement
1 parent fcc8d50 commit e73da48

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tools/spectral/ipa/rulesets/functions/utils/collectionUtils.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { EXCEPTION_EXTENSION, hasException } from './exceptions.js';
66
* If the object is violating the rule, but has an exception, the validation error is ignored
77
* If the object is adopting the rule, but has an exception, a validation error will be returned
88
*
9-
* @param validationErrors the error results from the rule
10-
* @param ruleName the name of the rule
11-
* @param object the object evaluated for the rule, should contain an exception object if an exception is needed
12-
* @param objectPath the JSON path to the object
9+
* @param {Array<{path: Array<string>, message: string}>} validationErrors the error results from the rule
10+
* @param {string} ruleName the name of the rule
11+
* @param {*} object the object evaluated for the rule, should contain an exception object if an exception is needed
12+
* @param {Array<string>} objectPath the JSON path to the object
1313
* @returns {Array<{path: Array<string>, message: string}>|undefined} an array of the validation errors, or undefined if there are no errors
1414
*/
1515
export function collectExceptionAdoptionViolations(validationErrors, ruleName, object, objectPath) {
@@ -21,12 +21,12 @@ export function collectExceptionAdoptionViolations(validationErrors, ruleName, o
2121
return collectAndReturnViolation(objectPath, ruleName, validationErrors);
2222
}
2323
if (hasException(object, ruleName)) {
24-
const error = {
25-
path: [...objectPath, EXCEPTION_EXTENSION, ruleName],
26-
message: 'This component adopts the rule and does not need an exception. Please remove the exception.',
27-
};
28-
validationErrors.push(error);
29-
return collectAndReturnViolation(objectPath, ruleName, [error]);
24+
return collectAndReturnViolation(objectPath, ruleName, [
25+
{
26+
path: [...objectPath, EXCEPTION_EXTENSION, ruleName],
27+
message: 'This component adopts the rule and does not need an exception. Please remove the exception.',
28+
},
29+
]);
3030
}
3131
collectAdoption(objectPath, ruleName);
3232
}
@@ -35,9 +35,9 @@ export function collectExceptionAdoptionViolations(validationErrors, ruleName, o
3535
* Evaluates and collects adoptions and violations based on the rule, evaluated object and the validation errors.
3636
* No exceptions are allowed.
3737
*
38-
* @param validationErrors the error results from the rule
39-
* @param ruleName the name of the rule
40-
* @param objectPath the JSON path to the object
38+
* @param {Array<{path: Array<string>, message: string}>} validationErrors the error results from the rule
39+
* @param {string} ruleName the name of the rule
40+
* @param {Array<string>} objectPath the JSON path to the object
4141
* @returns {Array<{path: Array<string>, message: string}>|undefined} an array of the validation errors, or undefined if there are no errors
4242
*/
4343
export function collectAdoptionViolations(validationErrors, ruleName, objectPath) {

0 commit comments

Comments
 (0)