Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor: Merged multiple skipReasons into unspecified-version. (#22409)
  • Loading branch information
ryo-manba committed May 25, 2023
1 parent 0d511ac commit 0417c11
Show file tree
Hide file tree
Showing 35 changed files with 108 additions and 110 deletions.
Expand Up @@ -46,15 +46,15 @@ exports[`modules/manager/ansible-galaxy/extract extractPackageFile() check colle
"registryUrls": [
"https://cloud.redhat.com/api/automation-hub/",
],
"skipReason": "no-version",
"skipReason": "unspecified-version",
},
{
"currentValue": null,
"datasource": "git-tags",
"depName": "foo.bar/organization/repo_name",
"depType": "galaxy-collection",
"packageName": "https://foo.bar/organization/repo_name.git",
"skipReason": "no-version",
"skipReason": "unspecified-version",
},
{
"currentValue": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/ansible-galaxy/collections.ts
Expand Up @@ -124,7 +124,7 @@ function finalize(dependency: AnsibleGalaxyPackageDependency): boolean {
}

if (!dependency.currentValue && !dep.skipReason) {
dep.skipReason = 'no-version';
dep.skipReason = 'unspecified-version';
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/ansible-galaxy/roles.ts
Expand Up @@ -47,7 +47,7 @@ function interpretLine(
function finalize(dependency: AnsibleGalaxyPackageDependency): boolean {
const dep = dependency;
if (dependency.managerData.version === null) {
dep.skipReason = 'no-version';
dep.skipReason = 'unspecified-version';
return false;
}
const source = dep.managerData.src ?? '';
Expand Down
8 changes: 4 additions & 4 deletions lib/modules/manager/cocoapods/extract.spec.ts
Expand Up @@ -62,16 +62,16 @@ describe('modules/manager/cocoapods/extract', () => {
{ depName: 'TOCropViewController', currentValue: '~> 2.5.1' },
{ depName: 'FMDB', currentValue: '~> 2.7.5' },
{ depName: 'FDStackView', currentValue: '~> 1.0.1' },
{ depName: 'LYEmptyView', skipReason: 'unknown-version' },
{ depName: 'LYEmptyView', skipReason: 'unspecified-version' },
{ depName: 'MMKV', currentValue: '~> 1.0.22' },
{ depName: 'fishhook', skipReason: 'unknown-version' },
{ depName: 'fishhook', skipReason: 'unspecified-version' },
{ depName: 'CocoaLumberjack', currentValue: '~> 3.5.3' },
{ depName: 'GZIP', currentValue: '~> 1.2' },
{ depName: 'LBXScan/LBXNative', currentValue: '~> 2.3' },
{ depName: 'LBXScan/LBXZXing', currentValue: '~> 2.3' },
{ depName: 'LBXScan/UI', currentValue: '~> 2.3' },
{ depName: 'MLeaksFinder', skipReason: 'unknown-version' },
{ depName: 'FBMemoryProfiler', skipReason: 'unknown-version' },
{ depName: 'MLeaksFinder', skipReason: 'unspecified-version' },
{ depName: 'FBMemoryProfiler', skipReason: 'unspecified-version' },
]);
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/cocoapods/extract.ts
Expand Up @@ -112,7 +112,7 @@ export async function extractPackageFile(
let dep: PackageDependency = {
depName,
groupName,
skipReason: 'unknown-version',
skipReason: 'unspecified-version',
};

if (currentValue) {
Expand Down
12 changes: 6 additions & 6 deletions lib/modules/manager/cpanfile/extract.spec.ts
Expand Up @@ -59,7 +59,7 @@ describe('modules/manager/cpanfile/extract', () => {
{
datasource: 'cpan',
depName: 'Try::Tiny',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
{
datasource: 'cpan',
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('modules/manager/cpanfile/extract', () => {
{
datasource: 'cpan',
depName: 'Crypt::URandom',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
{
datasource: 'cpan',
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('modules/manager/cpanfile/extract', () => {
{
datasource: 'cpan',
depName: 'Authen::Simple::Passwd',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
],
});
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('modules/manager/cpanfile/extract', () => {
datasource: 'cpan',
depName: 'Test::Requires',
depType: 'test',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
],
});
Expand All @@ -251,13 +251,13 @@ describe('modules/manager/cpanfile/extract', () => {
datasource: 'cpan',
depName: 'FCGI',
depType: 'runtime',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
{
datasource: 'cpan',
depName: 'FCGI::ProcManager',
depType: 'runtime',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/cpanfile/parser.ts
Expand Up @@ -89,7 +89,7 @@ const moduleMatch = q
if (currentValue) {
dep.currentValue = currentValue;
} else {
dep.skipReason = 'no-version';
dep.skipReason = 'unspecified-version';
}
if (phase) {
dep.depType = phase;
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/manager/fleet/extract.spec.ts
Expand Up @@ -118,7 +118,7 @@ kind: Fleet
packageName: 'cert-manager',
registryUrls: ['https://charts.jetstack.io'],
depType: 'fleet',
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
]);
});
Expand All @@ -129,7 +129,7 @@ kind: Fleet
expect(result).not.toBeNull();
expect(result?.deps).toMatchObject([
{
skipReason: 'no-version',
skipReason: 'unspecified-version',
datasource: 'helm',
depName: 'cert-manager',
registryUrls: ['https://charts.jetstack.io'],
Expand Down Expand Up @@ -204,7 +204,7 @@ kind: Fleet
datasource: 'git-tags',
depName: 'https://github.com/rancher/rancher',
depType: 'git_repo',
skipReason: 'no-version',
skipReason: 'unspecified-version',
sourceUrl: 'https://github.com/rancher/rancher',
},
]);
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/fleet/extract.ts
Expand Up @@ -28,7 +28,7 @@ function extractGitRepo(doc: GitRepo): PackageDependency {
if (!currentValue) {
return {
...dep,
skipReason: 'no-version',
skipReason: 'unspecified-version',
};
}

Expand Down Expand Up @@ -71,7 +71,7 @@ function extractFleetHelmBlock(doc: FleetHelmBlock): PackageDependency {
if (!doc.version) {
return {
...dep,
skipReason: 'no-version',
skipReason: 'unspecified-version',
};
}

Expand Down
Expand Up @@ -18,7 +18,7 @@ exports[`modules/manager/gitlabci-include/extract extractPackageFile() extracts
"datasource": "gitlab-tags",
"depName": "mikebryant/include-source-example3",
"depType": "repository",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
]
`;
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gitlabci-include/extract.ts
Expand Up @@ -26,7 +26,7 @@ function extractDepFromIncludeFile(
depType: 'repository',
};
if (!includeObj.ref) {
dep.skipReason = 'unknown-version';
dep.skipReason = 'unspecified-version';
return dep;
}
dep.currentValue = includeObj.ref;
Expand Down
8 changes: 4 additions & 4 deletions lib/modules/manager/gradle/extract.spec.ts
Expand Up @@ -604,7 +604,7 @@ describe('modules/manager/gradle/extract', () => {
packageFile: 'gradle/libs.versions.toml',
},
registryUrls: ['https://plugins.gradle.org/m2/'],
skipReason: 'unknown-version',
skipReason: 'unspecified-version',
},
],
},
Expand Down Expand Up @@ -667,21 +667,21 @@ describe('modules/manager/gradle/extract', () => {
managerData: {
packageFile: 'gradle/libs.versions.toml',
},
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
{
depName: 'google-firebase-crashlytics',
managerData: {
packageFile: 'gradle/libs.versions.toml',
},
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
{
depName: 'google-firebase-messaging',
managerData: {
packageFile: 'gradle/libs.versions.toml',
},
skipReason: 'no-version',
skipReason: 'unspecified-version',
},
{
depName: 'org.jetbrains.kotlin.jvm',
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/manager/gradle/extract/catalog.ts
Expand Up @@ -113,7 +113,7 @@ function extractLiteralVersion({
sectionKey: string;
}): VersionExtract {
if (!version) {
return { skipReason: 'no-version' };
return { skipReason: 'unspecified-version' };
} else if (is.string(version)) {
const fileReplacePosition =
depStartIndex + findVersionIndex(depSubContent, sectionKey, version);
Expand Down Expand Up @@ -151,7 +151,7 @@ function extractLiteralVersion({
}
}

return { skipReason: 'unknown-version' };
return { skipReason: 'unspecified-version' };
}

function extractDependency({
Expand Down Expand Up @@ -179,7 +179,7 @@ function extractDependency({
if (!currentValue) {
return {
depName,
skipReason: 'no-version',
skipReason: 'unspecified-version',
};
}
return {
Expand Down
32 changes: 16 additions & 16 deletions lib/modules/manager/gradle/parser.spec.ts
Expand Up @@ -435,8 +435,8 @@ describe('modules/manager/gradle/parser', () => {
${'baz = "1.2.3"'} | ${'kotlin("foo", baz)'} | ${{ ...output, groupName: 'baz' }}
${'baz = "1.2.3"'} | ${'kotlin("foo", version = baz)'} | ${output}
${'baz = "1.2.3"'} | ${'kotlin("foo", property("baz"))'} | ${output}
${'baz = "1.2.3"'} | ${'kotlin("foo", "${baz}456")'} | ${{ skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'kotlin("foo", baz + "456")'} | ${{ skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'kotlin("foo", "${baz}456")'} | ${{ skipReason: 'unspecified-version' }}
${'baz = "1.2.3"'} | ${'kotlin("foo", baz + "456")'} | ${{ skipReason: 'unspecified-version' }}
${''} | ${'kotlin("foo", some)'} | ${null}
${''} | ${'kotlin(["foo", "1.2.3"])'} | ${null}
${''} | ${'kotlin("foo", "1.2.3", "4.5.6")'} | ${null}
Expand All @@ -458,7 +458,7 @@ describe('modules/manager/gradle/parser', () => {
${'some = "foo"'} | ${'group: some, name: some, version: "1.2.3"'} | ${{ depName: 'foo:foo', currentValue: '1.2.3' }}
${'some = "foo"'} | ${'group: "${some}", name: "${some}", version: "1.2.3"'} | ${{ depName: 'foo:foo', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'group: "foo", name: "bar", version: "${baz}"'} | ${{ depName: 'foo:bar', currentValue: '1.2.3', groupName: 'baz' }}
${'baz = "1.2.3"'} | ${'group: "foo", name: "bar", version: "${baz}456"'} | ${{ depName: 'foo:bar', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'group: "foo", name: "bar", version: "${baz}456"'} | ${{ depName: 'foo:bar', skipReason: 'unspecified-version' }}
${''} | ${'(group: "foo", name: "bar", version: "1.2.3", classifier: "sources")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${''} | ${'(group: "foo", name: "bar", version: "1.2.3") {exclude module: "spring-jcl"}'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${''} | ${"implementation platform(group: 'foo', name: 'bar', version: '1.2.3')"} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
Expand All @@ -468,8 +468,8 @@ describe('modules/manager/gradle/parser', () => {
${'some = "foo"'} | ${'(group = "${some}", name = "${some}", version = "1.2.3")'} | ${{ depName: 'foo:foo', currentValue: '1.2.3' }}
${'some = "foo"'} | ${'(group = "${some}" + some, name = some + "bar" + some, version = "1.2.3")'} | ${{ depName: 'foofoo:foobarfoo', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'(group = "foo", name = "bar", version = "${baz}")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3', groupName: 'baz' }}
${'baz = "1.2.3"'} | ${'(group = "foo", name = "bar", version = "${baz}456")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3456', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'(group = "foo", name = "bar", version = baz + "456")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3456', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'(group = "foo", name = "bar", version = "${baz}456")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3456', skipReason: 'unspecified-version' }}
${'baz = "1.2.3"'} | ${'(group = "foo", name = "bar", version = baz + "456")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3456', skipReason: 'unspecified-version' }}
${''} | ${'(group = "foo", name = "bar", version = "1.2.3", changing: true)'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
`('$def | $str', ({ def, str, output }) => {
const { deps } = parseGradle([def, str].join('\n'));
Expand Down Expand Up @@ -563,16 +563,16 @@ describe('modules/manager/gradle/parser', () => {
${''} | ${'id "foo".version("1.2.3")'} | ${null}
${''} | ${'id("foo.bar") version("1.2.3")'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id("foo.bar") version "1.2.3"'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id "foo.bar" version "$baz"'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version', currentValue: 'baz' }}
${''} | ${'id "foo.bar" version "$baz"'} | ${{ depName: 'foo.bar', skipReason: 'unspecified-version', currentValue: 'baz' }}
${'baz = "1.2.3"'} | ${'id "foo.bar" version "$baz"'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3', groupName: 'baz' }}
${'baz = "1.2.3"'} | ${'id("foo.bar") version "$baz"'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id "foo.bar" version "x${ab}cd"'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version' }}
${''} | ${'id("foo.bar") version "$baz"'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version', currentValue: 'baz' }}
${''} | ${'id("foo.bar") version "x${ab}cd"'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version' }}
${''} | ${'id("foo.bar") version "1" + "2.3"'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version' }}
${''} | ${'id("foo.bar") version property("qux")'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version' }}
${''} | ${'id "foo.bar" version "x${ab}cd"'} | ${{ depName: 'foo.bar', skipReason: 'unspecified-version' }}
${''} | ${'id("foo.bar") version "$baz"'} | ${{ depName: 'foo.bar', skipReason: 'unspecified-version', currentValue: 'baz' }}
${''} | ${'id("foo.bar") version "x${ab}cd"'} | ${{ depName: 'foo.bar', skipReason: 'unspecified-version' }}
${''} | ${'id("foo.bar") version "1" + "2.3"'} | ${{ depName: 'foo.bar', skipReason: 'unspecified-version' }}
${''} | ${'id("foo.bar") version property("qux")'} | ${{ depName: 'foo.bar', skipReason: 'unspecified-version' }}
${'baz = "1.2.3"'} | ${'id("foo.bar") version property("baz")'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id "foo.bar" version baz'} | ${{ depName: 'foo.bar', currentValue: 'baz', skipReason: 'unknown-version' }}
${''} | ${'id "foo.bar" version baz'} | ${{ depName: 'foo.bar', currentValue: 'baz', skipReason: 'unspecified-version' }}
${'baz = "1.2.3"'} | ${'id "foo.bar" version baz'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'id("foo.bar") version baz'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'id("foo.bar").version(baz)'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
Expand Down Expand Up @@ -709,8 +709,8 @@ describe('modules/manager/gradle/parser', () => {
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version(baz)'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version("${baz}")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version(property("baz"))'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version("${baz}xy")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3xy', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version(baz + ".45")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3.45', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version("${baz}xy")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3xy', skipReason: 'unspecified-version' }}
${'baz = "1.2.3"'} | ${'library("foo.bar", "foo", "bar").version(baz + ".45")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3.45', skipReason: 'unspecified-version' }}
${'group = "foo"; artifact = "bar"'} | ${'library("foo.bar", group, artifact).version("1.2.3")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'f = "foo"; b = "bar"'} | ${'library("foo.bar", "${f}", "${b}").version("1.2.3")'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
${'f = "foo"; b = "bar"; v = "1.2.3"'} | ${'library("foo.bar", property("f"), "${b}").version(v)'} | ${{ depName: 'foo:bar', currentValue: '1.2.3' }}
Expand Down Expand Up @@ -919,8 +919,8 @@ describe('modules/manager/gradle/parser', () => {
${''} | ${'spotbugs { toolVersion = "1.2.3" }'} | ${{ depName: 'spotbugs', packageName: GRADLE_PLUGINS['spotbugs'][1], currentValue: '1.2.3' }}
${''} | ${'pmd { toolVersion = "@@@" }'} | ${null}
${''} | ${'pmd { toolVersion = "${baz}" }'} | ${null}
${'baz = "1.2.3"'} | ${'pmd { toolVersion = "${baz}.456" }'} | ${{ depName: 'pmd', currentValue: '1.2.3.456', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'pmd { toolVersion = baz + ".456" }'} | ${{ depName: 'pmd', currentValue: '1.2.3.456', skipReason: 'unknown-version' }}
${'baz = "1.2.3"'} | ${'pmd { toolVersion = "${baz}.456" }'} | ${{ depName: 'pmd', currentValue: '1.2.3.456', skipReason: 'unspecified-version' }}
${'baz = "1.2.3"'} | ${'pmd { toolVersion = baz + ".456" }'} | ${{ depName: 'pmd', currentValue: '1.2.3.456', skipReason: 'unspecified-version' }}
${''} | ${'pmd { [toolVersion = "6.36.0"] }'} | ${null}
${''} | ${'unknown { toolVersion = "1.2.3" }'} | ${null}
${''} | ${'composeOptions { kotlinCompilerExtensionVersion = "1.2.3" }'} | ${{ depName: 'composeOptions', packageName: GRADLE_PLUGINS['composeOptions'][1], currentValue: '1.2.3' }}
Expand Down

0 comments on commit 0417c11

Please sign in to comment.