mirror of https://github.com/sbt/sbt.git
Address Codacy issues
This commit is contained in:
parent
772e5bc06c
commit
420679df10
|
|
@ -4,8 +4,7 @@
|
|||
package sbt
|
||||
|
||||
import scala.concurrent.duration.{ FiniteDuration, Duration }
|
||||
import sbt.internal.{ OldPlugin, Aggregation, LoadedBuild, BuildUtil, PluginDiscovery, APIMappings, BuildDependencies, GCUtil, TaskSequential }
|
||||
import sbt.internal.ConsoleProject
|
||||
import sbt.internal._
|
||||
import sbt.internal.util.Attributed
|
||||
import sbt.internal.util.Attributed.data
|
||||
import Scope.{ fillTaskAxis, GlobalScope, ThisScope }
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ private[sbt] object SbtRefactorings {
|
|||
import sbt.internal.parser.SbtParser.{ END_OF_LINE, FAKE_FILE }
|
||||
import sbt.internal.SessionSettings.{ SessionSetting, SbtConfigFile }
|
||||
|
||||
val EMPTY_STRING = ""
|
||||
val REVERSE_ORDERING_INT = Ordering[Int].reverse
|
||||
val emtpyString = ""
|
||||
val reverseOrdeingInt = Ordering[Int].reverse
|
||||
|
||||
/**
|
||||
* Refactoring a `.sbt` file so that the new settings are used instead of any existing settings.
|
||||
|
|
@ -25,7 +25,7 @@ private[sbt] object SbtRefactorings {
|
|||
val (file, lines) = configFile
|
||||
val split = SbtParser(FAKE_FILE, lines)
|
||||
val recordedCommands = recordCommands(commands, split)
|
||||
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(REVERSE_ORDERING_INT)
|
||||
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(reverseOrdeingInt)
|
||||
|
||||
val newContent = replaceFromBottomToTop(lines.mkString(END_OF_LINE), sortedRecordedCommands)
|
||||
(file, newContent.lines.toList)
|
||||
|
|
@ -61,11 +61,9 @@ private[sbt] object SbtRefactorings {
|
|||
case (acc, (st, tree)) =>
|
||||
val treeName = extractSettingName(tree)
|
||||
if (name == treeName) {
|
||||
val replacement = if (acc.isEmpty) {
|
||||
command.mkString(END_OF_LINE)
|
||||
} else {
|
||||
EMPTY_STRING
|
||||
}
|
||||
val replacement =
|
||||
if (acc.isEmpty) command.mkString(END_OF_LINE)
|
||||
else emtpyString
|
||||
(tree.pos.start, st, replacement) +: acc
|
||||
} else {
|
||||
acc
|
||||
|
|
|
|||
Loading…
Reference in New Issue