Skip to content

Commit

Permalink
Config: in dynamic, allow stable or actual version
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 10, 2022
1 parent e16350e commit 5edda12
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalafmt.config
import java.nio.file.Path

import metaconfig._
import org.scalafmt.Versions.{stable => stableVersion}
import org.scalafmt.Versions

// NOTE: these methods are intended for internal usage and are subject to
// binary and source breaking changes between any release. For a stable API
Expand Down Expand Up @@ -32,9 +32,11 @@ object Config {
): Configured[ScalafmtConfig] = {
ScalafmtConfig.decoder.read(Option(default), parsed.conf) match {
case Configured.Ok(x)
if default.version == null && x.version != stableVersion =>
if default.version == null &&
x.version != Versions.stable && x.version != Versions.version =>
val version = Option(x.version).getOrElse("missing")
Configured.error(s"version [expected $stableVersion]: $version")
val expected = s"${Versions.stable} or ${Versions.version}"
Configured.error(s"version [expected $expected]: $version")
case Configured.Ok(x)
if default.eq(ScalafmtConfig.uncheckedDefault) &&
x.runner.isDefaultDialect =>
Expand Down

0 comments on commit 5edda12

Please sign in to comment.