Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup lint rules #63

Draft
wants to merge 8 commits into
base: chai-linter
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions chaidemo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ android {

dependencies {
implementation(project(":chai"))
implementation(project(":chailinter:linter"))

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
1 change: 0 additions & 1 deletion chailinter/.gitignore

This file was deleted.

14 changes: 14 additions & 0 deletions chailinter/linter/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"))
}
1 change: 1 addition & 0 deletions chailinter/rules/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
15 changes: 0 additions & 15 deletions chailinter/build.gradle.kts → chailinter/rules/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ class ChaiLinterIssueRegistry : IssueRegistry() {
feedbackUrl = "https://github.com/droidconKE/chai/issues/new/choose",
contact = "https://github.com/droidconKE/chai"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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*/
Expand Down Expand Up @@ -109,4 +109,4 @@ class ChaiIncorrectUsageDetector : Detector(), Detector.UastScanner {
*
*/
//To be implemented with above format
private val METHOD_NAMES = mapOf<String, Int>()
private val METHOD_NAMES = mapOf<String, Int>()
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class IncorrectColourUsageDetector : Detector(), Detector.UastScanner {
companion object {
val ISSUE: Any = EMPTY_ARRAY
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.droidconke.chailinter.ChaiLinterIssueRegistry
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencyResolutionManagement {
}
}
rootProject.name = ("chai")
//include(":chai")
include(":chaidemo")
include(":chailinter")
include(":chailinter:rules")
include(":chailinter:linter")
include(":chai")