From 11a0c08db8f35d0daafce9fa271e3059c302e0b4 Mon Sep 17 00:00:00 2001 From: OSS-Bot <93565511+slack-oss-bot@users.noreply.github.com> Date: Mon, 13 May 2024 12:21:20 -0700 Subject: [PATCH] Update lint to v31.5.0-beta01 (#271) * Update lint to v31.5.0-beta01 * Update tests * Spotless * Update baseline --------- Co-authored-by: Zac Sweers --- gradle/libs.versions.toml | 2 +- slack-lint-checks/lint-baseline.xml | 28 ++++++------- ...nFormattedQuantityStringResDetectorTest.kt | 39 ++++++++++++------- .../slack/lint/MoshiEnumUsageDetectorTest.kt | 4 +- .../java/slack/lint/MoshiUsageDetectorTest.kt | 8 ++-- 5 files changed, 45 insertions(+), 36 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6b761ffe..2e1e9e87 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ jdk = "21" # lint checks must target JDK 17, but the runtime should remain 11 lintJvmTarget = "17" runtimeJvmTarget = "11" -lint = "31.5.0-alpha07" +lint = "31.5.0-beta01" [plugins] buildConfig = { id = "com.github.gmazzo.buildconfig", version = "5.3.5" } diff --git a/slack-lint-checks/lint-baseline.xml b/slack-lint-checks/lint-baseline.xml index 3d165c23..38562ebc 100644 --- a/slack-lint-checks/lint-baseline.xml +++ b/slack-lint-checks/lint-baseline.xml @@ -1,5 +1,5 @@ - + @@ -129,7 +129,7 @@ errorLine2=" ~~~~~~~~~"> @@ -140,7 +140,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -151,7 +151,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -162,7 +162,7 @@ errorLine2=" ~~~~~~~~~"> @@ -547,7 +547,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -558,7 +558,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -569,7 +569,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -580,7 +580,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -591,7 +591,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -602,7 +602,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -613,7 +613,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -624,7 +624,7 @@ errorLine2=" ~~~~~~~~~~~~"> diff --git a/slack-lint-checks/src/test/java/slack/lint/ArgInFormattedQuantityStringResDetectorTest.kt b/slack-lint-checks/src/test/java/slack/lint/ArgInFormattedQuantityStringResDetectorTest.kt index 7c1094be..9fa0bb98 100644 --- a/slack-lint-checks/src/test/java/slack/lint/ArgInFormattedQuantityStringResDetectorTest.kt +++ b/slack-lint-checks/src/test/java/slack/lint/ArgInFormattedQuantityStringResDetectorTest.kt @@ -61,13 +61,16 @@ class ArgInFormattedQuantityStringResDetectorTest : BaseSlackLintTest() { ) .run() .expect( - ("src/com/slack/lint/Foo.kt:7: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes]\n" + - " val s = res.getQuantityString(0, 3, 3, \"asdf\")\n" + - " ~\n" + - "src/com/slack/lint/Foo.kt:7: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes]\n" + - " val s = res.getQuantityString(0, 3, 3, \"asdf\")\n" + - " ~~~~\n" + - "0 errors, 2 warnings\n") + """ + src/com/slack/lint/Foo.kt:7: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes] + val s = res.getQuantityString(0, 3, 3, "asdf") + ~ + src/com/slack/lint/Foo.kt:7: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes] + val s = res.getQuantityString(0, 3, 3, "asdf") + ~~~~~~ + 0 errors, 2 warnings + """ + .trimIndent() ) } @@ -195,10 +198,13 @@ class ArgInFormattedQuantityStringResDetectorTest : BaseSlackLintTest() { ) .run() .expect( - "src/com/slack/lint/Foo.kt:8: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes]\n" + - " val s = res.getQuantityString(0, 3, getFormattedCount(), \"asdf\")\n" + - " ~~~~\n" + - "0 errors, 1 warnings\n" + """ + src/com/slack/lint/Foo.kt:8: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes] + val s = res.getQuantityString(0, 3, getFormattedCount(), "asdf") + ~~~~~~ + 0 errors, 1 warnings + """ + .trimIndent() ) } @@ -229,10 +235,13 @@ class ArgInFormattedQuantityStringResDetectorTest : BaseSlackLintTest() { ) .run() .expect( - "src/com/slack/lint/Foo.kt:7: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes]\n" + - " val s = res.getQuantityString(0, 3, LocalizationUtils.getFormattedCount(), \"asdf\")\n" + - " ~~~~\n" + - "0 errors, 1 warnings\n" + """ + src/com/slack/lint/Foo.kt:7: Warning: This may require a localized count modifier. If so, use LocalizationUtils.getFormattedCount(). Consult #plz-localization if you are unsure. [ArgInFormattedQuantityStringRes] + val s = res.getQuantityString(0, 3, LocalizationUtils.getFormattedCount(), "asdf") + ~~~~~~ + 0 errors, 1 warnings + """ + .trimIndent() ) } diff --git a/slack-lint-checks/src/test/java/slack/lint/MoshiEnumUsageDetectorTest.kt b/slack-lint-checks/src/test/java/slack/lint/MoshiEnumUsageDetectorTest.kt index 396c23b4..10fc5c2e 100644 --- a/slack-lint-checks/src/test/java/slack/lint/MoshiEnumUsageDetectorTest.kt +++ b/slack-lint-checks/src/test/java/slack/lint/MoshiEnumUsageDetectorTest.kt @@ -877,7 +877,7 @@ class MoshiEnumUsageDetectorTest : BaseSlackLintTest() { """ src/slack/model/TestEnum.kt:9: Error: Don't use blank names in @Json. [MoshiUsageBlankJsonName] @Json(name = " ") TEST - ~ + ~~~ 1 errors, 0 warnings """ .trimIndent() @@ -943,7 +943,7 @@ class MoshiEnumUsageDetectorTest : BaseSlackLintTest() { """ src/slack/model/Example.kt:9: Warning: Json.name with the same value as the property/enum member name is redundant. [MoshiUsageRedundantJsonName] @Json(name = "VALUE") VALUE - ~~~~~ + ~~~~~~~ 0 errors, 1 warnings """ .trimIndent() diff --git a/slack-lint-checks/src/test/java/slack/lint/MoshiUsageDetectorTest.kt b/slack-lint-checks/src/test/java/slack/lint/MoshiUsageDetectorTest.kt index e14767e7..35488ebc 100644 --- a/slack-lint-checks/src/test/java/slack/lint/MoshiUsageDetectorTest.kt +++ b/slack-lint-checks/src/test/java/slack/lint/MoshiUsageDetectorTest.kt @@ -454,7 +454,7 @@ class MoshiUsageDetectorTest : BaseSlackLintTest() { """ src/slack/model/BaseType.kt:5: Error: Moshi-sealed requires a type label specified after the 'sealed:' prefix. [MoshiUsageBlankTypeLabel] @JsonClass(generateAdapter = true, generator = "sealed:") - ~~~~~~~ + ~~~~~~~~~ 1 errors, 0 warnings """ .trimIndent() @@ -512,7 +512,7 @@ class MoshiUsageDetectorTest : BaseSlackLintTest() { """ src/slack/model/Example.kt:5: Error: Don't use blank JsonClass.generator values. [MoshiUsageBlankGenerator] @JsonClass(generateAdapter = true, generator = " ") - ~ + ~~~ 1 errors, 0 warnings """ .trimIndent() @@ -772,7 +772,7 @@ class MoshiUsageDetectorTest : BaseSlackLintTest() { """ src/slack/model/Example.kt:7: Error: Don't use blank names in @Json. [MoshiUsageBlankJsonName] data class Example(@Json(name = " ") val value: String) - ~ + ~~~ 1 errors, 0 warnings """ .trimIndent() @@ -1936,7 +1936,7 @@ class MoshiUsageDetectorTest : BaseSlackLintTest() { """ src/slack/model/Example.kt:7: Warning: Json.name with the same value as the property/enum member name is redundant. [MoshiUsageRedundantJsonName] data class Example(@Json(name = "value") val value: String) - ~~~~~ + ~~~~~~~ 0 errors, 1 warnings """ .trimIndent()