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
f4f89e12
Unverified
Commit
f4f89e12
authored
2 years ago
by
RahulGautamSingh
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(manager/mix): ignore comments when extracting deps (#18479)
parent
58c9b151
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/modules/manager/mix/__fixtures__/mix.exs
+7
-3
7 additions, 3 deletions
lib/modules/manager/mix/__fixtures__/mix.exs
lib/modules/manager/mix/extract.ts
+4
-2
4 additions, 2 deletions
lib/modules/manager/mix/extract.ts
with
11 additions
and
5 deletions
lib/modules/manager/mix/__fixtures__/mix.exs
+
7
−
3
View file @
f4f89e12
...
...
@@ -16,14 +16,18 @@ defmodule MyProject.MixProject do
defp
deps
()
do
[
{
:postgrex
,
"~> 0.8.1"
},
#{:broadway_dashboard, "~> 0.2.2"},
#{:broadway_dashboard, "~> 0.2.2"},
# {:broadway_dashboard, "~> 0.2.2"},
# {:broadway_dashboard, "~> 0.2.2"},
{
:postgrex
,
"~> 0.8.1"
},
# {:broadway_dashboard, "~> 0.2.2"},
{
:ecto
,
">2.1.0 or <=3.0.0"
},
{
:cowboy
,
github:
"ninenines/cowboy"
},
{
:secret
,
"~> 1.0"
,
organization:
"acme"
},
{
:ex_doc
,
">2.1.0 and <=3.0.0"
},
{
:jason
,
">= 1.0.0"
},
{
:jason
,
"~> 1.0"
,
{
:jason
,
"~> 1.0"
,
optional:
true
},
]
end
end
\ No newline at end of file
end
This diff is collapsed.
Click to expand it.
lib/modules/manager/mix/extract.ts
+
4
−
2
View file @
f4f89e12
...
...
@@ -8,6 +8,7 @@ const depSectionRegExp = regEx(/defp\s+deps.*do/g);
const
depMatchRegExp
=
regEx
(
/{:
(?<
depName>
\w
+
)
,
\s
*
(?<
datasource>
[^
:"
]
+
)?
:
?\s
*"
(?<
currentValue>
[^
"
]
+
)
",
?\s
*
(?:
organization: "
(?<
organization>.*
)
"
)?
.*}/gm
);
const
commentMatchRegExp
=
regEx
(
/^
\s
*#/
);
export
async
function
extractPackageFile
(
content
:
string
,
...
...
@@ -15,8 +16,9 @@ export async function extractPackageFile(
):
Promise
<
PackageFile
|
null
>
{
logger
.
trace
(
'
mix.extractPackageFile()
'
);
const
deps
:
PackageDependency
[]
=
[];
const
contentArr
=
content
.
split
(
newlineRegex
);
const
contentArr
=
content
.
split
(
newlineRegex
)
.
filter
((
line
)
=>
!
commentMatchRegExp
.
test
(
line
));
for
(
let
lineNumber
=
0
;
lineNumber
<
contentArr
.
length
;
lineNumber
+=
1
)
{
if
(
contentArr
[
lineNumber
].
match
(
depSectionRegExp
))
{
logger
.
trace
(
`Matched dep section on line
${
lineNumber
}
`
);
...
...
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