Skip to content
Open
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 @@ -25,6 +25,7 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies

abstract class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
Expand All @@ -44,6 +45,10 @@ abstract class AndroidApplicationConventionPlugin : Plugin<Project> {
configureBadgingTasks(this)
}
configureSpotlessForAndroid()

dependencies {
"compileOnly"(project(":lint"))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ abstract class AndroidLibraryConventionPlugin : Plugin<Project> {
}
configureSpotlessForAndroid()
dependencies {
"androidTestImplementation"(libs.findLibrary("kotlin.test").get())
if (project.path != ":lint") "compileOnly"(project(":lint"))
"implementation"(libs.findLibrary("androidx.tracing.ktx").get())

"testImplementation"(libs.findLibrary("kotlin.test").get())
"testImplementation"(libs.findLibrary("junit").get())

"implementation"(libs.findLibrary("androidx.tracing.ktx").get())
"androidTestImplementation"(libs.findLibrary("kotlin.test").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ class AndroidLintConventionPlugin : Plugin<Project> {
private fun Lint.configure() {
xmlReport = true
sarifReport = true
checkDependencies = true
disable += "GradleDependency"
}
2 changes: 0 additions & 2 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ android {
}

dependencies {
lintPublish(projects.lint)

api(libs.androidx.compose.foundation)
api(libs.androidx.compose.foundation.layout)
api(libs.androidx.compose.material.iconsExtended)
Expand Down
22 changes: 22 additions & 0 deletions core/designsystem/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 The Android Open Source Project

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.
-->
<lint>
<!--
DesignSystem lint check doesn't need on `designsystem` module.
-->
<issue id="DesignSystem" severity="ignore"/>
</lint>
2 changes: 1 addition & 1 deletion lint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
:lint[lint]:::unknown
:lint[lint]:::android-library

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
Expand Down
25 changes: 4 additions & 21 deletions lint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,14 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
`java-library`
kotlin("jvm")
alias(libs.plugins.nowinandroid.android.lint)
}

java {
// Up to Java 11 APIs are available through desugaring
// https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
alias(libs.plugins.nowinandroid.android.library)
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
android {
namespace = "com.google.samples.apps.nowinandroid.lint"
}

dependencies {
compileOnly(libs.kotlin.stdlib)
compileOnly(libs.lint.api)
testImplementation(libs.kotlin.test)
testImplementation(libs.lint.checks)
testImplementation(libs.lint.tests)
lintPublish(projects.lint.impl)
}
1 change: 1 addition & 0 deletions lint/impl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
48 changes: 48 additions & 0 deletions lint/impl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# `:lint:impl`

## Module dependency graph

<!--region graph-->
```mermaid
---
config:
layout: elk
elk:
nodePlacementStrategy: SIMPLE
---
graph TB
subgraph :lint
direction TB
:lint:impl[impl]:::unknown
end

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
```

<details><summary>📋 Graph legend</summary>

```mermaid
graph TB
application[application]:::android-application
feature[feature]:::android-feature
library[library]:::android-library
jvm[jvm]:::jvm-library

application -.-> feature
library --> jvm

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
```

</details>
<!--endregion-->
44 changes: 44 additions & 0 deletions lint/impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2026 The Android Open Source Project
*
* 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
*
* https://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.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
`java-library`
kotlin("jvm")
alias(libs.plugins.nowinandroid.android.lint)
}

java {
// Up to Java 11 APIs are available through desugaring
// https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
}

dependencies {
compileOnly(libs.kotlin.stdlib)
compileOnly(libs.lint.api)
testImplementation(libs.kotlin.test)
testImplementation(libs.lint.checks)
testImplementation(libs.lint.tests)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2026 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,12 +14,12 @@
* limitations under the License.
*/

package com.google.samples.apps.nowinandroid.lint
package com.google.samples.apps.nowinandroid.lint.impl

import com.android.tools.lint.client.api.IssueRegistry
import com.android.tools.lint.client.api.Vendor
import com.android.tools.lint.detector.api.CURRENT_API
import com.google.samples.apps.nowinandroid.lint.designsystem.DesignSystemDetector
import com.google.samples.apps.nowinandroid.lint.impl.designsystem.DesignSystemDetector

class NiaIssueRegistry : IssueRegistry() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.samples.apps.nowinandroid.lint
package com.google.samples.apps.nowinandroid.lint.impl

import com.android.tools.lint.detector.api.AnnotationInfo
import com.android.tools.lint.detector.api.AnnotationUsageInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.samples.apps.nowinandroid.lint.designsystem
package com.google.samples.apps.nowinandroid.lint.impl.designsystem

import com.android.tools.lint.client.api.UElementHandler
import com.android.tools.lint.detector.api.Category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#

com.google.samples.apps.nowinandroid.lint.NiaIssueRegistry
com.google.samples.apps.nowinandroid.lint.impl.NiaIssueRegistry
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 The Android Open Source Project
* Copyright 2026 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,14 +14,14 @@
* limitations under the License.
*/

package com.google.samples.apps.nowinandroid.lint.designsystem
package com.google.samples.apps.nowinandroid.lint.impl.designsystem

import com.android.tools.lint.checks.infrastructure.TestFile
import com.android.tools.lint.checks.infrastructure.TestFiles.kotlin
import com.android.tools.lint.checks.infrastructure.TestLintTask.lint
import com.google.samples.apps.nowinandroid.lint.designsystem.DesignSystemDetector.Companion.ISSUE
import com.google.samples.apps.nowinandroid.lint.designsystem.DesignSystemDetector.Companion.METHOD_NAMES
import com.google.samples.apps.nowinandroid.lint.designsystem.DesignSystemDetector.Companion.RECEIVER_NAMES
import com.google.samples.apps.nowinandroid.lint.impl.designsystem.DesignSystemDetector.Companion.ISSUE
import com.google.samples.apps.nowinandroid.lint.impl.designsystem.DesignSystemDetector.Companion.METHOD_NAMES
import com.google.samples.apps.nowinandroid.lint.impl.designsystem.DesignSystemDetector.Companion.RECEIVER_NAMES
import org.junit.Test

class DesignSystemDetectorTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 The Android Open Source Project
* Copyright 2026 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,13 +14,13 @@
* limitations under the License.
*/

package com.google.samples.apps.nowinandroid.lint
package com.google.samples.apps.nowinandroid.lint.impl.designsystem

import com.android.tools.lint.checks.infrastructure.TestFile
import com.android.tools.lint.checks.infrastructure.TestFiles.kotlin
import com.android.tools.lint.checks.infrastructure.TestLintTask.lint
import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.FORMAT
import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.PREFIX
import com.google.samples.apps.nowinandroid.lint.impl.TestMethodNameDetector.Companion.FORMAT
import com.google.samples.apps.nowinandroid.lint.impl.TestMethodNameDetector.Companion.PREFIX
import org.junit.Test

class TestMethodNameDetectorTest {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ include(":feature:search:api")
include(":feature:search:impl")
include(":feature:settings:impl")
include(":lint")
include(":lint:impl")
include(":sync:work")
include(":sync:sync-test")
include(":ui-test-hilt-manifest")
Expand Down
Loading