Skip to content

Commit

Permalink
refactor(compare-command): Move an enum classs closer to its use
Browse files Browse the repository at this point in the history
While the `enum class` does not need command context, a nested class in
Kotlin does not have outer class context anyway (only `inner` classes
have), so it does not hurt to scope the enum to the command where it is
being used.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Nov 28, 2023
1 parent b742da7 commit 777b1ff
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions plugins/commands/compare/src/main/kotlin/CompareCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class CompareCommand : OrtCommand(
name = "compare",
help = "Compare two ORT results with various methods."
) {
private enum class CompareMethod { SEMANTIC_DIFF, TEXT_DIFF }

private val fileA by argument(help = "The first ORT result file to compare.")
.convert { it.expandTilde() }
.file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = true)
Expand Down Expand Up @@ -166,11 +168,6 @@ class CompareCommand : OrtCommand(
}
}

private enum class CompareMethod {
SEMANTIC_DIFF,
TEXT_DIFF
}

private class EpochInstantDeserializer : StdDeserializer<Instant>(Instant::class.java) {
override fun deserialize(parser: JsonParser, context: DeserializationContext): Instant =
Instant.EPOCH.also {
Expand Down

0 comments on commit 777b1ff

Please sign in to comment.