Skip to content

Commit

Permalink
Update consumer project
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski committed May 12, 2023
1 parent d5e5d92 commit a97ca7e
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal class AndroidProjectTest : WithGradleTest.Android() {
android {
namespace 'io.github.usefulness'
compileSdkVersion 33
compileSdk 33
defaultConfig {
minSdkVersion 23
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal class ModifiedSourceSetsTest : WithGradleTest.Android() {
android {
namespace 'io.github.usefulness'
compileSdkVersion 31
compileSdk 31
defaultConfig {
minSdkVersion 23
}
Expand Down
12 changes: 11 additions & 1 deletion test-project-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ ktlint {
reporters = ["plain"]
}
android {
compileSdkVersion(33)
namespace = "com.ktint_gradle_plugin.example"
defaultConfig {
compileSdk 33
minSdkVersion 26
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion test-project-android/custom-ktlint-rules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ plugins {
}

dependencies {
compileOnly("com.pinterest.ktlint:ktlint-core:0.49.0")
compileOnly("com.pinterest.ktlint:ktlint-cli-ruleset-core:0.49.0")
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package io.github.usefulness.customrules

import com.pinterest.ktlint.core.RuleProvider
import com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3
import com.pinterest.ktlint.rule.engine.core.api.RuleProvider
import com.pinterest.ktlint.rule.engine.core.api.RuleSetId

class CustomRuleSetProvider : RuleSetProviderV3(
"custom-ktlint-rules",
about = NO_ABOUT,
) {
class CustomRuleSetProvider : RuleSetProviderV3(RuleSetId("custom-ktlint-rules")) {

override fun getRuleProviders() = setOf(
RuleProvider { NoNewLineBeforeReturnTypeRule() },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package io.github.usefulness.customrules

import com.pinterest.ktlint.core.Rule
import com.pinterest.ktlint.core.api.EditorConfigProperties
import com.pinterest.ktlint.core.ast.isPartOfComment
import com.pinterest.ktlint.core.ast.isPartOfString
import com.pinterest.ktlint.core.ast.nextLeaf
import com.pinterest.ktlint.rule.engine.core.api.Rule
import com.pinterest.ktlint.rule.engine.core.api.RuleId
import com.pinterest.ktlint.rule.engine.core.api.isPartOfComment
import com.pinterest.ktlint.rule.engine.core.api.isPartOfString
import com.pinterest.ktlint.rule.engine.core.api.nextLeaf
import org.jetbrains.kotlin.com.intellij.lang.ASTNode
import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtPrimaryConstructor
import org.jetbrains.kotlin.psi.KtSecondaryConstructor

class NoNewLineBeforeReturnTypeRule : Rule("no-newline-before-return-type") {
class NoNewLineBeforeReturnTypeRule : Rule(
ruleId = RuleId("custom-ktlint-rules:no-newline-before-return-type"),
about = About()
) {

override fun beforeVisitChildNodes(
node: ASTNode,
Expand Down

0 comments on commit a97ca7e

Please sign in to comment.