diff --git a/chaidemo/build.gradle.kts b/chaidemo/build.gradle.kts index 942f4e0..b0af85a 100755 --- a/chaidemo/build.gradle.kts +++ b/chaidemo/build.gradle.kts @@ -70,6 +70,7 @@ android { dependencies { implementation(project(":chai")) + implementation(project(":chailinter:linter")) implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) diff --git a/chailinter/.gitignore b/chailinter/.gitignore deleted file mode 100755 index 42afabf..0000000 --- a/chailinter/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/chailinter/linter/build.gradle.kts b/chailinter/linter/build.gradle.kts new file mode 100644 index 0000000..acd9b3a --- /dev/null +++ b/chailinter/linter/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin.android) +} + +android { + namespace = "com.droidconke.chailinter.linter" + compileSdk = 35 +} + +dependencies { + implementation(project(":chailinter:rules")) + lintPublish(project(":chailinter:rules")) +} diff --git a/chailinter/rules/.gitignore b/chailinter/rules/.gitignore new file mode 100755 index 0000000..796b96d --- /dev/null +++ b/chailinter/rules/.gitignore @@ -0,0 +1 @@ +/build diff --git a/chailinter/build.gradle.kts b/chailinter/rules/build.gradle.kts similarity index 68% rename from chailinter/build.gradle.kts rename to chailinter/rules/build.gradle.kts index d094082..15b1ff9 100755 --- a/chailinter/build.gradle.kts +++ b/chailinter/rules/build.gradle.kts @@ -15,21 +15,6 @@ */ import org.jetbrains.kotlin.gradle.dsl.JvmTarget -/** - * Copyright 2023 droidcoke - * - * 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. - */ plugins { `java-library` kotlin("jvm") diff --git a/chailinter/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt b/chailinter/rules/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt similarity index 99% rename from chailinter/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt rename to chailinter/rules/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt index 58d3106..a1b0025 100755 --- a/chailinter/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt +++ b/chailinter/rules/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt @@ -56,4 +56,4 @@ class ChaiLinterIssueRegistry : IssueRegistry() { feedbackUrl = "https://github.com/droidconKE/chai/issues/new/choose", contact = "https://github.com/droidconKE/chai" ) -} \ No newline at end of file +} diff --git a/chailinter/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt b/chailinter/rules/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt similarity index 97% rename from chailinter/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt rename to chailinter/rules/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt index 59fdbbb..01ca1a7 100755 --- a/chailinter/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt +++ b/chailinter/rules/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt @@ -25,9 +25,9 @@ import org.jetbrains.uast.* /** * This checks whether there are incorrect usages of Compose Material APIs over equivalents in - * the chai design system. Ideally its to be as dictatorial as possible to prevent people from using + * the chai design system. Ideally its to be as dictatorial as possible to prevent people from using * default material designs and moving away from the design system. - * + * * We have tried to capture as much as many UI scenarios as possible in chai. Incase of a missing * design component, then it is recommended to submit an issue and then implement the * component missing in chai. @@ -61,7 +61,7 @@ class ChaiIncorrectUsageDetector : Detector(), Detector.UastScanner { override fun visitSimpleNameReferenceExpression(node: USimpleNameReferenceExpression) { val className = (node.resolve() as? PsiMember)?.containingClass?.qualifiedName ?: return } - + } } /*Adding this as an empty array but will be replaced later when adding implementations*/ @@ -109,4 +109,4 @@ class ChaiIncorrectUsageDetector : Detector(), Detector.UastScanner { * */ //To be implemented with above format -private val METHOD_NAMES = mapOf() \ No newline at end of file +private val METHOD_NAMES = mapOf() diff --git a/chailinter/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt b/chailinter/rules/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt similarity index 99% rename from chailinter/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt rename to chailinter/rules/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt index 82745d1..74dd56e 100755 --- a/chailinter/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt +++ b/chailinter/rules/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt @@ -24,4 +24,4 @@ class IncorrectColourUsageDetector : Detector(), Detector.UastScanner { companion object { val ISSUE: Any = EMPTY_ARRAY } -} \ No newline at end of file +} diff --git a/chailinter/rules/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry b/chailinter/rules/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry new file mode 100644 index 0000000..545c70c --- /dev/null +++ b/chailinter/rules/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry @@ -0,0 +1 @@ +com.droidconke.chailinter.ChaiLinterIssueRegistry diff --git a/settings.gradle.kts b/settings.gradle.kts index 99cbc9b..5aa9b4f 100755 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,7 +13,7 @@ dependencyResolutionManagement { } } rootProject.name = ("chai") -//include(":chai") include(":chaidemo") -include(":chailinter") +include(":chailinter:rules") +include(":chailinter:linter") include(":chai")