Skip to content

Commit

Permalink
refactor: Replace unknown-version skipReason with unspecified-version
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-manba committed May 24, 2023
1 parent ae2d3ee commit 4c3b03c
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 57 deletions.
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
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
2 changes: 1 addition & 1 deletion 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
2 changes: 1 addition & 1 deletion lib/modules/manager/gradle/extract/catalog.ts
Expand Up @@ -151,7 +151,7 @@ function extractLiteralVersion({
}
}

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

function extractDependency({
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
10 changes: 5 additions & 5 deletions lib/modules/manager/gradle/parser/handlers.ts
Expand Up @@ -139,7 +139,7 @@ export function handleKotlinShortNotationDep(ctx: Ctx): Ctx {

if (versionTokens.length > 1) {
// = template string with multiple variables
dep.skipReason = 'unknown-version';
dep.skipReason = 'unspecified-version';
} else if (versionTokens[0].type === 'symbol') {
const varData = findVariable(versionTokens[0].value, ctx);
if (varData) {
Expand Down Expand Up @@ -177,7 +177,7 @@ export function handleLongFormDep(ctx: Ctx): Ctx {
const methodName = ctx.tokenMap.methodName ?? null;
if (versionTokens.length > 1) {
// = template string with multiple variables
dep.skipReason = 'unknown-version';
dep.skipReason = 'unspecified-version';
} else if (versionTokens[0].type === 'symbol') {
const varData = findVariable(versionTokens[0].value, ctx);
if (varData) {
Expand Down Expand Up @@ -227,7 +227,7 @@ export function handlePlugin(ctx: Ctx): Ctx {

if (pluginVersion.length > 1) {
// = template string with multiple variables
dep.skipReason = 'unknown-version';
dep.skipReason = 'unspecified-version';
} else if (pluginVersion[0].type === 'symbol') {
const varData = findVariable(pluginVersion[0].value, ctx);
if (varData) {
Expand All @@ -238,7 +238,7 @@ export function handlePlugin(ctx: Ctx): Ctx {
packageFile: varData.packageFile,
};
} else {
dep.skipReason = 'unknown-version';
dep.skipReason = 'unspecified-version';
}
}

Expand Down Expand Up @@ -409,7 +409,7 @@ export function handleImplicitGradlePlugin(ctx: Ctx): Ctx {

if (versionTokens.length > 1) {
// = template string with multiple variables
dep.skipReason = 'unknown-version';
dep.skipReason = 'unspecified-version';
} else if (versionTokens[0].type === 'symbol') {
const varData = findVariable(versionTokens[0].value, ctx);
if (varData) {
Expand Down
20 changes: 10 additions & 10 deletions lib/modules/manager/npm/extract/__snapshots__/index.spec.ts.snap
Expand Up @@ -73,7 +73,7 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts engine
"depName": "other",
"depType": "devDependencies",
"prettyDepType": "devDependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentValue": ">=1.7.0 <2.0.0",
Expand Down Expand Up @@ -115,7 +115,7 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts engine
"depName": "yarn",
"depType": "engines",
"prettyDepType": "engine",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentValue": ">=1.49.3",
Expand Down Expand Up @@ -159,7 +159,7 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts non-np
"depName": "a",
"depType": "dependencies",
"prettyDepType": "dependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentValue": "github:owner/b#master",
Expand Down Expand Up @@ -216,28 +216,28 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts non-np
"depName": "g",
"depType": "dependencies",
"prettyDepType": "dependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentValue": "github:-hello/world#v1.0.0",
"depName": "h",
"depType": "dependencies",
"prettyDepType": "dependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentValue": "@foo/bar#v2.0.0",
"depName": "i",
"depType": "dependencies",
"prettyDepType": "dependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentValue": "github:frank#v0.0.1",
"depName": "j",
"depType": "dependencies",
"prettyDepType": "dependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
{
"currentDigest": "49b5aca",
Expand Down Expand Up @@ -358,7 +358,7 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts npm pa
"depType": "dependencies",
"npmPackageAlias": true,
"prettyDepType": "dependency",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
],
"extractedConstraints": {},
Expand Down Expand Up @@ -481,7 +481,7 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts volta
}
`;

exports[`modules/manager/npm/extract/index .extractPackageFile() extracts volta yarn unknown-version 1`] = `
exports[`modules/manager/npm/extract/index .extractPackageFile() extracts volta yarn unspecified-version 1`] = `
{
"deps": [
{
Expand Down Expand Up @@ -511,7 +511,7 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts volta
"depName": "yarn",
"depType": "volta",
"prettyDepType": "volta",
"skipReason": "unknown-version",
"skipReason": "unspecified-version",
},
],
"extractedConstraints": {
Expand Down

0 comments on commit 4c3b03c

Please sign in to comment.