Skip to content

Commit

Permalink
fix: optimize type checks (#34654)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Mar 6, 2025
1 parent d300cd0 commit b9484f1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/config/migrations/custom/rebase-stale-prs-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class RebaseStalePrsMigration extends AbstractMigration {
);
}

if (is.null_(value)) {
if (null === value) {
this.setSafely('rebaseWhen', 'auto');
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/config/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export async function validateConfig(
});
}
if (
!(is.string(statusCheckValue) || is.null_(statusCheckValue))
!(is.string(statusCheckValue) || null === statusCheckValue)
) {
errors.push({
topic: 'Configuration Error',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/bundler/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function updateArtifacts(
return null;
}

const updatedDepNames = updatedDeps
const updatedDepNames: string[] = updatedDeps
.map(({ depName }) => depName)
.filter(is.nonEmptyStringAndNotWhitespace);

Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/mise/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function parseVersion(toolData: MiseToolSchema): string | null {
// e.g. 'erlang = ["23.3", "24.0"]'
return toolData.length ? toolData[0] : null; // Get the first version in the array
}
if (is.nonEmptyString(toolData.version)) {
if (is.object(toolData) && is.nonEmptyString(toolData.version)) {
// Handle the object case with a string version
// e.g. 'python = { version = "3.11.2" }'
return toolData.version;
Expand Down
4 changes: 3 additions & 1 deletion lib/workers/repository/onboarding/pr/config-description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export function getScheduleDesc(config: RenovateConfig): string[] {
function getDescriptionArray(config: RenovateConfig): string[] {
logger.debug('getDescriptionArray()');
logger.trace({ config });
const desc = is.nonEmptyArray(config.description) ? config.description : [];
const desc = is.array(config.description, is.string)
? config.description
: [];
return desc.concat(getScheduleDesc(config));
}

Expand Down

0 comments on commit b9484f1

Please sign in to comment.