Skip to content

Commit

Permalink
refactor(lookup): Versioning-related variables (#22937)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Jun 24, 2023
1 parent 444ea13 commit ad025ce
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/workers/repository/process/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,20 @@ export async function lookupUpdates(
isVulnerabilityAlert,
updatePinnedDependencies,
} = config;
let dependency: ReleaseResult | null = null;
config.versioning ??= getDefaultVersioning(datasource);

const versioning = allVersioning.get(config.versioning);
const unconstrainedValue = !!lockedVersion && is.undefined(currentValue);

let dependency: ReleaseResult | null = null;
const res: UpdateResult = {
versioning: config.versioning,
updates: [],
warnings: [],
};

try {
logger.trace({ dependency: packageName, currentValue }, 'lookupUpdates');
// Use the datasource's default versioning if none is configured
config.versioning ??= getDefaultVersioning(datasource);
const versioning = allVersioning.get(config.versioning);
res.versioning = config.versioning;
// istanbul ignore if
if (
!isGetPkgReleasesConfig(config) ||
Expand Down Expand Up @@ -369,7 +371,7 @@ export async function lookupUpdates(
if (versioning.valueToVersion) {
// TODO #7154
res.currentVersion = versioning.valueToVersion(res.currentVersion!);
for (const update of res.updates || []) {
for (const update of res.updates || /* istanbul ignore next*/ []) {
// TODO #7154
update.newVersion = versioning.valueToVersion(update.newVersion!);
}
Expand Down Expand Up @@ -440,7 +442,9 @@ export async function lookupUpdates(
// Handle a weird edge case involving followTag and fallbacks
if (rollbackPrs && followTag) {
res.updates = res.updates.filter(
(update) => res.updates.length === 1 || update.updateType !== 'rollback'
(update) =>
res.updates.length === 1 ||
/* istanbul ignore next */ update.updateType !== 'rollback'
);
}
} catch (err) /* istanbul ignore next */ {
Expand Down

0 comments on commit ad025ce

Please sign in to comment.