Skip to content

Commit

Permalink
chore(rules): avoid passing unnecessary info into afters (#4049)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers authored Jun 27, 2023
1 parent 16c5cfa commit ab4879c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/core/base/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ Rule.prototype.after = function after(result, options) {
var ruleID = this.id;
afterChecks.forEach(check => {
var beforeResults = findCheckResults(result.nodes, check.id);
var option = getCheckOption(check, ruleID, options);
var checkOption = getCheckOption(check, ruleID, options);

var afterResults = check.after(beforeResults, option);
var afterResults = check.after(beforeResults, checkOption.options);

if (this.reviewOnFail) {
afterResults.forEach(checkResult => {
Expand Down
6 changes: 1 addition & 5 deletions test/core/base/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -1483,11 +1483,7 @@ describe('Rule', function () {
id: 'cats',
enabled: true,
after: function (results, options) {
assert.deepEqual(options, {
enabled: true,
options: { dogs: true },
absolutePaths: undefined
});
assert.deepEqual(options, { dogs: true });
success = true;
return results;
}
Expand Down

0 comments on commit ab4879c

Please sign in to comment.