refactor: Use union type for SkipReason (#13702)

* refactor: Use union type for SkipReason

* Fix snapshot

* Fix snapshot
This commit is contained in:
Sergei Zharinov 2022-01-21 10:59:36 +03:00 committed by GitHub
parent 0c4d8c7180
commit 4f18d76320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 190 additions and 229 deletions

View file

@ -1,7 +1,6 @@
import { GalaxyCollectionDatasource } from '../../datasource/galaxy-collection'; import { GalaxyCollectionDatasource } from '../../datasource/galaxy-collection';
import { GitTagsDatasource } from '../../datasource/git-tags'; import { GitTagsDatasource } from '../../datasource/git-tags';
import * as datasourceGithubTags from '../../datasource/github-tags'; import * as datasourceGithubTags from '../../datasource/github-tags';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { import {
@ -40,7 +39,7 @@ function interpretLine(
} }
default: { default: {
// fail if we find an unexpected key // fail if we find an unexpected key
localDependency.skipReason = SkipReason.Unsupported; localDependency.skipReason = 'unsupported';
} }
} }
} }
@ -100,7 +99,7 @@ function finalize(dependency: PackageDependency): boolean {
handleGitDep(dep, nameMatch); handleGitDep(dep, nameMatch);
break; break;
case 'file': case 'file':
dep.skipReason = SkipReason.LocalDependency; dep.skipReason = 'local-dependency';
break; break;
case null: case null:
// try to find out type based on source // try to find out type based on source
@ -113,15 +112,15 @@ function finalize(dependency: PackageDependency): boolean {
dep.depName = dep.managerData.name; dep.depName = dep.managerData.name;
break; break;
} }
dep.skipReason = SkipReason.NoSourceMatch; dep.skipReason = 'no-source-match';
break; break;
default: default:
dep.skipReason = SkipReason.Unsupported; dep.skipReason = 'unsupported';
return true; return true;
} }
if (!dependency.currentValue && !dep.skipReason) { if (!dependency.currentValue && !dep.skipReason) {
dep.skipReason = SkipReason.NoVersion; dep.skipReason = 'no-version';
} }
return true; return true;
} }

View file

@ -1,6 +1,5 @@
import { GalaxyDatasource } from '../../datasource/galaxy'; import { GalaxyDatasource } from '../../datasource/galaxy';
import { GitTagsDatasource } from '../../datasource/git-tags'; import { GitTagsDatasource } from '../../datasource/git-tags';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { import {
@ -47,7 +46,7 @@ function interpretLine(
function finalize(dependency: PackageDependency): boolean { function finalize(dependency: PackageDependency): boolean {
const dep = dependency; const dep = dependency;
if (dependency.managerData.version === null) { if (dependency.managerData.version === null) {
dep.skipReason = SkipReason.NoVersion; dep.skipReason = 'no-version';
return false; return false;
} }
@ -67,7 +66,7 @@ function finalize(dependency: PackageDependency): boolean {
dep.depName = dep.managerData.name; dep.depName = dep.managerData.name;
dep.lookupName = dep.managerData.name; dep.lookupName = dep.managerData.name;
} else { } else {
dep.skipReason = SkipReason.NoSourceMatch; dep.skipReason = 'no-source-match';
return false; return false;
} }
if (dep.managerData.name !== null) { if (dep.managerData.name !== null) {

View file

@ -7,7 +7,6 @@ import * as datasourceGithubReleases from '../../datasource/github-releases';
import * as datasourceGithubTags from '../../datasource/github-tags'; import * as datasourceGithubTags from '../../datasource/github-tags';
import * as datasourceGo from '../../datasource/go'; import * as datasourceGo from '../../datasource/go';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import * as dockerVersioning from '../../versioning/docker'; import * as dockerVersioning from '../../versioning/docker';
import type { PackageDependency, PackageFile } from '../types'; import type { PackageDependency, PackageFile } from '../types';
@ -263,7 +262,7 @@ export function extractPackageFile(
if (remoteMatch && remoteMatch[0].length === remote.length) { if (remoteMatch && remoteMatch[0].length === remote.length) {
dep.lookupName = remote.replace('https://', ''); dep.lookupName = remote.replace('https://', '');
} else { } else {
dep.skipReason = SkipReason.UnsupportedRemote; dep.skipReason = 'unsupported-remote';
} }
} }
if (commit) { if (commit) {

View file

@ -62,14 +62,14 @@ export function extractPackageFile(content: string): PackageFile | null {
{ dependency: depName }, { dependency: depName },
'Something is wrong with buildkite plugin name' 'Something is wrong with buildkite plugin name'
); );
skipReason = SkipReason.InvalidDependencySpecification; skipReason = 'invalid-dependency-specification';
} }
} else { } else {
logger.debug( logger.debug(
{ currentValue }, { currentValue },
'Skipping non-pinned current version' 'Skipping non-pinned current version'
); );
skipReason = SkipReason.InvalidVersion; skipReason = 'invalid-version';
} }
const dep: PackageDependency = { const dep: PackageDependency = {
depName, depName,

View file

@ -1,7 +1,6 @@
import moo from 'moo'; import moo from 'moo';
import { ProgrammingLanguage } from '../../constants'; import { ProgrammingLanguage } from '../../constants';
import { id as datasource } from '../../datasource/nuget'; import { id as datasource } from '../../datasource/nuget';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import { PackageDependency, PackageFile } from '../types'; import { PackageDependency, PackageFile } from '../types';
@ -43,7 +42,7 @@ function parseDependencyLine(line: string): PackageDependency | null {
if (protocol.startsWith('http')) { if (protocol.startsWith('http')) {
result.registryUrls = [registryUrl]; result.registryUrls = [registryUrl];
} else { } else {
result.skipReason = SkipReason.UnsupportedUrl; result.skipReason = 'unsupported-url';
} }
} }

View file

@ -45,24 +45,24 @@ function extractFromSection(
if (registryUrl) { if (registryUrl) {
registryUrls = [registryUrl]; registryUrls = [registryUrl];
} else { } else {
skipReason = SkipReason.UnknownRegistry; skipReason = 'unknown-registry';
} }
} }
if (path) { if (path) {
skipReason = SkipReason.PathDependency; skipReason = 'path-dependency';
} }
if (git) { if (git) {
skipReason = SkipReason.GitDependency; skipReason = 'git-dependency';
} }
} else if (path) { } else if (path) {
currentValue = ''; currentValue = '';
skipReason = SkipReason.PathDependency; skipReason = 'path-dependency';
} else if (git) { } else if (git) {
currentValue = ''; currentValue = '';
skipReason = SkipReason.GitDependency; skipReason = 'git-dependency';
} else { } else {
currentValue = ''; currentValue = '';
skipReason = SkipReason.InvalidDependencySpecification; skipReason = 'invalid-dependency-specification';
} }
} }
const dep: PackageDependency = { const dep: PackageDependency = {

View file

@ -3,7 +3,6 @@ import * as datasourceGithubTags from '../../datasource/github-tags';
import * as datasourceGitlabTags from '../../datasource/gitlab-tags'; import * as datasourceGitlabTags from '../../datasource/gitlab-tags';
import * as datasourcePod from '../../datasource/pod'; import * as datasourcePod from '../../datasource/pod';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { getSiblingFileName, localPathExists } from '../../util/fs'; import { getSiblingFileName, localPathExists } from '../../util/fs';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency, PackageFile } from '../types'; import type { PackageDependency, PackageFile } from '../types';
@ -113,7 +112,7 @@ export async function extractPackageFile(
let dep: PackageDependency = { let dep: PackageDependency = {
depName, depName,
groupName, groupName,
skipReason: SkipReason.UnknownVersion, skipReason: 'unknown-version',
}; };
if (currentValue) { if (currentValue) {
@ -132,14 +131,14 @@ export async function extractPackageFile(
dep = { dep = {
depName, depName,
groupName, groupName,
skipReason: SkipReason.GitDependency, skipReason: 'git-dependency',
}; };
} }
} else if (path) { } else if (path) {
dep = { dep = {
depName, depName,
groupName, groupName,
skipReason: SkipReason.PathDependency, skipReason: 'path-dependency',
}; };
} }

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { GitTagsDatasource } from '../../datasource/git-tags'; import { GitTagsDatasource } from '../../datasource/git-tags';
import * as datasourcePackagist from '../../datasource/packagist'; import * as datasourcePackagist from '../../datasource/packagist';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { readLocalFile } from '../../util/fs'; import { readLocalFile } from '../../util/fs';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import { api as semverComposer } from '../../versioning/composer'; import { api as semverComposer } from '../../versioning/composer';
@ -148,7 +147,7 @@ export async function extractPackageFile(
dep.lookupName = lookupName; dep.lookupName = lookupName;
} }
if (!depName.includes('/')) { if (!depName.includes('/')) {
dep.skipReason = SkipReason.Unsupported; dep.skipReason = 'unsupported';
} }
if (lockParsed) { if (lockParsed) {
const lockField = const lockField =

View file

@ -1,7 +1,6 @@
import is from '@sindresorhus/is'; import is from '@sindresorhus/is';
import * as datasourceDocker from '../../datasource/docker'; import * as datasourceDocker from '../../datasource/docker';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import * as ubuntuVersioning from '../../versioning/ubuntu'; import * as ubuntuVersioning from '../../versioning/ubuntu';
import type { PackageDependency, PackageFile } from '../types'; import type { PackageDependency, PackageFile } from '../types';
@ -29,7 +28,7 @@ export function splitImageParts(currentFrom: string): PackageDependency {
currentFrom.indexOf(variableDefaultValueSplit) === -1 currentFrom.indexOf(variableDefaultValueSplit) === -1
) { ) {
return { return {
skipReason: SkipReason.ContainsVariable, skipReason: 'contains-variable',
}; };
} }
@ -60,7 +59,7 @@ export function splitImageParts(currentFrom: string): PackageDependency {
if (currentValue && currentValue.indexOf(variableMarker) !== -1) { if (currentValue && currentValue.indexOf(variableMarker) !== -1) {
// If tag contains a variable, e.g. "5.0${VERSION_SUFFIX}", we do not support this. // If tag contains a variable, e.g. "5.0${VERSION_SUFFIX}", we do not support this.
return { return {
skipReason: SkipReason.ContainsVariable, skipReason: 'contains-variable',
}; };
} }
@ -102,7 +101,7 @@ export function getDep(
): PackageDependency { ): PackageDependency {
if (!is.string(currentFrom)) { if (!is.string(currentFrom)) {
return { return {
skipReason: SkipReason.InvalidValue, skipReason: 'invalid-value',
}; };
} }
const dep = splitImageParts(currentFrom); const dep = splitImageParts(currentFrom);

View file

@ -1,7 +1,6 @@
import { loadFixture } from '../../../test/util'; import { loadFixture } from '../../../test/util';
import { GlobalConfig } from '../../config/global'; import { GlobalConfig } from '../../config/global';
import type { RepoGlobalConfig } from '../../config/types'; import type { RepoGlobalConfig } from '../../config/types';
import { SkipReason } from '../../types';
import type { ExtractConfig } from '../types'; import type { ExtractConfig } from '../types';
import { extractAllPackageFiles, extractPackageFile } from '.'; import { extractAllPackageFiles, extractPackageFile } from '.';
@ -29,7 +28,7 @@ describe('manager/flux/extract', () => {
}); });
it('extracts releases without repositories', () => { it('extracts releases without repositories', () => {
const result = extractPackageFile(loadFixture('release.yaml')); const result = extractPackageFile(loadFixture('release.yaml'));
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('ignores HelmRelease resources without an apiVersion', () => { it('ignores HelmRelease resources without an apiVersion', () => {
const result = extractPackageFile('kind: HelmRelease'); const result = extractPackageFile('kind: HelmRelease');
@ -47,7 +46,7 @@ apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository kind: HelmRepository
` `
); );
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('ignores HelmRelease resources without a chart name', () => { it('ignores HelmRelease resources without a chart name', () => {
const result = extractPackageFile( const result = extractPackageFile(
@ -88,7 +87,7 @@ spec:
version: "2.0.2" version: "2.0.2"
` `
); );
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('does not match HelmRelease resources without a sourceRef', () => { it('does not match HelmRelease resources without a sourceRef', () => {
const result = extractPackageFile( const result = extractPackageFile(
@ -105,7 +104,7 @@ spec:
version: "2.0.2" version: "2.0.2"
` `
); );
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('does not match HelmRelease resources without a namespace', () => { it('does not match HelmRelease resources without a namespace', () => {
const result = extractPackageFile( const result = extractPackageFile(
@ -123,7 +122,7 @@ spec:
version: "2.0.2" version: "2.0.2"
` `
); );
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('ignores HelmRepository resources without a namespace', () => { it('ignores HelmRepository resources without a namespace', () => {
const result = extractPackageFile( const result = extractPackageFile(
@ -135,7 +134,7 @@ metadata:
name: test name: test
` `
); );
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('ignores HelmRepository resources without a URL', () => { it('ignores HelmRepository resources without a URL', () => {
const result = extractPackageFile( const result = extractPackageFile(
@ -148,7 +147,7 @@ metadata:
namespace: kube-system namespace: kube-system
` `
); );
expect(result.deps[0].skipReason).toBe(SkipReason.UnknownRegistry); expect(result.deps[0].skipReason).toBe('unknown-registry');
}); });
it('ignores resources of an unknown kind', () => { it('ignores resources of an unknown kind', () => {
const result = extractPackageFile( const result = extractPackageFile(

View file

@ -1,7 +1,6 @@
import { loadAll } from 'js-yaml'; import { loadAll } from 'js-yaml';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { readLocalFile } from '../../util/fs'; import { readLocalFile } from '../../util/fs';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
import type { import type {
@ -69,7 +68,7 @@ function resolveReleases(
if (matchingRepositories.length) { if (matchingRepositories.length) {
res.registryUrls = matchingRepositories.map((repo) => repo.spec.url); res.registryUrls = matchingRepositories.map((repo) => repo.spec.url);
} else { } else {
res.skipReason = SkipReason.UnknownRegistry; res.skipReason = 'unknown-registry';
} }
return res; return res;

View file

@ -1,6 +1,5 @@
import * as githubTagsDatasource from '../../datasource/github-tags'; import * as githubTagsDatasource from '../../datasource/github-tags';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import * as dockerVersioning from '../../versioning/docker'; import * as dockerVersioning from '../../versioning/docker';
import { getDep } from '../dockerfile/extract'; import { getDep } from '../dockerfile/extract';
@ -56,7 +55,7 @@ export function extractPackageFile(content: string): PackageFile | null {
} else { } else {
dep.currentValue = currentValue; dep.currentValue = currentValue;
if (!dockerVersioning.api.isValid(currentValue)) { if (!dockerVersioning.api.isValid(currentValue)) {
dep.skipReason = SkipReason.InvalidVersion; dep.skipReason = 'invalid-version';
} }
} }
deps.push(dep); deps.push(dep);

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { load } from 'js-yaml'; import { load } from 'js-yaml';
import * as datasourceGitlabTags from '../../datasource/gitlab-tags'; import * as datasourceGitlabTags from '../../datasource/gitlab-tags';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import { replaceReferenceTags } from '../gitlabci/utils'; import { replaceReferenceTags } from '../gitlabci/utils';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
@ -18,7 +17,7 @@ function extractDepFromIncludeFile(includeObj: {
depType: 'repository', depType: 'repository',
}; };
if (!includeObj.ref) { if (!includeObj.ref) {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
return dep; return dep;
} }
dep.currentValue = includeObj.ref; dep.currentValue = includeObj.ref;

View file

@ -1,7 +1,6 @@
import semver from 'semver'; import semver from 'semver';
import * as datasourceGo from '../../datasource/go'; import * as datasourceGo from '../../datasource/go';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import { isVersion } from '../../versioning/semver'; import { isVersion } from '../../versioning/semver';
import type { PackageDependency, PackageFile } from '../types'; import type { PackageDependency, PackageFile } from '../types';
@ -25,7 +24,7 @@ function getDep(
if (isVersion(currentValue)) { if (isVersion(currentValue)) {
dep.datasource = datasourceGo.id; dep.datasource = datasourceGo.id;
} else { } else {
dep.skipReason = SkipReason.UnsupportedVersion; dep.skipReason = 'unsupported-version';
} }
const digestMatch = regEx(/v0\.0.0-\d{14}-([a-f0-9]{12})/).exec(currentValue); const digestMatch = regEx(/v0\.0.0-\d{14}-([a-f0-9]{12})/).exec(currentValue);
if (digestMatch) { if (digestMatch) {

View file

@ -1,6 +1,5 @@
import { extractAllPackageFiles } from '..'; import { extractAllPackageFiles } from '..';
import { fs, loadFixture } from '../../../../test/util'; import { fs, loadFixture } from '../../../../test/util';
import { SkipReason } from '../../../types';
import type { ExtractConfig } from '../../types'; import type { ExtractConfig } from '../../types';
jest.mock('../../../util/fs'); jest.mock('../../../util/fs');
@ -71,7 +70,7 @@ describe('manager/gradle/shallow/extract', () => {
depName: 'foo:bar', depName: 'foo:bar',
currentValue: '1.2.3', currentValue: '1.2.3',
registryUrls: ['https://repo.maven.apache.org/maven2'], registryUrls: ['https://repo.maven.apache.org/maven2'],
skipReason: SkipReason.ContainsVariable, skipReason: 'contains-variable',
managerData: { managerData: {
packageFile: 'build.gradle', packageFile: 'build.gradle',
}, },

View file

@ -1,6 +1,5 @@
import { parse } from '@iarna/toml'; import { parse } from '@iarna/toml';
import deepmerge from 'deepmerge'; import deepmerge from 'deepmerge';
import { SkipReason } from '../../../../types';
import { hasKey } from '../../../../util/object'; import { hasKey } from '../../../../util/object';
import type { PackageDependency } from '../../../types'; import type { PackageDependency } from '../../../types';
import type { GradleManagerData } from '../../types'; import type { GradleManagerData } from '../../types';
@ -87,7 +86,7 @@ function extractDependency({
if (!currentValue) { if (!currentValue) {
return { return {
depName, depName,
skipReason: SkipReason.NoVersion, skipReason: 'no-version',
}; };
} }
return { return {
@ -114,7 +113,7 @@ function extractDependency({
if (!currentValue) { if (!currentValue) {
return { return {
depName, depName,
skipReason: SkipReason.NoVersion, skipReason: 'no-version',
}; };
} }

View file

@ -1,5 +1,4 @@
import { loadFixture } from '../../../../test/util'; import { loadFixture } from '../../../../test/util';
import { SkipReason } from '../../../types';
import { import {
GOOGLE_REPO, GOOGLE_REPO,
GRADLE_PLUGIN_PORTAL_REPO, GRADLE_PLUGIN_PORTAL_REPO,
@ -36,7 +35,7 @@ describe('manager/gradle/shallow/parser', () => {
${'group: "foo", name: "bar", version: depVersion'} | ${null} ${'group: "foo", name: "bar", version: depVersion'} | ${null}
${'("foo", "bar", "1.2.3")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }} ${'("foo", "bar", "1.2.3")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'(group = "foo", name = "bar", version = "1.2.3")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }} ${'(group = "foo", name = "bar", version = "1.2.3")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'createXmlValueRemover("defaults", "integer", "integer")'} | ${{ depName: 'defaults:integer', currentValue: 'integer', skipReason: SkipReason.Ignored }} ${'createXmlValueRemover("defaults", "integer", "integer")'} | ${{ depName: 'defaults:integer', currentValue: 'integer', skipReason: 'ignored' }}
${'"foo:bar:1.2.3@zip"'} | ${{ currentValue: '1.2.3', dataType: 'zip', depName: 'foo:bar' }} ${'"foo:bar:1.2.3@zip"'} | ${{ currentValue: '1.2.3', dataType: 'zip', depName: 'foo:bar' }}
`('$input', ({ input, output }) => { `('$input', ({ input, output }) => {
const { deps } = parseGradle(input); const { deps } = parseGradle(input);
@ -67,16 +66,16 @@ describe('manager/gradle/shallow/parser', () => {
${''} | ${'id "foo.bar" version "1.2.3"'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }} ${''} | ${'id "foo.bar" version "1.2.3"'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id("foo.bar") version "1.2.3"'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }} ${''} | ${'id("foo.bar") version "1.2.3"'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'kotlin("jvm") version "1.3.71"'} | ${{ depName: 'org.jetbrains.kotlin.jvm', lookupName: 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin', currentValue: '1.3.71' }} ${''} | ${'kotlin("jvm") version "1.3.71"'} | ${{ depName: 'org.jetbrains.kotlin.jvm', lookupName: 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin', currentValue: '1.3.71' }}
${''} | ${'id "foo.bar" version something'} | ${{ depName: 'foo.bar', currentValue: 'something', skipReason: SkipReason.UnknownVersion }} ${''} | ${'id "foo.bar" version something'} | ${{ depName: 'foo.bar', currentValue: 'something', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'id "foo.bar" version baz'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }} ${'baz = "1.2.3"'} | ${'id "foo.bar" version baz'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'id("foo.bar") version baz'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }} ${'baz = "1.2.3"'} | ${'id("foo.bar") version baz'} | ${{ depName: 'foo.bar', lookupName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${'baz = "1.3.71"'} | ${'kotlin("jvm") version baz'} | ${{ depName: 'org.jetbrains.kotlin.jvm', lookupName: 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin', currentValue: '1.3.71' }} ${'baz = "1.3.71"'} | ${'kotlin("jvm") version baz'} | ${{ depName: 'org.jetbrains.kotlin.jvm', lookupName: 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin', currentValue: '1.3.71' }}
${'z = "1.2.3"'} | ${'id "x.y" version "$z"'} | ${{ depName: 'x.y', lookupName: 'x.y:x.y.gradle.plugin', currentValue: '1.2.3' }} ${'z = "1.2.3"'} | ${'id "x.y" version "$z"'} | ${{ depName: 'x.y', lookupName: 'x.y:x.y.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id "x.y" version "$z"'} | ${{ depName: 'x.y', skipReason: SkipReason.UnknownVersion, currentValue: 'z' }} ${''} | ${'id "x.y" version "$z"'} | ${{ depName: 'x.y', skipReason: 'unknown-version', currentValue: 'z' }}
${''} | ${'id "x.y" version "x${y}z"'} | ${{ depName: 'x.y', skipReason: SkipReason.UnknownVersion }} ${''} | ${'id "x.y" version "x${y}z"'} | ${{ depName: 'x.y', skipReason: 'unknown-version' }}
${'z = "1.2.3"'} | ${'id("x.y") version "$z"'} | ${{ depName: 'x.y', lookupName: 'x.y:x.y.gradle.plugin', currentValue: '1.2.3' }} ${'z = "1.2.3"'} | ${'id("x.y") version "$z"'} | ${{ depName: 'x.y', lookupName: 'x.y:x.y.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id("x.y") version "$z"'} | ${{ depName: 'x.y', skipReason: SkipReason.UnknownVersion, currentValue: 'z' }} ${''} | ${'id("x.y") version "$z"'} | ${{ depName: 'x.y', skipReason: 'unknown-version', currentValue: 'z' }}
${''} | ${'id("x.y") version "x${y}z"'} | ${{ depName: 'x.y', skipReason: SkipReason.UnknownVersion }} ${''} | ${'id("x.y") version "x${y}z"'} | ${{ depName: 'x.y', skipReason: 'unknown-version' }}
`('$input', ({ def, input, output }) => { `('$input', ({ def, input, output }) => {
const { deps } = parseGradle([def, input].join('\n')); const { deps } = parseGradle([def, input].join('\n'));
expect(deps).toMatchObject([output].filter(Boolean)); expect(deps).toMatchObject([output].filter(Boolean));

View file

@ -1,7 +1,6 @@
import url from 'url'; import url from 'url';
import is from '@sindresorhus/is'; import is from '@sindresorhus/is';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
import { SkipReason } from '../../../types';
import { regEx } from '../../../util/regex'; import { regEx } from '../../../util/regex';
import type { PackageDependency } from '../../types'; import type { PackageDependency } from '../../types';
import type { GradleManagerData } from '../types'; import type { GradleManagerData } from '../types';
@ -190,7 +189,7 @@ function processDepInterpolation({
fileReplacePosition = lastToken.offset + 1; fileReplacePosition = lastToken.offset + 1;
delete dep.groupName; delete dep.groupName;
} else { } else {
dep.skipReason = SkipReason.ContainsVariable; dep.skipReason = 'contains-variable';
} }
dep.managerData = { fileReplacePosition, packageFile }; dep.managerData = { fileReplacePosition, packageFile };
} }
@ -234,7 +233,7 @@ function processPlugin({
const fileReplacePosition = pluginVersion.offset; const fileReplacePosition = pluginVersion.offset;
dep.currentValue = currentValue; dep.currentValue = currentValue;
dep.managerData = { fileReplacePosition, packageFile }; dep.managerData = { fileReplacePosition, packageFile };
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
} }
} else if (pluginVersion.type === TokenType.StringInterpolation) { } else if (pluginVersion.type === TokenType.StringInterpolation) {
const versionTpl = pluginVersion as StringInterpolation; const versionTpl = pluginVersion as StringInterpolation;
@ -252,12 +251,12 @@ function processPlugin({
const fileReplacePosition = child.offset; const fileReplacePosition = child.offset;
dep.currentValue = currentValue; dep.currentValue = currentValue;
dep.managerData = { fileReplacePosition, packageFile }; dep.managerData = { fileReplacePosition, packageFile };
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
} }
} else { } else {
const fileReplacePosition = versionTpl.offset; const fileReplacePosition = versionTpl.offset;
dep.managerData = { fileReplacePosition, packageFile }; dep.managerData = { fileReplacePosition, packageFile };
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
} }
} else { } else {
const currentValue = pluginVersion.value; const currentValue = pluginVersion.value;
@ -327,7 +326,7 @@ function processLongFormDep({
} }
const methodName = tokenMap.methodName?.value; const methodName = tokenMap.methodName?.value;
if (annoyingMethods.has(methodName)) { if (annoyingMethods.has(methodName)) {
dep.skipReason = SkipReason.Ignored; dep.skipReason = 'ignored';
} }
return { deps: [dep] }; return { deps: [dep] };

View file

@ -1,5 +1,4 @@
import { fs } from '../../../test/util'; import { fs } from '../../../test/util';
import { SkipReason } from '../../types';
import { extractPackageFile } from './extract'; import { extractPackageFile } from './extract';
jest.mock('../../util/fs'); jest.mock('../../util/fs');
@ -207,7 +206,7 @@ describe('manager/helm-requirements/extract', () => {
{ {
currentValue: undefined, currentValue: undefined,
depName: undefined, depName: undefined,
skipReason: SkipReason.InvalidName, skipReason: 'invalid-name',
}, },
], ],
}, },
@ -224,7 +223,7 @@ describe('manager/helm-requirements/extract', () => {
{ {
currentValue: undefined, currentValue: undefined,
depName: 'postgres', depName: 'postgres',
skipReason: SkipReason.InvalidVersion, skipReason: 'invalid-version',
}, },
], ],
}, },
@ -242,7 +241,7 @@ describe('manager/helm-requirements/extract', () => {
{ {
currentValue: '0.1.0', currentValue: '0.1.0',
depName: 'postgres', depName: 'postgres',
skipReason: SkipReason.NoRepository, skipReason: 'no-repository',
}, },
], ],
}, },

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { load } from 'js-yaml'; import { load } from 'js-yaml';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
export function extractPackageFile( export function extractPackageFile(
@ -30,17 +29,17 @@ export function extractPackageFile(
}; };
if (!res.depName) { if (!res.depName) {
res.skipReason = SkipReason.InvalidName; res.skipReason = 'invalid-name';
return res; return res;
} }
if (!res.currentValue) { if (!res.currentValue) {
res.skipReason = SkipReason.InvalidVersion; res.skipReason = 'invalid-version';
return res; return res;
} }
if (!dep.repository) { if (!dep.repository) {
res.skipReason = SkipReason.NoRepository; res.skipReason = 'no-repository';
return res; return res;
} }
@ -55,16 +54,16 @@ export function extractPackageFile(
return res; return res;
} }
res.skipReason = SkipReason.PlaceholderUrl; res.skipReason = 'placeholder-url';
} else { } else {
try { try {
const url = new URL(dep.repository); const url = new URL(dep.repository);
if (url.protocol === 'file:') { if (url.protocol === 'file:') {
res.skipReason = SkipReason.LocalDependency; res.skipReason = 'local-dependency';
} }
} catch (err) { } catch (err) {
logger.debug({ err }, 'Error parsing url'); logger.debug({ err }, 'Error parsing url');
res.skipReason = SkipReason.InvalidUrl; res.skipReason = 'invalid-url';
} }
} }
return res; return res;

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { loadAll } from 'js-yaml'; import { loadAll } from 'js-yaml';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
import type { Doc } from './types'; import type { Doc } from './types';
@ -43,7 +42,7 @@ export function extractPackageFile(
if (!is.string(dep.chart)) { if (!is.string(dep.chart)) {
return { return {
depName: dep.name, depName: dep.name,
skipReason: SkipReason.InvalidName, skipReason: 'invalid-name',
}; };
} }
@ -51,7 +50,7 @@ export function extractPackageFile(
if (dep.chart.startsWith('./')) { if (dep.chart.startsWith('./')) {
return { return {
depName, depName,
skipReason: SkipReason.LocalChart, skipReason: 'local-chart',
}; };
} }
@ -73,18 +72,18 @@ export function extractPackageFile(
// If version is null is probably a local chart // If version is null is probably a local chart
if (!res.currentValue) { if (!res.currentValue) {
res.skipReason = SkipReason.LocalChart; res.skipReason = 'local-chart';
} }
// By definition on helm the chart name should be lowercase letter + number + - // By definition on helm the chart name should be lowercase letter + number + -
// However helmfile support templating of that field // However helmfile support templating of that field
if (!isValidChartName(res.depName)) { if (!isValidChartName(res.depName)) {
res.skipReason = SkipReason.UnsupportedChartType; res.skipReason = 'unsupported-chart-type';
} }
// Skip in case we cannot locate the registry // Skip in case we cannot locate the registry
if (is.emptyArray(res.registryUrls)) { if (is.emptyArray(res.registryUrls)) {
res.skipReason = SkipReason.UnknownRegistry; res.skipReason = 'unknown-registry';
} }
return res; return res;

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { load } from 'js-yaml'; import { load } from 'js-yaml';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
import type { HelmsmanDocument } from './types'; import type { HelmsmanDocument } from './types';
@ -20,26 +19,26 @@ function createDep(key: string, doc: HelmsmanDocument): PackageDependency {
} }
if (!anApp.version) { if (!anApp.version) {
dep.skipReason = SkipReason.NoVersion; dep.skipReason = 'no-version';
return dep; return dep;
} }
dep.currentValue = anApp.version; dep.currentValue = anApp.version;
const regexResult = chartRegex.exec(anApp.chart); const regexResult = chartRegex.exec(anApp.chart);
if (!regexResult) { if (!regexResult) {
dep.skipReason = SkipReason.InvalidUrl; dep.skipReason = 'invalid-url';
return dep; return dep;
} }
if (!is.nonEmptyString(regexResult.groups.lookupName)) { if (!is.nonEmptyString(regexResult.groups.lookupName)) {
dep.skipReason = SkipReason.InvalidName; dep.skipReason = 'invalid-name';
return dep; return dep;
} }
dep.lookupName = regexResult.groups.lookupName; dep.lookupName = regexResult.groups.lookupName;
const registryUrl = doc.helmRepos[regexResult.groups.registryRef]; const registryUrl = doc.helmRepos[regexResult.groups.registryRef];
if (!is.nonEmptyString(registryUrl)) { if (!is.nonEmptyString(registryUrl)) {
dep.skipReason = SkipReason.NoRepository; dep.skipReason = 'no-repository';
return dep; return dep;
} }
dep.registryUrls = [registryUrl]; dep.registryUrls = [registryUrl];

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { load } from 'js-yaml'; import { load } from 'js-yaml';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { getSiblingFileName, localPathExists } from '../../util/fs'; import { getSiblingFileName, localPathExists } from '../../util/fs';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
import { parseRepository, resolveAlias } from './utils'; import { parseRepository, resolveAlias } from './utils';
@ -58,13 +57,13 @@ export async function extractPackageFile(
currentValue: dep.version, currentValue: dep.version,
}; };
if (!dep.repository) { if (!dep.repository) {
res.skipReason = SkipReason.NoRepository; res.skipReason = 'no-repository';
return res; return res;
} }
const repository = resolveAlias(dep.repository, config.aliases); const repository = resolveAlias(dep.repository, config.aliases);
if (!repository) { if (!repository) {
res.skipReason = SkipReason.PlaceholderUrl; res.skipReason = 'placeholder-url';
return res; return res;
} }

View file

@ -1,6 +1,5 @@
import * as datasourceDocker from '../../datasource/docker'; import * as datasourceDocker from '../../datasource/docker';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
export function parseRepository( export function parseRepository(
@ -17,14 +16,14 @@ export function parseRepository(
res.lookupName = `${repositoryURL.replace('oci://', '')}/${depName}`; res.lookupName = `${repositoryURL.replace('oci://', '')}/${depName}`;
break; break;
case 'file:': case 'file:':
res.skipReason = SkipReason.LocalDependency; res.skipReason = 'local-dependency';
break; break;
default: default:
res.registryUrls = [repositoryURL]; res.registryUrls = [repositoryURL];
} }
} catch (err) { } catch (err) {
logger.debug({ err }, 'Error parsing url'); logger.debug({ err }, 'Error parsing url');
res.skipReason = SkipReason.InvalidUrl; res.skipReason = 'invalid-url';
} }
return res; return res;
} }

View file

@ -156,12 +156,12 @@ export function extractPackageFile(content: string): PackageFile | null {
repoName = urlPathResult.repoName; repoName = urlPathResult.repoName;
} else { } else {
logger.debug('Error: Unsupported URL field'); logger.debug('Error: Unsupported URL field');
skipReason = SkipReason.UnsupportedUrl; skipReason = 'unsupported-url';
} }
const sha256 = extractSha256(cleanContent); const sha256 = extractSha256(cleanContent);
if (!sha256 || sha256.length !== 64) { if (!sha256 || sha256.length !== 64) {
logger.debug('Error: Invalid sha256 field'); logger.debug('Error: Invalid sha256 field');
skipReason = SkipReason.InvalidSha256; skipReason = 'invalid-sha256';
} }
const dep: PackageDependency = { const dep: PackageDependency = {
depName: `${ownerName}/${repoName}`, depName: `${ownerName}/${repoName}`,

View file

@ -2,7 +2,6 @@ import is from '@sindresorhus/is';
import { load } from 'js-yaml'; import { load } from 'js-yaml';
import { JenkinsPluginsDatasource } from '../../datasource/jenkins-plugins'; import { JenkinsPluginsDatasource } from '../../datasource/jenkins-plugins';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { isSkipComment } from '../../util/ignore'; import { isSkipComment } from '../../util/ignore';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import * as dockerVersioning from '../../versioning/docker'; import * as dockerVersioning from '../../versioning/docker';
@ -21,14 +20,14 @@ function getDependency(plugin: JenkinsPlugin): PackageDependency {
if (plugin.source?.version) { if (plugin.source?.version) {
dep.currentValue = plugin.source.version.toString(); dep.currentValue = plugin.source.version.toString();
if (typeof plugin.source.version !== 'string') { if (typeof plugin.source.version !== 'string') {
dep.skipReason = SkipReason.InvalidVersion; dep.skipReason = 'invalid-version';
logger.warn( logger.warn(
{ dep }, { dep },
'Jenkins plugin dependency version is not a string and will be ignored' 'Jenkins plugin dependency version is not a string and will be ignored'
); );
} }
} else { } else {
dep.skipReason = SkipReason.NoVersion; dep.skipReason = 'no-version';
} }
if ( if (
@ -36,15 +35,15 @@ function getDependency(plugin: JenkinsPlugin): PackageDependency {
plugin.source?.version === 'experimental' || plugin.source?.version === 'experimental' ||
plugin.groupId plugin.groupId
) { ) {
dep.skipReason = SkipReason.UnsupportedVersion; dep.skipReason = 'unsupported-version';
} }
if (plugin.source?.url) { if (plugin.source?.url) {
dep.skipReason = SkipReason.InternalPackage; dep.skipReason = 'internal-package';
} }
if (!dep.skipReason && plugin.renovate?.ignore) { if (!dep.skipReason && plugin.renovate?.ignore) {
dep.skipReason = SkipReason.Ignored; dep.skipReason = 'ignored';
} }
logger.debug({ dep }, 'Jenkins plugin dependency'); logger.debug({ dep }, 'Jenkins plugin dependency');

View file

@ -3,7 +3,6 @@ import * as datasourceDocker from '../../datasource/docker';
import { GitTagsDatasource } from '../../datasource/git-tags'; import { GitTagsDatasource } from '../../datasource/git-tags';
import * as datasourceGitHubTags from '../../datasource/github-tags'; import * as datasourceGitHubTags from '../../datasource/github-tags';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { SkipReason } from '../../types';
import { import {
extractHelmChart, extractHelmChart,
extractImage, extractImage,
@ -259,7 +258,7 @@ describe('manager/kustomize/extract', () => {
expect(res.deps).toHaveLength(6); expect(res.deps).toHaveLength(6);
expect(res.deps[0].currentValue).toBe('v0.1.0'); expect(res.deps[0].currentValue).toBe('v0.1.0');
expect(res.deps[1].currentValue).toBe('v0.0.1'); expect(res.deps[1].currentValue).toBe('v0.0.1');
expect(res.deps[5].skipReason).toEqual(SkipReason.InvalidValue); expect(res.deps[5].skipReason).toBe('invalid-value');
}); });
it('ignores non-Kubernetes empty files', () => { it('ignores non-Kubernetes empty files', () => {
expect(extractPackageFile('')).toBeNull(); expect(extractPackageFile('')).toBeNull();
@ -315,7 +314,7 @@ describe('manager/kustomize/extract', () => {
replaceString: `11@${postgresDigest}`, replaceString: `11@${postgresDigest}`,
}, },
{ {
skipReason: SkipReason.InvalidValue, skipReason: 'invalid-value',
}, },
], ],
}); });
@ -335,13 +334,13 @@ describe('manager/kustomize/extract', () => {
replaceString: postgresDigest, replaceString: postgresDigest,
}, },
{ {
skipReason: SkipReason.InvalidDependencySpecification, skipReason: 'invalid-dependency-specification',
}, },
{ {
skipReason: SkipReason.InvalidValue, skipReason: 'invalid-value',
}, },
{ {
skipReason: SkipReason.InvalidValue, skipReason: 'invalid-value',
}, },
], ],
}); });

View file

@ -5,7 +5,6 @@ import { GitTagsDatasource } from '../../datasource/git-tags';
import * as datasourceGitHubTags from '../../datasource/github-tags'; import * as datasourceGitHubTags from '../../datasource/github-tags';
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import { splitImageParts } from '../dockerfile/extract'; import { splitImageParts } from '../dockerfile/extract';
import type { PackageDependency, PackageFile } from '../types'; import type { PackageDependency, PackageFile } from '../types';
@ -57,7 +56,7 @@ export function extractImage(image: Image): PackageDependency | null {
depName, depName,
currentValue: newTag, currentValue: newTag,
currentDigest: digest, currentDigest: digest,
skipReason: SkipReason.InvalidDependencySpecification, skipReason: 'invalid-dependency-specification',
}; };
} }
@ -66,7 +65,7 @@ export function extractImage(image: Image): PackageDependency | null {
return { return {
depName, depName,
currentValue: digest, currentValue: digest,
skipReason: SkipReason.InvalidValue, skipReason: 'invalid-value',
}; };
} }
@ -84,7 +83,7 @@ export function extractImage(image: Image): PackageDependency | null {
return { return {
depName, depName,
currentValue: newTag, currentValue: newTag,
skipReason: SkipReason.InvalidValue, skipReason: 'invalid-value',
}; };
} }

View file

@ -4,7 +4,6 @@ import { XmlDocument, XmlElement } from 'xmldoc';
import * as datasourceMaven from '../../datasource/maven'; import * as datasourceMaven from '../../datasource/maven';
import { MAVEN_REPO } from '../../datasource/maven/common'; import { MAVEN_REPO } from '../../datasource/maven/common';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { readLocalFile } from '../../util/fs'; import { readLocalFile } from '../../util/fs';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
@ -139,9 +138,9 @@ function applyProps(
} }
if (containsPlaceholder(depName)) { if (containsPlaceholder(depName)) {
result.skipReason = SkipReason.NamePlaceholder; result.skipReason = 'name-placeholder';
} else if (containsPlaceholder(currentValue)) { } else if (containsPlaceholder(currentValue)) {
result.skipReason = SkipReason.VersionPlaceholder; result.skipReason = 'version-placeholder';
} }
if (propSource && depPackageFile !== propSource) { if (propSource && depPackageFile !== propSource) {

View file

@ -28,7 +28,7 @@ Object {
"managerData": Object { "managerData": Object {
"lineNumber": 20, "lineNumber": 20,
}, },
"skipReason": "non-hex depTypes", "skipReason": "non-hex-dep-types",
}, },
Object { Object {
"currentValue": "~> 1.0", "currentValue": "~> 1.0",

View file

@ -24,7 +24,7 @@ describe('manager/mix/extract', () => {
depName: 'cowboy', depName: 'cowboy',
currentValue: 'ninenines/cowboy', currentValue: 'ninenines/cowboy',
datasource: 'github', datasource: 'github',
skipReason: 'non-hex depTypes', skipReason: 'non-hex-dep-types',
}, },
{ {
depName: 'secret', depName: 'secret',

View file

@ -1,6 +1,5 @@
import { HexDatasource } from '../../datasource/hex'; import { HexDatasource } from '../../datasource/hex';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { findLocalSiblingOrParent, localPathExists } from '../../util/fs'; import { findLocalSiblingOrParent, localPathExists } from '../../util/fs';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency, PackageFile } from '../types'; import type { PackageDependency, PackageFile } from '../types';
@ -53,7 +52,7 @@ export async function extractPackageFile(
} }
if (dep.datasource !== HexDatasource.id) { if (dep.datasource !== HexDatasource.id) {
dep.skipReason = SkipReason.NonHexDeptypes; dep.skipReason = 'non-hex-dep-types';
} }
// Find dep's line number // Find dep's line number

View file

@ -5,7 +5,6 @@ import { CONFIG_VALIDATION } from '../../../constants/error-messages';
import * as datasourceGithubTags from '../../../datasource/github-tags'; import * as datasourceGithubTags from '../../../datasource/github-tags';
import { id as npmId } from '../../../datasource/npm'; import { id as npmId } from '../../../datasource/npm';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
import { SkipReason } from '../../../types';
import { getSiblingFileName, readLocalFile } from '../../../util/fs'; import { getSiblingFileName, readLocalFile } from '../../../util/fs';
import { regEx } from '../../../util/regex'; import { regEx } from '../../../util/regex';
import * as nodeVersioning from '../../../versioning/node'; import * as nodeVersioning from '../../../versioning/node';
@ -179,11 +178,11 @@ export async function extractPackageFile(
): PackageDependency { ): PackageDependency {
const dep: PackageDependency = {}; const dep: PackageDependency = {};
if (!validateNpmPackageName(depName).validForOldPackages) { if (!validateNpmPackageName(depName).validForOldPackages) {
dep.skipReason = SkipReason.InvalidName; dep.skipReason = 'invalid-name';
return dep; return dep;
} }
if (typeof input !== 'string') { if (typeof input !== 'string') {
dep.skipReason = SkipReason.InvalidValue; dep.skipReason = 'invalid-value';
return dep; return dep;
} }
dep.currentValue = input.trim(); dep.currentValue = input.trim();
@ -216,10 +215,10 @@ export async function extractPackageFile(
dep.lookupName = 'microsoft/vscode'; dep.lookupName = 'microsoft/vscode';
constraints.vscode = dep.currentValue; constraints.vscode = dep.currentValue;
} else { } else {
dep.skipReason = SkipReason.UnknownEngines; dep.skipReason = 'unknown-engines';
} }
if (!isValid(dep.currentValue)) { if (!isValid(dep.currentValue)) {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
} }
return dep; return dep;
} }
@ -236,10 +235,10 @@ export async function extractPackageFile(
} else if (depName === 'npm') { } else if (depName === 'npm') {
dep.datasource = npmId; dep.datasource = npmId;
} else { } else {
dep.skipReason = SkipReason.UnknownVolta; dep.skipReason = 'unknown-volta';
} }
if (!isValid(dep.currentValue)) { if (!isValid(dep.currentValue)) {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
} }
return dep; return dep;
} }
@ -259,23 +258,23 @@ export async function extractPackageFile(
} }
} }
if (dep.currentValue.startsWith('file:')) { if (dep.currentValue.startsWith('file:')) {
dep.skipReason = SkipReason.File; dep.skipReason = 'file';
hasFancyRefs = true; hasFancyRefs = true;
return dep; return dep;
} }
if (isValid(dep.currentValue)) { if (isValid(dep.currentValue)) {
dep.datasource = npmId; dep.datasource = npmId;
if (dep.currentValue === '*') { if (dep.currentValue === '*') {
dep.skipReason = SkipReason.AnyVersion; dep.skipReason = 'any-version';
} }
if (dep.currentValue === '') { if (dep.currentValue === '') {
dep.skipReason = SkipReason.Empty; dep.skipReason = 'empty';
} }
return dep; return dep;
} }
const hashSplit = dep.currentValue.split('#'); const hashSplit = dep.currentValue.split('#');
if (hashSplit.length !== 2) { if (hashSplit.length !== 2) {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
return dep; return dep;
} }
const [depNamePart, depRefPart] = hashSplit; const [depNamePart, depRefPart] = hashSplit;
@ -292,7 +291,7 @@ export async function extractPackageFile(
.replace(regEx(/\.git$/), ''); .replace(regEx(/\.git$/), '');
const githubRepoSplit = githubOwnerRepo.split('/'); const githubRepoSplit = githubOwnerRepo.split('/');
if (githubRepoSplit.length !== 2) { if (githubRepoSplit.length !== 2) {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
return dep; return dep;
} }
[githubOwner, githubRepo] = githubRepoSplit; [githubOwner, githubRepo] = githubRepoSplit;
@ -306,7 +305,7 @@ export async function extractPackageFile(
!githubValidRegex.test(githubOwner) || !githubValidRegex.test(githubOwner) ||
!githubValidRegex.test(githubRepo) !githubValidRegex.test(githubRepo)
) { ) {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
return dep; return dep;
} }
if (isVersion(depRefPart)) { if (isVersion(depRefPart)) {
@ -325,7 +324,7 @@ export async function extractPackageFile(
dep.datasource = datasourceGithubTags.id; dep.datasource = datasourceGithubTags.id;
dep.lookupName = githubOwnerRepo; dep.lookupName = githubOwnerRepo;
} else { } else {
dep.skipReason = SkipReason.UnversionedReference; dep.skipReason = 'unversioned-reference';
return dep; return dep;
} }
dep.githubRepo = githubOwnerRepo; dep.githubRepo = githubOwnerRepo;

View file

@ -1,6 +1,5 @@
import is from '@sindresorhus/is'; import is from '@sindresorhus/is';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
import { SkipReason } from '../../../types';
import { getSiblingFileName, getSubDirectory } from '../../../util/fs'; import { getSiblingFileName, getSubDirectory } from '../../../util/fs';
import type { PackageFile } from '../../types'; import type { PackageFile } from '../../types';
import { detectPnpmWorkspaces } from './pnpm'; import { detectPnpmWorkspaces } from './pnpm';
@ -42,7 +41,7 @@ export async function detectMonorepos(
if (!updateInternalDeps) { if (!updateInternalDeps) {
p.deps?.forEach((dep) => { p.deps?.forEach((dep) => {
if (internalPackageNames.includes(dep.depName)) { if (internalPackageNames.includes(dep.depName)) {
dep.skipReason = SkipReason.InternalPackage; dep.skipReason = 'internal-package';
} }
}); });
} }
@ -61,7 +60,7 @@ export async function detectMonorepos(
if (!updateInternalDeps) { if (!updateInternalDeps) {
subPackage.deps?.forEach((dep) => { subPackage.deps?.forEach((dep) => {
if (internalPackageNames.includes(dep.depName)) { if (internalPackageNames.includes(dep.depName)) {
dep.skipReason = SkipReason.InternalPackage; dep.skipReason = 'internal-package';
} }
}); });
} }

View file

@ -1,6 +1,5 @@
import * as datasourceNuget from '../../../datasource/nuget'; import * as datasourceNuget from '../../../datasource/nuget';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
import { SkipReason } from '../../../types';
import type { PackageDependency, PackageFile } from '../../types'; import type { PackageDependency, PackageFile } from '../../types';
import type { MsbuildGlobalManifest } from '../types'; import type { MsbuildGlobalManifest } from '../types';
@ -31,7 +30,7 @@ export function extractMsbuildGlobalManifest(
depType: 'dotnet-sdk', depType: 'dotnet-sdk',
depName: 'dotnet-sdk', depName: 'dotnet-sdk',
currentValue: manifest.sdk?.version, currentValue: manifest.sdk?.version,
skipReason: SkipReason.UnsupportedDatasource, skipReason: 'unsupported-datasource',
}); });
} }

View file

@ -4,7 +4,6 @@ import { GlobalConfig } from '../../config/global';
import { GitTagsDatasource } from '../../datasource/git-tags'; import { GitTagsDatasource } from '../../datasource/git-tags';
import { PypiDatasource } from '../../datasource/pypi'; import { PypiDatasource } from '../../datasource/pypi';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { isSkipComment } from '../../util/ignore'; import { isSkipComment } from '../../util/ignore';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
@ -65,7 +64,7 @@ export function extractPackageFile(
let dep: PackageDependency = {}; let dep: PackageDependency = {};
const [line, comment] = rawline.split('#').map((part) => part.trim()); const [line, comment] = rawline.split('#').map((part) => part.trim());
if (isSkipComment(comment)) { if (isSkipComment(comment)) {
dep.skipReason = SkipReason.Ignored; dep.skipReason = 'ignored';
} }
const [lineNoEnvMarkers] = line.split(';').map((part) => part.trim()); const [lineNoEnvMarkers] = line.split(';').map((part) => part.trim());
const lineNoHashes = lineNoEnvMarkers.split(' \\')[0]; const lineNoHashes = lineNoEnvMarkers.split(' \\')[0];

View file

@ -1,7 +1,6 @@
import { RANGE_PATTERN } from '@renovatebot/pep440'; import { RANGE_PATTERN } from '@renovatebot/pep440';
import { lang, lexer, query as q } from 'good-enough-parser'; import { lang, lexer, query as q } from 'good-enough-parser';
import { PypiDatasource } from '../../datasource/pypi'; import { PypiDatasource } from '../../datasource/pypi';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
@ -56,7 +55,7 @@ function depStringHandler(
function depSkipHandler(ctx: Context): Context { function depSkipHandler(ctx: Context): Context {
const dep = ctx.deps[ctx.deps.length - 1]; const dep = ctx.deps[ctx.deps.length - 1];
const deps = ctx.deps.slice(0, -1); const deps = ctx.deps.slice(0, -1);
deps.push({ ...dep, skipReason: SkipReason.Ignored }); deps.push({ ...dep, skipReason: 'ignored' });
return { ...ctx, deps }; return { ...ctx, deps };
} }

View file

@ -36,21 +36,21 @@ function extractFromSection(
let nestedVersion: boolean; let nestedVersion: boolean;
let skipReason: SkipReason; let skipReason: SkipReason;
if (requirements.git) { if (requirements.git) {
skipReason = SkipReason.GitDependency; skipReason = 'git-dependency';
} else if (requirements.file) { } else if (requirements.file) {
skipReason = SkipReason.FileDependency; skipReason = 'file-dependency';
} else if (requirements.path) { } else if (requirements.path) {
skipReason = SkipReason.LocalDependency; skipReason = 'local-dependency';
} else if (requirements.version) { } else if (requirements.version) {
currentValue = requirements.version; currentValue = requirements.version;
nestedVersion = true; nestedVersion = true;
} else if (is.object(requirements)) { } else if (is.object(requirements)) {
skipReason = SkipReason.AnyVersion; skipReason = 'any-version';
} else { } else {
currentValue = requirements; currentValue = requirements;
} }
if (currentValue === '*') { if (currentValue === '*') {
skipReason = SkipReason.AnyVersion; skipReason = 'any-version';
} }
if (!skipReason) { if (!skipReason) {
const packageMatches = packageRegex.exec(depName); const packageMatches = packageRegex.exec(depName);
@ -58,14 +58,14 @@ function extractFromSection(
logger.debug( logger.debug(
`Skipping dependency with malformed package name "${depName}".` `Skipping dependency with malformed package name "${depName}".`
); );
skipReason = SkipReason.InvalidName; skipReason = 'invalid-name';
} }
const specifierMatches = specifierRegex.exec(currentValue); const specifierMatches = specifierRegex.exec(currentValue);
if (!specifierMatches) { if (!specifierMatches) {
logger.debug( logger.debug(
`Skipping dependency with malformed version specifier "${currentValue}".` `Skipping dependency with malformed version specifier "${currentValue}".`
); );
skipReason = SkipReason.InvalidVersion; skipReason = 'invalid-version';
} }
} }
const dep: PackageDependency = { const dep: PackageDependency = {

View file

@ -44,20 +44,20 @@ function extractFromSection(
currentValue = version; currentValue = version;
nestedVersion = true; nestedVersion = true;
if (path) { if (path) {
skipReason = SkipReason.PathDependency; skipReason = 'path-dependency';
} }
if (git) { if (git) {
skipReason = SkipReason.GitDependency; skipReason = 'git-dependency';
} }
} else if (path) { } else if (path) {
currentValue = ''; currentValue = '';
skipReason = SkipReason.PathDependency; skipReason = 'path-dependency';
} else if (git) { } else if (git) {
currentValue = ''; currentValue = '';
skipReason = SkipReason.GitDependency; skipReason = 'git-dependency';
} else { } else {
currentValue = ''; currentValue = '';
skipReason = SkipReason.MultipleConstraintDep; skipReason = 'multiple-constraint-dep';
} }
} }
const dep: PackageDependency = { const dep: PackageDependency = {
@ -77,7 +77,7 @@ function extractFromSection(
} else if (poetryVersioning.isValid(dep.currentValue)) { } else if (poetryVersioning.isValid(dep.currentValue)) {
dep.versioning = poetryVersioning.id; dep.versioning = poetryVersioning.id;
} else { } else {
dep.skipReason = SkipReason.UnknownVersion; dep.skipReason = 'unknown-version';
} }
deps.push(dep); deps.push(dep);
}); });

View file

@ -48,7 +48,7 @@ function determineDatasource(
{ repository, hostUrl }, { repository, hostUrl },
'Provided hostname does not match any hostRules. Ignoring' 'Provided hostname does not match any hostRules. Ignoring'
); );
return { skipReason: SkipReason.UnknownRegistry, registryUrls: [hostname] }; return { skipReason: 'unknown-registry', registryUrls: [hostname] };
} }
for (const [hostType, sourceId] of [ for (const [hostType, sourceId] of [
[PlatformId.Gitea, gitlabTagsId], [PlatformId.Gitea, gitlabTagsId],
@ -67,7 +67,7 @@ function determineDatasource(
{ repository, registry: hostUrl }, { repository, registry: hostUrl },
'Provided hostname did not match any of the hostRules of hostType gitea,github nor gitlab' 'Provided hostname did not match any of the hostRules of hostType gitea,github nor gitlab'
); );
return { skipReason: SkipReason.UnknownRegistry, registryUrls: [hostname] }; return { skipReason: 'unknown-registry', registryUrls: [hostname] };
} }
function extractDependency( function extractDependency(
@ -115,7 +115,7 @@ function extractDependency(
depType: 'repository', depType: 'repository',
datasource: undefined, datasource: undefined,
lookupName: undefined, lookupName: undefined,
skipReason: SkipReason.InvalidUrl, skipReason: 'invalid-url',
currentValue: tag, currentValue: tag,
}; };
} }

View file

@ -3,7 +3,6 @@ import { GitTagsDatasource } from '../../datasource/git-tags';
import * as datasourceGithubTags from '../../datasource/github-tags'; import * as datasourceGithubTags from '../../datasource/github-tags';
import { TerraformModuleDatasource } from '../../datasource/terraform-module'; import { TerraformModuleDatasource } from '../../datasource/terraform-module';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { TerraformDependencyTypes } from './common'; import { TerraformDependencyTypes } from './common';
@ -69,7 +68,7 @@ export function analyseTerraformModule(dep: PackageDependency): void {
} else if (dep.managerData.source) { } else if (dep.managerData.source) {
const moduleParts = dep.managerData.source.split('//')[0].split('/'); const moduleParts = dep.managerData.source.split('//')[0].split('/');
if (moduleParts[0] === '..') { if (moduleParts[0] === '..') {
dep.skipReason = SkipReason.Local; dep.skipReason = 'local';
} else if (moduleParts.length >= 3) { } else if (moduleParts.length >= 3) {
const hostnameMatch = hostnameMatchRegex.exec(dep.managerData.source); const hostnameMatch = hostnameMatchRegex.exec(dep.managerData.source);
if (hostnameMatch) { if (hostnameMatch) {
@ -81,6 +80,6 @@ export function analyseTerraformModule(dep: PackageDependency): void {
} }
} else { } else {
logger.debug({ dep }, 'terraform dep has no source'); logger.debug({ dep }, 'terraform dep has no source');
dep.skipReason = SkipReason.NoSource; dep.skipReason = 'no-source';
} }
} }

View file

@ -1,7 +1,6 @@
import is from '@sindresorhus/is'; import is from '@sindresorhus/is';
import { TerraformProviderDatasource } from '../../datasource/terraform-provider'; import { TerraformProviderDatasource } from '../../datasource/terraform-provider';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { TerraformDependencyTypes } from './common'; import { TerraformDependencyTypes } from './common';
@ -82,7 +81,7 @@ export function analyzeTerraformProvider(
if (is.nonEmptyString(dep.managerData.source)) { if (is.nonEmptyString(dep.managerData.source)) {
const source = sourceExtractionRegex.exec(dep.managerData.source); const source = sourceExtractionRegex.exec(dep.managerData.source);
if (!source) { if (!source) {
dep.skipReason = SkipReason.UnsupportedUrl; dep.skipReason = 'unsupported-url';
return; return;
} }
@ -101,6 +100,6 @@ export function analyzeTerraformProvider(
dep.lockedVersion = getLockedVersion(dep, locks); dep.lockedVersion = getLockedVersion(dep, locks);
if (!dep.currentValue) { if (!dep.currentValue) {
dep.skipReason = SkipReason.NoVersion; dep.skipReason = 'no-version';
} }
} }

View file

@ -1,5 +1,4 @@
import { HelmDatasource } from '../../datasource/helm'; import { HelmDatasource } from '../../datasource/helm';
import { SkipReason } from '../../types';
import { getDep } from '../dockerfile/extract'; import { getDep } from '../dockerfile/extract';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { TerraformDependencyTypes, TerraformResourceTypes } from './common'; import { TerraformDependencyTypes, TerraformResourceTypes } from './common';
@ -71,7 +70,7 @@ export function analyseTerraformResource(
applyDockerDependency(dep, dep.managerData.image); applyDockerDependency(dep, dep.managerData.image);
dep.depType = 'docker_container'; dep.depType = 'docker_container';
} else { } else {
dep.skipReason = SkipReason.InvalidDependencySpecification; dep.skipReason = 'invalid-dependency-specification';
} }
break; break;
@ -80,7 +79,7 @@ export function analyseTerraformResource(
applyDockerDependency(dep, dep.managerData.name); applyDockerDependency(dep, dep.managerData.name);
dep.depType = 'docker_image'; dep.depType = 'docker_image';
} else { } else {
dep.skipReason = SkipReason.InvalidDependencySpecification; dep.skipReason = 'invalid-dependency-specification';
} }
break; break;
@ -89,15 +88,15 @@ export function analyseTerraformResource(
applyDockerDependency(dep, dep.managerData.image); applyDockerDependency(dep, dep.managerData.image);
dep.depType = 'docker_service'; dep.depType = 'docker_service';
} else { } else {
dep.skipReason = SkipReason.InvalidDependencySpecification; dep.skipReason = 'invalid-dependency-specification';
} }
break; break;
case TerraformResourceTypes.helm_release: case TerraformResourceTypes.helm_release:
if (!dep.managerData.chart) { if (!dep.managerData.chart) {
dep.skipReason = SkipReason.InvalidName; dep.skipReason = 'invalid-name';
} else if (checkIfStringIsPath(dep.managerData.chart)) { } else if (checkIfStringIsPath(dep.managerData.chart)) {
dep.skipReason = SkipReason.LocalChart; dep.skipReason = 'local-chart';
} }
dep.depType = 'helm_release'; dep.depType = 'helm_release';
dep.registryUrls = [dep.managerData.repository]; dep.registryUrls = [dep.managerData.repository];
@ -106,7 +105,7 @@ export function analyseTerraformResource(
break; break;
default: default:
dep.skipReason = SkipReason.InvalidValue; dep.skipReason = 'invalid-value';
break; break;
} }
} }

View file

@ -2,7 +2,6 @@ import { GitTagsDatasource } from '../../datasource/git-tags';
import * as datasourceGithubTags from '../../datasource/github-tags'; import * as datasourceGithubTags from '../../datasource/github-tags';
import { TerraformModuleDatasource } from '../../datasource/terraform-module'; import { TerraformModuleDatasource } from '../../datasource/terraform-module';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { regEx } from '../../util/regex'; import { regEx } from '../../util/regex';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { TerragruntDependencyTypes } from './common'; import { TerragruntDependencyTypes } from './common';
@ -56,7 +55,7 @@ export function analyseTerragruntModule(dep: PackageDependency): void {
} else if (dep.managerData.source) { } else if (dep.managerData.source) {
const moduleParts = dep.managerData.source.split('//')[0].split('/'); const moduleParts = dep.managerData.source.split('//')[0].split('/');
if (moduleParts[0] === '..') { if (moduleParts[0] === '..') {
dep.skipReason = SkipReason.Local; dep.skipReason = 'local';
} else if (moduleParts.length >= 3) { } else if (moduleParts.length >= 3) {
const hostnameMatch = hostnameMatchRegex.exec(dep.managerData.source); const hostnameMatch = hostnameMatchRegex.exec(dep.managerData.source);
if (hostnameMatch) { if (hostnameMatch) {
@ -68,6 +67,6 @@ export function analyseTerragruntModule(dep: PackageDependency): void {
} }
} else { } else {
logger.debug({ dep }, 'terragrunt dep has no source'); logger.debug({ dep }, 'terragrunt dep has no source');
dep.skipReason = SkipReason.NoSource; dep.skipReason = 'no-source';
} }
} }

View file

@ -1,46 +1,45 @@
export enum SkipReason { export type SkipReason =
AnyVersion = 'any-version', | 'any-version'
ContainsVariable = 'contains-variable', | 'contains-variable'
Disabled = 'disabled', | 'disabled'
Empty = 'empty', | 'empty'
FileDependency = 'file-dependency', | 'file-dependency'
File = 'file', | 'file'
GitDependency = 'git-dependency', | 'git-dependency'
GitPlugin = 'git-plugin', | 'git-plugin'
Ignored = 'ignored', | 'ignored'
InternalError = 'internal-error', | 'internal-error'
InternalPackage = 'internal-package', | 'internal-package'
InvalidConfig = 'invalid-config', | 'invalid-config'
InvalidDependencySpecification = 'invalid-dependency-specification', | 'invalid-dependency-specification'
InvalidName = 'invalid-name', | 'invalid-name'
InvalidSha256 = 'invalid-sha256', | 'invalid-sha256'
InvalidUrl = 'invalid-url', | 'invalid-url'
InvalidValue = 'invalid-value', | 'invalid-value'
InvalidVersion = 'invalid-version', | 'invalid-version'
LocalChart = 'local-chart', | 'local-chart'
LocalDependency = 'local-dependency', | 'local-dependency'
Local = 'local', | 'local'
MultipleConstraintDep = 'multiple-constraint-dep', | 'multiple-constraint-dep'
NamePlaceholder = 'name-placeholder', | 'name-placeholder'
NoRepository = 'no-repository', | 'no-repository'
NoSourceMatch = 'no-source-match', | 'no-source-match'
NoSource = 'no-source', | 'no-source'
NoVersion = 'no-version', | 'no-version'
NonHexDeptypes = 'non-hex depTypes', | 'non-hex-dep-types'
NotAVersion = 'not-a-version', | 'not-a-version'
PathDependency = 'path-dependency', | 'path-dependency'
PlaceholderUrl = 'placeholder-url', | 'placeholder-url'
UnknownEngines = 'unknown-engines', | 'unknown-engines'
UnknownRegistry = 'unknown-registry', | 'unknown-registry'
UnknownVersion = 'unknown-version', | 'unknown-version'
UnknownVolta = 'unknown-volta', | 'unknown-volta'
UnsupportedChartType = 'unsupported-chart-type', | 'unsupported-chart-type'
UnsupportedDatasource = 'unsupported-datasource', | 'unsupported-datasource'
UnsupportedRemote = 'unsupported-remote', | 'unsupported-remote'
UnsupportedUrl = 'unsupported-url', | 'unsupported-url'
UnsupportedVersion = 'unsupported-version', | 'unsupported-version'
Unsupported = 'unsupported', | 'unsupported'
UnversionedReference = 'unversioned-reference', | 'unversioned-reference'
VersionPlaceholder = 'version-placeholder', | 'version-placeholder'
IsPinned = 'is-pinned', | 'is-pinned';
}

View file

@ -4,7 +4,6 @@ import type { RenovateConfig } from '../../../config/types';
import { getDefaultConfig } from '../../../datasource'; import { getDefaultConfig } from '../../../datasource';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
import type { PackageDependency, PackageFile } from '../../../manager/types'; import type { PackageDependency, PackageFile } from '../../../manager/types';
import { SkipReason } from '../../../types';
import { clone } from '../../../util/clone'; import { clone } from '../../../util/clone';
import { applyPackageRules } from '../../../util/package-rules'; import { applyPackageRules } from '../../../util/package-rules';
import { lookupUpdates } from './lookup'; import { lookupUpdates } from './lookup';
@ -27,10 +26,10 @@ async function fetchDepUpdates(
depConfig = applyPackageRules(depConfig); depConfig = applyPackageRules(depConfig);
if (depConfig.ignoreDeps.includes(depName)) { if (depConfig.ignoreDeps.includes(depName)) {
logger.debug({ dependency: depName }, 'Dependency is ignored'); logger.debug({ dependency: depName }, 'Dependency is ignored');
dep.skipReason = SkipReason.Ignored; dep.skipReason = 'ignored';
} else if (depConfig.enabled === false) { } else if (depConfig.enabled === false) {
logger.debug({ dependency: depName }, 'Dependency is disabled'); logger.debug({ dependency: depName }, 'Dependency is disabled');
dep.skipReason = SkipReason.Disabled; dep.skipReason = 'disabled';
} else { } else {
if (depConfig.datasource) { if (depConfig.datasource) {
dep = { dep = {

View file

@ -13,7 +13,6 @@ import {
} from '../../../../datasource'; } from '../../../../datasource';
import { logger } from '../../../../logger'; import { logger } from '../../../../logger';
import { getRangeStrategy } from '../../../../manager'; import { getRangeStrategy } from '../../../../manager';
import { SkipReason } from '../../../../types';
import { ExternalHostError } from '../../../../types/errors/external-host-error'; import { ExternalHostError } from '../../../../types/errors/external-host-error';
import { clone } from '../../../../util/clone'; import { clone } from '../../../../util/clone';
import { applyPackageRules } from '../../../../util/package-rules'; import { applyPackageRules } from '../../../../util/package-rules';
@ -61,7 +60,7 @@ export async function lookupUpdates(
!isGetPkgReleasesConfig(config) || !isGetPkgReleasesConfig(config) ||
!getDatasourceList().includes(datasource) !getDatasourceList().includes(datasource)
) { ) {
res.skipReason = SkipReason.InvalidConfig; res.skipReason = 'invalid-config';
return res; return res;
} }
const isValid = is.string(currentValue) && versioning.isValid(currentValue); const isValid = is.string(currentValue) && versioning.isValid(currentValue);
@ -70,7 +69,7 @@ export async function lookupUpdates(
!updatePinnedDependencies && !updatePinnedDependencies &&
versioning.isSingleVersion(currentValue) versioning.isSingleVersion(currentValue)
) { ) {
res.skipReason = SkipReason.IsPinned; res.skipReason = 'is-pinned';
return res; return res;
} }
@ -215,7 +214,7 @@ export async function lookupUpdates(
} }
// istanbul ignore if // istanbul ignore if
if (!versioning.isVersion(currentVersion)) { if (!versioning.isVersion(currentVersion)) {
res.skipReason = SkipReason.InvalidVersion; res.skipReason = 'invalid-version';
return res; return res;
} }
// Filter latest, unstable, etc // Filter latest, unstable, etc
@ -304,12 +303,12 @@ export async function lookupUpdates(
`Dependency ${depName} has unsupported value ${currentValue}` `Dependency ${depName} has unsupported value ${currentValue}`
); );
if (!pinDigests && !currentDigest) { if (!pinDigests && !currentDigest) {
res.skipReason = SkipReason.InvalidValue; res.skipReason = 'invalid-value';
} else { } else {
delete res.skipReason; delete res.skipReason;
} }
} else { } else {
res.skipReason = SkipReason.InvalidValue; res.skipReason = 'invalid-value';
} }
// Record if the dep is fixed to a version // Record if the dep is fixed to a version
@ -388,7 +387,7 @@ export async function lookupUpdates(
}, },
'lookupUpdates error' 'lookupUpdates error'
); );
res.skipReason = SkipReason.InternalError; res.skipReason = 'internal-error';
} }
return res; return res;
} }