Skip to content

Commit

Permalink
ScalafmtDynamic: respectExcludeFilters to ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 22, 2021
1 parent ad9da7f commit f8e81a1
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ final case class ScalafmtDynamic(
} else {
config
}
if (isIgnoredFile(filename, configWithDialect)) {
if (isIgnored(file, configWithDialect)) {
reporter.excluded(file)
code
} else {
Expand All @@ -202,12 +202,9 @@ final case class ScalafmtDynamic(
}
}

private def isIgnoredFile(
filename: String,
config: ScalafmtReflectConfig
): Boolean = {
respectExcludeFilters && !config.isIncludedInProject(filename)
}
@inline
private def isIgnored(file: Path, cfg: ScalafmtReflectConfig): Boolean =
respectExcludeFilters && !cfg.isIncludedInProject(file.toString)

private def readVersion(config: Path): FormatEval[ScalafmtVersion] = {
Try {
Expand Down Expand Up @@ -240,7 +237,7 @@ final case class ScalafmtDynamic(
formatted => formatted
)
override def matchesProjectFilters(file: Path): Boolean =
cfg.isIncludedInProject(file.toString)
!isIgnored(file, cfg)
}

}
Expand Down

0 comments on commit f8e81a1

Please sign in to comment.