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
776d3622
Commit
776d3622
authored
5 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
fix(cocoapods): add null checks for out of bound lines
Closes #5857, Closes #5858
parent
e62cbff9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/manager/cocoapods/extract.ts
+3
-0
3 additions, 0 deletions
lib/manager/cocoapods/extract.ts
lib/manager/cocoapods/update.spec.ts
+10
-0
10 additions, 0 deletions
lib/manager/cocoapods/update.spec.ts
lib/manager/cocoapods/update.ts
+8
-0
8 additions, 0 deletions
lib/manager/cocoapods/update.ts
with
21 additions
and
0 deletions
lib/manager/cocoapods/extract.ts
+
3
−
0
View file @
776d3622
...
@@ -27,6 +27,9 @@ export interface ParsedLine {
...
@@ -27,6 +27,9 @@ export interface ParsedLine {
export
function
parseLine
(
line
:
string
):
ParsedLine
{
export
function
parseLine
(
line
:
string
):
ParsedLine
{
const
result
:
ParsedLine
=
{};
const
result
:
ParsedLine
=
{};
if
(
!
line
)
{
return
result
;
}
for
(
const
regex
of
Object
.
values
(
regexMappings
))
{
for
(
const
regex
of
Object
.
values
(
regexMappings
))
{
const
match
=
regex
.
exec
(
line
.
replace
(
/#.*$/
,
''
));
const
match
=
regex
.
exec
(
line
.
replace
(
/#.*$/
,
''
));
if
(
match
&&
match
.
groups
)
{
if
(
match
&&
match
.
groups
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/manager/cocoapods/update.spec.ts
+
10
−
0
View file @
776d3622
...
@@ -9,6 +9,16 @@ const fileContent = fs.readFileSync(
...
@@ -9,6 +9,16 @@ const fileContent = fs.readFileSync(
describe
(
'
lib/manager/cocoapods/update
'
,
()
=>
{
describe
(
'
lib/manager/cocoapods/update
'
,
()
=>
{
describe
(
'
updateDependency
'
,
()
=>
{
describe
(
'
updateDependency
'
,
()
=>
{
it
(
'
handles undefined lines
'
,
()
=>
{
const
upgrade
=
{
depName
:
'
b
'
,
managerData
:
{
lineNumber
:
999999999
},
currentValue
:
'
1.2.3
'
,
newValue
:
'
2.0.0
'
,
};
const
res
=
updateDependency
({
fileContent
,
upgrade
});
expect
(
res
).
toBeNull
();
});
it
(
'
replaces existing value
'
,
()
=>
{
it
(
'
replaces existing value
'
,
()
=>
{
const
upgrade
=
{
const
upgrade
=
{
depName
:
'
b
'
,
depName
:
'
b
'
,
...
...
This diff is collapsed.
Click to expand it.
lib/manager/cocoapods/update.ts
+
8
−
0
View file @
776d3622
...
@@ -24,6 +24,14 @@ export function updateDependency({
...
@@ -24,6 +24,14 @@ export function updateDependency({
const
lines
=
fileContent
.
split
(
'
\n
'
);
const
lines
=
fileContent
.
split
(
'
\n
'
);
const
lineToChange
=
lines
[
managerData
.
lineNumber
];
const
lineToChange
=
lines
[
managerData
.
lineNumber
];
if
(
!
lineToChange
)
{
logger
.
warn
(
{
fileContent
,
depName
,
currentValue
,
newValue
},
'
Undefined cocoapods lineToChange
'
);
return
null
;
}
if
(
!
lineContainsDep
(
lineToChange
,
depName
))
{
if
(
!
lineContainsDep
(
lineToChange
,
depName
))
{
return
null
;
return
null
;
}
}
...
...
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