Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
a9c37258
Unverified
Commit
a9c37258
authored
1 year ago
by
Sebastian Poxhofer
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(packageRules/package-patterns): consider depName for exclude (#27046)
parent
c479b213
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/util/package-rules/package-patterns.spec.ts
+15
-0
15 additions, 0 deletions
lib/util/package-rules/package-patterns.spec.ts
lib/util/package-rules/package-patterns.ts
+18
-10
18 additions, 10 deletions
lib/util/package-rules/package-patterns.ts
with
33 additions
and
10 deletions
lib/util/package-rules/package-patterns.spec.ts
+
15
−
0
View file @
a9c37258
...
@@ -42,4 +42,19 @@ describe('util/package-rules/package-patterns', () => {
...
@@ -42,4 +42,19 @@ describe('util/package-rules/package-patterns', () => {
expect
(
result
).
toBeTrue
();
expect
(
result
).
toBeTrue
();
});
});
});
});
describe
(
'
exclude
'
,
()
=>
{
it
(
'
should exclude packageName
'
,
()
=>
{
const
result
=
packageNameMatcher
.
excludes
(
{
depName
:
'
abc
'
,
packageName
:
'
def
'
,
},
{
excludePackagePatterns
:
[
'
def
'
],
},
);
expect
(
result
).
toBeTrue
();
});
});
});
});
This diff is collapsed.
Click to expand it.
lib/util/package-rules/package-patterns.ts
+
18
−
10
View file @
a9c37258
...
@@ -50,9 +50,10 @@ export class PackagePatternsMatcher extends Matcher {
...
@@ -50,9 +50,10 @@ export class PackagePatternsMatcher extends Matcher {
}
}
override
excludes
(
override
excludes
(
{
depName
}:
PackageRuleInputConfig
,
{
depName
,
packageName
}:
PackageRuleInputConfig
,
{
excludePackagePatterns
}
:
PackageRule
,
packageRule
:
PackageRule
,
):
boolean
|
null
{
):
boolean
|
null
{
const
{
excludePackagePatterns
}
=
packageRule
;
// ignore lockFileMaintenance for backwards compatibility
// ignore lockFileMaintenance for backwards compatibility
if
(
is
.
undefined
(
excludePackagePatterns
))
{
if
(
is
.
undefined
(
excludePackagePatterns
))
{
return
null
;
return
null
;
...
@@ -61,15 +62,22 @@ export class PackagePatternsMatcher extends Matcher {
...
@@ -61,15 +62,22 @@ export class PackagePatternsMatcher extends Matcher {
return
false
;
return
false
;
}
}
let
isMatch
=
false
;
if
(
for
(
const
pattern
of
excludePackagePatterns
)
{
is
.
string
(
packageName
)
&&
const
packageRegex
=
regEx
(
massagePattern
(
pattern
));
matchPatternsAgainstName
(
excludePackagePatterns
,
packageName
)
if
(
packageRegex
.
test
(
depName
))
{
)
{
logger
.
trace
(
`
${
depName
}
matches against
${
String
(
packageRegex
)}
`
);
return
true
;
isMatch
=
true
;
}
}
if
(
matchPatternsAgainstName
(
excludePackagePatterns
,
depName
))
{
logger
.
once
.
info
(
{
packageRule
,
packageName
,
depName
},
'
Use excludeDepPatterns instead of excludePackagePatterns
'
,
);
return
true
;
}
}
return
isMatch
;
return
false
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment