Skip to content

Commit

Permalink
fix(packageRules): evaluate confidence matcher first (#23327)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Ladzaretti committed Jul 12, 2023
1 parent 9fd7485 commit bbe9697
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/util/package-rules/index.spec.ts
Expand Up @@ -716,6 +716,7 @@ describe('util/package-rules/index', () => {
const config: TestConfig = {
packageRules: [
{
matchUpdateTypes: ['major'],
matchConfidence: ['high'],
x: 1,
},
Expand Down
8 changes: 6 additions & 2 deletions lib/util/package-rules/matchers.ts
Expand Up @@ -20,7 +20,12 @@ import { UpdateTypesMatcher } from './update-types';
const matchers: MatcherApi[][] = [];
export default matchers;

// each manager under the same key will use a logical OR, if multiple matchers are applied AND will be used
// Each matcher under the same index will use a logical OR, if multiple matchers are applied AND will be used

// applyPackageRules evaluates matchers in the order of insertion and returns early on failure.
// Therefore, when multiple matchers are set in a single packageRule, some may not be checked.
// Since matchConfidence matcher can abort the run due to unauthenticated use, it should be evaluated first.
matchers.push([new MergeConfidenceMatcher()]);
matchers.push([
new DepNameMatcher(),
new DepPatternsMatcher(),
Expand All @@ -34,7 +39,6 @@ matchers.push([new BaseBranchesMatcher()]);
matchers.push([new ManagersMatcher()]);
matchers.push([new DatasourcesMatcher()]);
matchers.push([new UpdateTypesMatcher()]);
matchers.push([new MergeConfidenceMatcher()]);
matchers.push([new SourceUrlsMatcher(), new SourceUrlPrefixesMatcher()]);
matchers.push([new CurrentValueMatcher()]);
matchers.push([new CurrentVersionMatcher()]);
Expand Down

0 comments on commit bbe9697

Please sign in to comment.