diff --git a/.gitignore b/.gitignore
index 50e6a2f..1d1673a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,10 @@
+/pullpitoK
-# Created by https://www.gitignore.io/api/gradle,kotlin,eclipse,intellij,visualstudiocode
-# Edit at https://www.gitignore.io/?templates=gradle,kotlin,eclipse,intellij,visualstudiocode
-### Eclipse ###
+# Created by https://www.toptal.com/developers/gitignore/api/gradle,kotlin,eclipse,intellij+all,visualstudiocode
+# Edit at https://www.toptal.com/developers/gitignore?templates=gradle,kotlin,eclipse,intellij+all,visualstudiocode
+### Eclipse ###
.metadata
bin/
tmp/
@@ -54,26 +55,23 @@ local.properties
# Annotation Processing
.apt_generated/
+.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
-### Eclipse Patch ###
-# Eclipse Core
-.project
-
-# JDT-specific (Eclipse Java Development Tools)
-.classpath
-
-# Annotation Processing
-.apt_generated
+# Uncomment this line if you wish to ignore the project description file.
+# Typically, this file would be tracked if it contains build/dependency configurations:
+#.project
+### Eclipse Patch ###
+# Spring Boot Tooling
.sts4-cache/
-### Intellij ###
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
+### Intellij+all ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
@@ -103,9 +101,14 @@ local.properties
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
-.idea/modules.xml
-.idea/*.iml
-.idea/modules
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
# CMake
cmake-build-*/
@@ -140,13 +143,18 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
-### Intellij Patch ###
-# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+### Intellij+all Patch ###
+# Ignores the whole .idea folder and all .iml files
+# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
-# *.iml
-# modules.xml
-# .idea/misc.xml
-# *.ipr
+.idea/
+
+# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
+
+*.iml
+modules.xml
+.idea/misc.xml
+*.ipr
# Sonarlint plugin
.idea/sonarlint
@@ -182,6 +190,7 @@ hs_err_pid*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
+*.code-workspace
### VisualStudioCode Patch ###
# Ignore all local history of files
@@ -189,7 +198,7 @@ hs_err_pid*
### Gradle ###
.gradle
-/build/
+build/
# Ignore Gradle GUI config
gradle-app.setting
@@ -206,7 +215,4 @@ gradle-app.setting
### Gradle Patch ###
**/build/
-# End of https://www.gitignore.io/api/gradle,kotlin,eclipse,intellij,visualstudiocode
-/.idea/sonarIssues.xml
-/pullpitoK
-/libsunec.*
+# End of https://www.toptal.com/developers/gitignore/api/gradle,kotlin,eclipse,intellij+all,visualstudiocode
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
deleted file mode 100644
index a55e7a1..0000000
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 8144c3c..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index ada92a5..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
deleted file mode 100644
index dfdae52..0000000
--- a/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 4555225..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- IDE
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index e22b24b..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 20b497a..ea1da8a 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,10 @@ An executable file named `pullpitoK` should be generated in the current director
## Dev tasks
+### Format the code
+
+ ./gradlew spotlessApply
+
### Inspect the code
Code inspection is configured on the master branch. See the [sonarcloud.io's dashboard](https://sonarcloud.io/dashboard?id=nicokosi_pullpitoK).
diff --git a/build.gradle.kts b/build.gradle.kts
index 81312e8..acb118d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,6 +6,7 @@ plugins {
id("com.github.ben-manes.versions") version "0.28.0"
id("com.github.johnrengelman.shadow") version "5.2.0"
id("com.adarshr.test-logger") version "2.0.0"
+ id("com.diffplug.gradle.spotless") version "4.5.1"
application
}
@@ -42,3 +43,14 @@ tasks.withType {
}
}
}
+
+spotless {
+ kotlin {
+ ktlint()
+ }
+ kotlinGradle {
+ // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts')
+ target("*.gradle.kts")
+ ktlint()
+ }
+}
diff --git a/src/main/kotlin/pullpitok/App.kt b/src/main/kotlin/pullpitok/App.kt
index d0e1718..07750e4 100644
--- a/src/main/kotlin/pullpitok/App.kt
+++ b/src/main/kotlin/pullpitok/App.kt
@@ -1,10 +1,10 @@
package pullpitok
+import kotlin.system.exitProcess
import pullpitok.github.Action
import pullpitok.github.Event
import pullpitok.github.EventClient
import pullpitok.github.Type
-import kotlin.system.exitProcess
fun main(args: Array) {
if (invalidArguments(args)) {
@@ -44,8 +44,9 @@ private fun perAuthor(events: List): Map> = events
.groupBy { it.actor.login }
internal fun counters(
- eventsPerAuthor: Map>,
- predicate: (Event) -> Boolean): String {
+ eventsPerAuthor: Map>,
+ predicate: (Event) -> Boolean
+): String {
eventsPerAuthor.entries
var counters = ""
for (events in eventsPerAuthor.entries) {
diff --git a/src/main/kotlin/pullpitok/github/EventClient.kt b/src/main/kotlin/pullpitok/github/EventClient.kt
index 2ccc1eb..8ea21cb 100644
--- a/src/main/kotlin/pullpitok/github/EventClient.kt
+++ b/src/main/kotlin/pullpitok/github/EventClient.kt
@@ -39,5 +39,4 @@ class EventClient {
}
private fun fail(message: String): Nothing = throw IllegalArgumentException(message)
-
}
diff --git a/src/test/kotlin/pullpitok/AppTest.kt b/src/test/kotlin/pullpitok/AppTest.kt
index 2cefa46..9d85445 100644
--- a/src/test/kotlin/pullpitok/AppTest.kt
+++ b/src/test/kotlin/pullpitok/AppTest.kt
@@ -1,12 +1,12 @@
package pullpitok
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
import org.junit.Test
import pullpitok.github.Actor
import pullpitok.github.Event
import pullpitok.github.Payload
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertTrue
class AppTest {
@@ -38,5 +38,4 @@ class AppTest {
assertFalse(invalidArguments(arrayOf("org/repo")))
assertFalse(invalidArguments(arrayOf("org/repo", "token")))
}
-
}
diff --git a/src/test/kotlin/pullpitok/github/EventClientTest.kt b/src/test/kotlin/pullpitok/github/EventClientTest.kt
index dcf85fd..7aa5d58 100644
--- a/src/test/kotlin/pullpitok/github/EventClientTest.kt
+++ b/src/test/kotlin/pullpitok/github/EventClientTest.kt
@@ -1,7 +1,7 @@
package pullpitok.github
-import org.junit.Test
import kotlin.test.assertEquals
+import org.junit.Test
class EventClientTest {
@@ -28,5 +28,4 @@ class EventClientTest {
}
private fun loadJsonEventFile() = EventClientTest::class.java.getResource("/events.json").readText()
-
}