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
f6b43850
Commit
f6b43850
authored
4 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
refactor: simplified lookup buckets
parent
2a4875b2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/workers/repository/process/lookup/index.ts
+13
-21
13 additions, 21 deletions
lib/workers/repository/process/lookup/index.ts
with
13 additions
and
21 deletions
lib/workers/repository/process/lookup/index.ts
+
13
−
21
View file @
f6b43850
...
@@ -302,8 +302,7 @@ export async function lookupUpdates(
...
@@ -302,8 +302,7 @@ export async function lookupUpdates(
if
(
vulnerabilityAlert
)
{
if
(
vulnerabilityAlert
)
{
filteredVersions
=
filteredVersions
.
slice
(
0
,
1
);
filteredVersions
=
filteredVersions
.
slice
(
0
,
1
);
}
}
const
buckets
:
Record
<
string
,
LookupUpdate
>
=
{};
const
buckets
:
Record
<
string
,
[
LookupUpdate
]
>
=
{};
const
allBucketUpdates
:
Record
<
string
,
[
LookupUpdate
]
>
=
{};
for
(
const
toVersion
of
filteredVersions
.
map
((
v
)
=>
v
.
version
))
{
for
(
const
toVersion
of
filteredVersions
.
map
((
v
)
=>
v
.
version
))
{
const
update
:
LookupUpdate
=
{
fromVersion
,
toVersion
}
as
any
;
const
update
:
LookupUpdate
=
{
fromVersion
,
toVersion
}
as
any
;
try
{
try
{
...
@@ -363,30 +362,23 @@ export async function lookupUpdates(
...
@@ -363,30 +362,23 @@ export async function lookupUpdates(
const
bucket
=
getBucket
(
config
,
update
);
const
bucket
=
getBucket
(
config
,
update
);
if
(
buckets
[
bucket
])
{
if
(
buckets
[
bucket
])
{
if
(
buckets
[
bucket
].
push
(
update
);
version
.
isGreaterThan
(
update
.
toVersion
,
buckets
[
bucket
].
toVersion
)
)
{
buckets
[
bucket
]
=
update
;
}
}
else
{
buckets
[
bucket
]
=
update
;
}
if
(
allBucketUpdates
[
bucket
])
{
allBucketUpdates
[
bucket
].
push
(
update
);
}
else
{
}
else
{
allB
ucket
Update
s
[
bucket
]
=
[
update
];
b
uckets
[
bucket
]
=
[
update
];
}
}
}
}
for
(
const
[
bucket
,
update
]
of
Object
.
entries
(
buckets
))
{
for
(
const
updates
of
Object
.
values
(
buckets
))
{
update
.
skippedOverVersions
=
allBucketUpdates
[
bucket
]
const
sortedUpdates
=
updates
.
sort
((
u1
,
u2
)
=>
.
map
((
u
)
=>
u
.
toVersion
)
version
.
sortVersions
(
u1
.
toVersion
,
u2
.
toVersion
)
.
filter
((
u
)
=>
u
!==
update
.
toVersion
)
);
.
sort
((
v1
,
v2
)
=>
version
.
sortVersions
(
v1
,
v2
));
const
highestUpdate
=
sortedUpdates
.
pop
();
if
(
update
.
skippedOverVersions
.
length
===
0
)
{
if
(
sortedUpdates
.
length
)
{
delete
update
.
skippedOverVersions
;
highestUpdate
.
skippedOverVersions
=
sortedUpdates
.
map
(
(
u
)
=>
u
.
toVersion
);
}
}
res
.
updates
.
push
(
highestUpdate
);
}
}
res
.
updates
=
res
.
updates
.
concat
(
Object
.
values
(
buckets
));
}
else
if
(
!
currentValue
)
{
}
else
if
(
!
currentValue
)
{
res
.
skipReason
=
SkipReason
.
UnsupportedValue
;
res
.
skipReason
=
SkipReason
.
UnsupportedValue
;
}
else
{
}
else
{
...
...
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