Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public class ComposeGuardInspection : LocalInspectionTool() {

override fun getGroupDisplayName(): String = "Compose"

override fun getShortName(): String = "ComposeRules"
override fun getShortName(): String = "ComposeGuard"

override fun isEnabledByDefault(): Boolean = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Designed and developed by 2025 androidpoet (Ranbir Singh)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.androidpoet.composeguard.inspection

import org.xml.sax.InputSource
import javax.xml.parsers.DocumentBuilderFactory
import kotlin.test.Test
import kotlin.test.assertEquals

class InspectionRegistrationTest {

@Test
fun shortNameInPluginXmlMatchesInspectionClass() {
val implClass = ComposeGuardInspection::class.java.name
val stream = javaClass.classLoader.getResourceAsStream("META-INF/plugin.xml")!!
val doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(InputSource(stream))
val nodes = doc.getElementsByTagName("localInspection")

val xmlShortName = (0 until nodes.length)
.map { nodes.item(it) }
.first { it.attributes.getNamedItem("implementationClass")?.nodeValue == implClass }
.attributes.getNamedItem("shortName").nodeValue

assertEquals(xmlShortName, ComposeGuardInspection().shortName)
}
}
Loading