Skip to content

Commit

Permalink
Explicitly filter files via .matchesProjectFilters (#159)
Browse files Browse the repository at this point in the history
Let's not even attempt to format files which will be ignored.

Co-authored-by: Albert Meltzer <[email protected]>
  • Loading branch information
kitbellew and Albert Meltzer authored Nov 10, 2021
1 parent 54cd4d5 commit 72638bf
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,14 @@ object ScalafmtPlugin extends AutoPlugin {
log.debug(
s"Adding repositories ${repositories.mkString("[", ",", "]")}"
)
sources
.map { file =>
sources.map { file =>
val path = file.toPath.toAbsolutePath
if (scalafmtSession.matchesProjectFilters(path)) {
val input = IO.read(file)
val output =
scalafmtSession.format(
file.toPath.toAbsolutePath,
input
)
val output = scalafmtSession.format(path, input)
Some(onFormat(file, input, output))
}
} else None
}
}

private def formatSources(
Expand Down

0 comments on commit 72638bf

Please sign in to comment.