From 5946790b6601471363ab06907638d3b9ec81a862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Papp?= <papp.robert.s@gmail.com> Date: Mon, 4 Apr 2022 05:05:07 +0100 Subject: [PATCH] fix(gradle): Ignore Kotlin collection methods as dependencies (#14925) --- lib/modules/manager/gradle/parser.spec.ts | 18 +++++++++++++++++- lib/modules/manager/gradle/parser.ts | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/modules/manager/gradle/parser.spec.ts b/lib/modules/manager/gradle/parser.spec.ts index ebea44eb7c..ef1593f2f5 100644 --- a/lib/modules/manager/gradle/parser.spec.ts +++ b/lib/modules/manager/gradle/parser.spec.ts @@ -35,7 +35,6 @@ describe('modules/manager/gradle/parser', () => { ${'group: "foo", name: "bar", version: depVersion'} | ${null} ${'("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' }} - ${'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' }} `('$input', ({ input, output }) => { const { deps } = parseGradle(input); @@ -43,6 +42,23 @@ describe('modules/manager/gradle/parser', () => { }); }); + describe('annoying methods', () => { + test.each` + input | output + ${'createXmlValueRemover("defaults", "integer", "integer")'} | ${{ depName: 'defaults:integer', currentValue: 'integer', skipReason: 'ignored' }} + ${'events("passed", "skipped", "failed")'} | ${{ depName: 'passed:skipped', currentValue: 'failed', skipReason: 'ignored' }} + ${'args("foo", "bar", "baz")'} | ${{ depName: 'foo:bar', currentValue: 'baz', skipReason: 'ignored' }} + ${'arrayOf("foo", "bar", "baz")'} | ${{ depName: 'foo:bar', currentValue: 'baz', skipReason: 'ignored' }} + ${'listOf("foo", "bar", "baz")'} | ${{ depName: 'foo:bar', currentValue: 'baz', skipReason: 'ignored' }} + ${'mutableListOf("foo", "bar", "baz")'} | ${{ depName: 'foo:bar', currentValue: 'baz', skipReason: 'ignored' }} + ${'setOf("foo", "bar", "baz")'} | ${{ depName: 'foo:bar', currentValue: 'baz', skipReason: 'ignored' }} + ${'mutableSetOf("foo", "bar", "baz")'} | ${{ depName: 'foo:bar', currentValue: 'baz', skipReason: 'ignored' }} + `('$input', ({ input, output }) => { + const { deps } = parseGradle(input); + expect(deps).toMatchObject([output].filter(Boolean)); + }); + }); + describe('variable substitutions', () => { test.each` def | str | output diff --git a/lib/modules/manager/gradle/parser.ts b/lib/modules/manager/gradle/parser.ts index bde5535af8..7f1cbc78b6 100644 --- a/lib/modules/manager/gradle/parser.ts +++ b/lib/modules/manager/gradle/parser.ts @@ -305,7 +305,11 @@ const annoyingMethods = new Set([ 'createXmlValueRemover', 'events', 'args', + 'arrayOf', 'listOf', + 'mutableListOf', + 'setOf', + 'mutableSetOf', ]); function processLongFormDep({ -- GitLab