Skip to content

Commit

Permalink
ReporterProvider now implements Serializable interface.
Browse files Browse the repository at this point in the history
This is needed for better Gradle plugin support.
  • Loading branch information
Tapchicoma committed Mar 8, 2021
1 parent 7e2c7fd commit 8435fe3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- New `ktlint_ignore_back_ticked_identifier` EditorConfig option for `max-line-length` rule to ignore long method names inside backticks
(primarily used in tests) ([#1007](https://github.com/pinterest/ktlint/issues/1007))
- Allow to add/replace loaded `.editorconfig` values via `ExperimentalParams#editorConfigOverride` ([#1016](https://github.com/pinterest/ktlint/issues/1003))

- `ReporterProvider` now implements `Serializable` interface
### Fixed
- Incorrect indentation with multiple interfaces ([#1003](https://github.com/pinterest/ktlint/issues/1003))
- Empty line before primary constructor is not reported and formatted-out ([#1004](https://github.com/pinterest/ktlint/issues/1004))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.pinterest.ktlint.core

import java.io.PrintStream
import java.io.Serializable

/**
* `ktlint` uses [ServiceLoader](http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html) to
* discover all available [ReporterProvider]s on the classpath and so each [ReporterProvider] must be registered using
* `META-INF/services/com.pinterest.ktlint.core.ReporterProvider`
* (see `ktlint-reporter-plain/src/main/resources` for an example).
*/
interface ReporterProvider {
val id: String
fun get(out: PrintStream, opt: Map<String, String>): Reporter
public interface ReporterProvider : Serializable {
public val id: String
public fun get(out: PrintStream, opt: Map<String, String>): Reporter
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.pinterest.ktlint.core.Reporter
import com.pinterest.ktlint.core.ReporterProvider
import java.io.PrintStream

class BaselineReporterProvider : ReporterProvider {
public class BaselineReporterProvider : ReporterProvider {
override val id: String = "baseline"
override fun get(out: PrintStream, opt: Map<String, String>): Reporter = BaselineReporter(out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.pinterest.ktlint.core.Reporter
import com.pinterest.ktlint.core.ReporterProvider
import java.io.PrintStream

class CheckStyleReporterProvider : ReporterProvider {
public class CheckStyleReporterProvider : ReporterProvider {
override val id: String = "checkstyle"
override fun get(out: PrintStream, opt: Map<String, String>): Reporter = CheckStyleReporter(out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.pinterest.ktlint.core.Reporter
import com.pinterest.ktlint.core.ReporterProvider
import java.io.PrintStream

class HtmlReporterProvider : ReporterProvider {
public class HtmlReporterProvider : ReporterProvider {
override val id: String = "html"
override fun get(out: PrintStream, opt: Map<String, String>): Reporter = HtmlReporter(out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.pinterest.ktlint.core.Reporter
import com.pinterest.ktlint.core.ReporterProvider
import java.io.PrintStream

class JsonReporterProvider : ReporterProvider {
public class JsonReporterProvider : ReporterProvider {
override val id: String = "json"
override fun get(out: PrintStream, opt: Map<String, String>): Reporter = JsonReporter(out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.pinterest.ktlint.core.ReporterProvider
import com.pinterest.ktlint.reporter.plain.internal.Color
import java.io.PrintStream

class PlainReporterProvider : ReporterProvider {
public class PlainReporterProvider : ReporterProvider {

override val id: String = "plain"

Expand Down

0 comments on commit 8435fe3

Please sign in to comment.