File tree Expand file tree Collapse file tree
plugin/src/main/scala/org/scalafmt/sbt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -406,12 +406,15 @@ object ScalafmtPlugin extends AutoPlugin {
406406 private def getScalafmtSourcesTask (
407407 f : Seq [File ] => Def .Initialize [Task [Unit ]]
408408 ) = Def .taskDyn[Unit ] {
409- (unmanagedSources in scalafmt).? .value.map(f).getOrElse(Def .task(Unit ))
409+ val sources = (unmanagedSources in scalafmt).? .value
410+ sources.filter(_.nonEmpty).map(f).getOrElse(Def .task(Unit ))
410411 }
411412
412413 private def getScalafmtSbtTasks (
413- f : (Seq [File ], Path ) => Def .Initialize [Task [Unit ]]
414+ func : (Seq [File ], Path ) => Def .Initialize [Task [Unit ]]
414415 ) = Def .taskDyn[Unit ] {
416+ def f (files : Seq [File ], config : Path ) =
417+ if (files.isEmpty) Def .task[Unit ]() else func(files, config)
415418 Def .sequential(
416419 f(sbtSources.value, sbtConfig.value),
417420 f(metabuildSources.value, scalaConfig.value)
You can’t perform that action at this time.
0 commit comments