File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0
5+ http://maven.apache.org/xsd/maven-4.0.0.xsd" >
6+ <modelVersion >4.0.0</modelVersion >
7+
8+ <version >1.0.0-SNAPSHOT</version >
9+ <groupId >com.baeldung</groupId >
10+ <artifactId >ktlint-custom</artifactId >
11+
12+ <dependencies >
13+
14+ <!-- https://mvnrepository.com/artifact/com.pinterest.ktlint/ktlint-core -->
15+ <dependency >
16+ <groupId >com.pinterest.ktlint</groupId >
17+ <artifactId >ktlint-core</artifactId >
18+ <version >0.43.2</version >
19+ </dependency >
20+
21+ <!-- https://mvnrepository.com/artifact/com.pinterest.ktlint/ktlint-cli-reporter-core -->
22+ <dependency >
23+ <groupId >com.pinterest.ktlint</groupId >
24+ <artifactId >ktlint-cli-ruleset-core</artifactId >
25+ <version >1.0.1</version >
26+ <scope >runtime</scope >
27+ </dependency >
28+
29+ </dependencies >
30+ </project >
Original file line number Diff line number Diff line change 1+ import com.pinterest.ktlint.core.RuleSet
2+ import com.pinterest.ktlint.core.RuleSetProvider
3+
4+ class CustomRuleSetProvider : RuleSetProvider {
5+ override fun get ()
6+ = RuleSet (" custom-ktlint-rules" , TempRule ())
7+ }
Original file line number Diff line number Diff line change 1+ import com.pinterest.ktlint.core.Rule
2+ import org.jetbrains.kotlin.com.intellij.lang.ASTNode
3+
4+ class TempRule : Rule (" no-var" ) {
5+ override fun visit (
6+ node : ASTNode ,
7+ autoCorrect : Boolean ,
8+ emit : (offset: Int , errorMessage: String , canBeAutoCorrected: Boolean ) -> Unit
9+ ) {
10+ emit(node.startOffset, " #### TEST: KTLINT ERROR" , false )
11+ }
12+ }
Original file line number Diff line number Diff line change 2323 <id >kotlin-eap</id >
2424 <url >https://dl.bintray.com/kotlin/kotlin-eap/</url >
2525 </repository >
26+ <repository >
27+ <id >maven-central</id >
28+ <url >https://repo1.maven.org/maven2</url >
29+ </repository >
2630 </repositories >
2731
2832 <pluginRepositories >
124128
125129 <build >
126130 <plugins >
131+ <plugin >
132+ <groupId >com.github.z3d1k</groupId >
133+ <artifactId >ktlint-maven-plugin</artifactId >
134+ <version >0.10.0</version >
135+ <executions >
136+ <execution >
137+ <goals >
138+ <goal >lint</goal >
139+ </goals >
140+ </execution >
141+ </executions >
142+ <dependencies >
143+ <dependency >
144+ <groupId >com.baeldung</groupId >
145+ <artifactId >ktlint-custom</artifactId >
146+ <version >1.0.0-SNAPSHOT</version >
147+ </dependency >
148+ </dependencies >
149+ </plugin >
127150 <plugin >
128151 <groupId >org.jetbrains.kotlin</groupId >
129152 <artifactId >kotlin-maven-plugin</artifactId >
274297 <module >parent-boot-2</module >
275298 <module >parent-boot-3</module >
276299
300+ <module >ktlint-custom</module >
301+
277302 <module >core-kotlin-modules</module >
278303 <module >core-kotlin-companion</module >
279304 <!-- <module>jee-kotlin</module> fixing in https://jira.baeldung.com/browse/KTLN-426 -->
You can’t perform that action at this time.
0 commit comments