From 50cccbcc474f518de2094b2de495ea2afdabd3c3 Mon Sep 17 00:00:00 2001 From: theophiluskibet Date: Thu, 26 Sep 2024 15:24:05 +0300 Subject: [PATCH 1/7] remove double declaration of copyright --- chailinter/build.gradle.kts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/chailinter/build.gradle.kts b/chailinter/build.gradle.kts index d094082..15b1ff9 100755 --- a/chailinter/build.gradle.kts +++ b/chailinter/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") From 5ab4d905ae84196aa36bcba87b692a997be21946 Mon Sep 17 00:00:00 2001 From: theophiluskibet Date: Thu, 26 Sep 2024 15:26:04 +0300 Subject: [PATCH 2/7] register issue registry --- .../services/com.android.tools.lint.client.api.IssueRegistry | 1 + 1 file changed, 1 insertion(+) create mode 100644 chailinter/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry diff --git a/chailinter/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry b/chailinter/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry new file mode 100644 index 0000000..877a01b --- /dev/null +++ b/chailinter/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry @@ -0,0 +1 @@ +com.droidconke.chailinter.ChaiLinterIssueRegistry \ No newline at end of file From 2ed38b80973ad28d0a36204311f0f1d5ba1a3d63 Mon Sep 17 00:00:00 2001 From: theophiluskibet Date: Thu, 26 Sep 2024 15:55:40 +0300 Subject: [PATCH 3/7] add linter and rules modules --- chailinter/linter/build.gradle.kts | 13 +++++++++++++ chailinter/{ => rules}/.gitignore | 0 chailinter/{ => rules}/build.gradle.kts | 0 .../chailinter/ChaiLinterIssueRegistry.kt | 0 .../detector/ChaiIncorrectUsageDetector.kt | 0 .../detector/IncorrectColourUsageDetector.kt | 0 .../com.android.tools.lint.client.api.IssueRegistry | 0 settings.gradle.kts | 4 ++-- 8 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 chailinter/linter/build.gradle.kts rename chailinter/{ => rules}/.gitignore (100%) rename chailinter/{ => rules}/build.gradle.kts (100%) rename chailinter/{ => rules}/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt (100%) rename chailinter/{ => rules}/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt (100%) rename chailinter/{ => rules}/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt (100%) rename chailinter/{ => rules}/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry (100%) diff --git a/chailinter/linter/build.gradle.kts b/chailinter/linter/build.gradle.kts new file mode 100644 index 0000000..fc77215 --- /dev/null +++ b/chailinter/linter/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.jetbrains.kotlin.android) +} + +android { + namespace = "com.droidconke.chailinter.linter" +} + +dependencies { + implementation(project(":chailinter:rules")) + lintPublish(project(":chailinter:rules")) +} diff --git a/chailinter/.gitignore b/chailinter/rules/.gitignore similarity index 100% rename from chailinter/.gitignore rename to chailinter/rules/.gitignore diff --git a/chailinter/build.gradle.kts b/chailinter/rules/build.gradle.kts similarity index 100% rename from chailinter/build.gradle.kts rename to chailinter/rules/build.gradle.kts 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 100% rename from chailinter/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt rename to chailinter/rules/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt 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 100% 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 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 100% 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 diff --git a/chailinter/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 similarity index 100% rename from chailinter/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry rename to chailinter/rules/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry 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") From 7c7a7deddd1d3d133c9e72b2f7405c8d759e7903 Mon Sep 17 00:00:00 2001 From: theophiluskibet Date: Thu, 26 Sep 2024 16:16:15 +0300 Subject: [PATCH 4/7] add compile sdk --- chailinter/linter/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/chailinter/linter/build.gradle.kts b/chailinter/linter/build.gradle.kts index fc77215..acd9b3a 100644 --- a/chailinter/linter/build.gradle.kts +++ b/chailinter/linter/build.gradle.kts @@ -5,6 +5,7 @@ plugins { android { namespace = "com.droidconke.chailinter.linter" + compileSdk = 35 } dependencies { From e12ca3cf9336d685f390f611d07b3ea5e1512be6 Mon Sep 17 00:00:00 2001 From: theophiluskibet Date: Thu, 26 Sep 2024 16:16:26 +0300 Subject: [PATCH 5/7] add linter as dep in demo --- chaidemo/build.gradle.kts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chaidemo/build.gradle.kts b/chaidemo/build.gradle.kts index 942f4e0..942f9f6 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) @@ -89,3 +90,7 @@ dependencies { debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) } + +//tasks.register("chaiLint"){ +// dependsOn("lint") +//} From e455b2db53f80e14736b50279dc6dc52743faf24 Mon Sep 17 00:00:00 2001 From: Kibet Theo <61080898+kibettheophilus@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:49:45 +0300 Subject: [PATCH 6/7] Update build.gradle.kts --- chaidemo/build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/chaidemo/build.gradle.kts b/chaidemo/build.gradle.kts index 942f9f6..b0af85a 100755 --- a/chaidemo/build.gradle.kts +++ b/chaidemo/build.gradle.kts @@ -90,7 +90,3 @@ dependencies { debugImplementation(libs.androidx.ui.tooling) debugImplementation(libs.androidx.ui.test.manifest) } - -//tasks.register("chaiLint"){ -// dependsOn("lint") -//} From 8f9b2f59edfa9bdf5da558b213bafe22d718cec8 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 8 Oct 2024 07:49:49 +0000 Subject: [PATCH 7/7] Restyled by whitespace --- chailinter/rules/.gitignore | 2 +- .../com/droidconke/chailinter/ChaiLinterIssueRegistry.kt | 2 +- .../chailinter/detector/ChaiIncorrectUsageDetector.kt | 8 ++++---- .../chailinter/detector/IncorrectColourUsageDetector.kt | 2 +- .../com.android.tools.lint.client.api.IssueRegistry | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chailinter/rules/.gitignore b/chailinter/rules/.gitignore index 42afabf..796b96d 100755 --- a/chailinter/rules/.gitignore +++ b/chailinter/rules/.gitignore @@ -1 +1 @@ -/build \ No newline at end of file +/build diff --git a/chailinter/rules/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt b/chailinter/rules/src/main/java/com/droidconke/chailinter/ChaiLinterIssueRegistry.kt index 58d3106..a1b0025 100755 --- a/chailinter/rules/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/rules/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt b/chailinter/rules/src/main/java/com/droidconke/chailinter/detector/ChaiIncorrectUsageDetector.kt index 59fdbbb..01ca1a7 100755 --- a/chailinter/rules/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/rules/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt b/chailinter/rules/src/main/java/com/droidconke/chailinter/detector/IncorrectColourUsageDetector.kt index 82745d1..74dd56e 100755 --- a/chailinter/rules/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 index 877a01b..545c70c 100644 --- 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 @@ -1 +1 @@ -com.droidconke.chailinter.ChaiLinterIssueRegistry \ No newline at end of file +com.droidconke.chailinter.ChaiLinterIssueRegistry