https://kotlinlang.org logo
#android
Title
# android
m

morozov

08/06/2019, 1:19 PM
Hello guys, who can help with ktlint? I try to add my custom ruleset who can take the time?
w

wasyl

08/06/2019, 1:20 PM
I just wanted to paste what you did 🙂 What’s the issue with your custom ruleset?
m

morozov

08/06/2019, 1:36 PM
I'm trying to use my own set of rules in a separate module, but I don't understand what I'm doing wrong. 1. Created module 2. Copied META, within pointed to path, to his class CustomRuleSetProvider.kt 3. in the main project changed the use of ktlint "com.pinterestktlint0.34.2" on ktlint project(':custom_ktlint_rules')
run the task from main project and get next error: https://gist.github.com/mnewlive/35ee21dc534215946e051d986ad8fd82
Also tried to download the project https://github.com/pinterest/ktlint/tree/master/ktlint-ruleset-template and download .jar file to then use it in your project, also something does not work(
w

wasyl

08/06/2019, 1:44 PM
Does your
custom_ktlint_rules
module have Android plugin applied in Gradle? If so, I think you should only apply kotlin one, not android
Just like in the sample there’s
Copy code
plugins {
  id 'org.jetbrains.kotlin.jvm'
  id 'java-library'
  id 'maven'
}
m

morozov

08/06/2019, 2:00 PM
My gradle file in module https://gist.github.com/mnewlive/aa7c61ac75938e96cfdfbd1a514d467f but i can t added import for my CustomRuleSetProvider
not really understand what should be the build.grade in the module
and then i run my task from main project, again get error
too hard for me 😞
basic one, but may provide hints
m

morozov

08/06/2019, 2:43 PM
@tapchicoma i saw this plagin, but problem with my gradle i think
t

tapchicoma

08/06/2019, 2:48 PM
you module with custom ruleset should not use any android plugin
👆 1
m

morozov

08/06/2019, 2:52 PM
@tapchicoma u mean about
Copy code
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
in build.gradle in module?
t

tapchicoma

08/06/2019, 2:52 PM
if you are talking about custom ruleset module
build.gradle
file - yes
m

morozov

08/06/2019, 2:55 PM
t

tapchicoma

08/06/2019, 2:55 PM
yes, but not android one
m

morozov

08/06/2019, 3:09 PM
can I give you access to my project?, I don't see the obvious 100%
t

tapchicoma

08/06/2019, 3:19 PM
you could 🙂
m

morozov

08/06/2019, 3:23 PM
awesome, can u give your email? i will send you an invitation
2 Views