Skip to content

Commit ad9224b

Browse files
authored
Merge pull request #442 from xuwei-k/string-interpolation
use string interpolation instead of `format` method
2 parents fc00d48 + 70bf033 commit ad9224b

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/main/scala/com/typesafe/sbteclipse/core/Eclipse.scala

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private object Eclipse extends EclipseSDTConfig {
176176

177177
def onFailure(state: State)(errors: NonEmptyList[String]): State = {
178178
state.log.error(
179-
"Could not create Eclipse project files:%s%s".format(NewLine, List(errors.list).mkString(NewLine)))
179+
s"Could not create Eclipse project files:${NewLine}${List(errors.list).mkString(NewLine)}")
180180
state
181181
}
182182

@@ -186,9 +186,7 @@ private object Eclipse extends EclipseSDTConfig {
186186
state.log.warn("There was no project to create Eclipse project files for!")
187187
else
188188
state.log.info(
189-
"Successfully created Eclipse project files for project(s):%s%s".format(
190-
NewLine,
191-
names mkString NewLine))
189+
s"Successfully created Eclipse project files for project(s):${NewLine}${names mkString NewLine}")
192190
state
193191
}
194192

@@ -391,18 +389,15 @@ private object Eclipse extends EclipseSDTConfig {
391389
if (buildDirectory === baseDirectory) Some(".") else sbt.IO.relativize(buildDirectory, baseDirectory)
392390
val relativizedFile = sbt.IO.relativize(buildDirectory, file)
393391
val relativized = (relativizedBase |@| relativizedFile)((base, file) =>
394-
"%s%s%s".format(
395-
base split FileSepPattern map (part => if (part != ".") ".." else part) mkString FileSep,
396-
FileSep,
397-
file))
392+
s"${base split FileSepPattern map (part => if (part != ".") ".." else part) mkString FileSep}${FileSep}${file}")
398393
if (relativizeLibs) relativized getOrElse file.getAbsolutePath else file.getAbsolutePath
399394
}
400395
EclipseClasspathEntry.Lib(path(lib.binary), lib.source map path, lib.javadoc map path)
401396
}
402397

403398
def jreContainer(executionEnvironment: Option[EclipseExecutionEnvironment.Value]): String =
404399
executionEnvironment match {
405-
case Some(ee) => "%s/%s/%s".format(JreContainer, StandardVmType, ee)
400+
case Some(ee) => s"${JreContainer}/${StandardVmType}/${ee}"
406401
case None => JreContainer
407402
}
408403

@@ -565,11 +560,7 @@ private object Eclipse extends EclipseSDTConfig {
565560
}
566561
val externalDependencies = (externalDependencyClasspath |@| moduleFiles)(libs)
567562
state.log.debug(
568-
"External dependencies for configuration '%s' and withSource '%s' and withJavadoc '%s': %s".format(
569-
configuration,
570-
withSource,
571-
withJavadoc,
572-
externalDependencies))
563+
s"External dependencies for configuration '${configuration}' and withSource '${withSource}' and withJavadoc '${withJavadoc}': ${externalDependencies}")
573564
externalDependencies
574565
}
575566

@@ -583,7 +574,7 @@ private object Eclipse extends EclipseSDTConfig {
583574
settingValidation((dependency.project / Keys.name), state)
584575
}
585576
val projectDependenciesSeq = projectDependencies.toList.sequence
586-
state.log.debug("Project dependencies for configuration '%s': %s".format(configuration, projectDependenciesSeq))
577+
state.log.debug(s"Project dependencies for configuration '${configuration}': ${projectDependenciesSeq}")
587578
projectDependenciesSeq
588579
}
589580

@@ -769,22 +760,22 @@ private object Eclipse extends EclipseSDTConfig {
769760
def settingValidation[A](key: SettingKey[A], state: State): Validation[A] =
770761
key.get(structure(state).data) match {
771762
case Some(a) => a.success
772-
case None => "Undefined setting '%s'!".format(key.key).failureNel
763+
case None => s"Undefined setting '${key.key}'!".failureNel
773764
}
774765

775766
/**
776767
* @param key the fully qualified key
777768
*/
778769
def setting[A](key: SettingKey[A], state: State): A = key.get(structure(state).data).getOrElse {
779-
throw new IllegalStateException("Undefined setting '%s in %s'!".format(key.key, key.scope))
770+
throw new IllegalStateException(s"Undefined setting '${key.key} in ${key.scope}'!")
780771
}
781772

782773
def evaluateTask[A](key: TaskKey[A], ref: ProjectRef, state: State): Validation[A] = {
783774
val taskConfig = EvaluateTask.extractedTaskConfig(Project.extract(state), structure(state), state)
784775
EvaluateTask(structure(state), key, state, ref, taskConfig) match {
785776
case Some((_, Value(a))) => a.success
786-
case Some((_, Inc(inc))) => "Error evaluating task '%s': %s".format(key.key, Incomplete.show(inc.tpe)).failureNel
787-
case None => "Undefined task '%s' for '%s'!".format(key.key, ref.project).failureNel
777+
case Some((_, Inc(inc))) => s"Error evaluating task '${key.key}': ${Incomplete.show(inc.tpe)}".failureNel
778+
case None => s"Undefined task '${key.key}' for '${ref.project}'!".failureNel
788779
}
789780
}
790781

0 commit comments

Comments
 (0)