From c400fa313ad619093a5f82d2b6d14693c70645cc Mon Sep 17 00:00:00 2001 From: Zongle Wang Date: Tue, 23 Jul 2024 14:44:32 -0400 Subject: [PATCH] Support suppressing backing-property-naming via ObjectPropertyName (#2751) --- .../pinterest/ktlint/rule/engine/internal/SuppressionLocator.kt | 2 +- .../ruleset/standard/rules/BackingPropertyNamingRuleTest.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/internal/SuppressionLocator.kt b/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/internal/SuppressionLocator.kt index 5fa7a31ba8..85c5e66231 100644 --- a/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/internal/SuppressionLocator.kt +++ b/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/internal/SuppressionLocator.kt @@ -264,7 +264,7 @@ internal class SuppressionLocator( "PackageName" to listOf("standard:package-name"), "PropertyName" to listOf("standard:property-naming", "standard:backing-property-naming"), "ConstPropertyName" to listOf("standard:property-naming"), - "ObjectPropertyName" to listOf("standard:property-naming"), + "ObjectPropertyName" to listOf("standard:property-naming", "standard:backing-property-naming"), "PrivatePropertyName" to listOf("standard:property-naming"), "UnusedImport" to listOf("standard:no-unused-imports"), ) diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/BackingPropertyNamingRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/BackingPropertyNamingRuleTest.kt index de5207895d..40cca61c9d 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/BackingPropertyNamingRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/rules/BackingPropertyNamingRuleTest.kt @@ -277,6 +277,7 @@ class BackingPropertyNamingRuleTest { strings = [ "ktlint:standard:backing-property-naming", "PropertyName", // IntelliJ IDEA suppression + "ObjectPropertyName", // IntelliJ IDEA suppression ], ) fun `Given a property with a disallowed name which is suppressed`(suppressionName: String) {