From 63170b2a8351ebb0f391d6a77fd2855a94b9382f Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 24 Apr 2020 23:16:48 -0400 Subject: [PATCH] Add linting configs --- build.gradle | 4 +- common.gradle | 5 ++ ktlintCodeStyle.xml | 136 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 ktlintCodeStyle.xml diff --git a/build.gradle b/build.gradle index 099a09d54..b42d511a7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,15 @@ buildscript { ext.kotlin_version = '1.3.70' repositories { - jcenter() google() + maven { url 'https://plugins.gradle.org/m2/' } + jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.6.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath 'org.jmailen.gradle:kotlinter-gradle:2.3.2' } } diff --git a/common.gradle b/common.gradle index cffedb218..6445349f7 100644 --- a/common.gradle +++ b/common.gradle @@ -1,3 +1,5 @@ +apply plugin: 'org.jmailen.kotlinter' + android { compileSdkVersion 27 buildToolsVersion '29.0.3' @@ -53,3 +55,6 @@ dependencies { compileOnly 'io.reactivex:rxjava:1.3.6' compileOnly 'org.jsoup:jsoup:1.10.2' } + +preBuild.dependsOn(lintKotlin) +lintKotlin.dependsOn(formatKotlin) diff --git a/ktlintCodeStyle.xml b/ktlintCodeStyle.xml new file mode 100644 index 000000000..e1422c7c8 --- /dev/null +++ b/ktlintCodeStyle.xml @@ -0,0 +1,136 @@ + + + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+ + +
\ No newline at end of file