Open ihostage opened 1 year ago
I am wondering why in the sbt-scalafmt project a sbt-test
folder is excluded:
https://github.com/scalameta/sbt-scalafmt/blob/ba1d4d5aa3db22534b75cd1bb420e88ae88924f3/.scalafmt.conf#L4-L6
This would indicate IMHO that this sbt-test folder would otherwise included in the formatting process if it wouldn't be excluded.
Or am I wrong?
So, this is were the sources are defined which get formatted:
https://github.com/scalameta/sbt-scalafmt/blob/ba1d4d5aa3db22534b75cd1bb420e88ae88924f3/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala#L419-L420
Looks like sbt-test
folders are not part of unmanagedSources in scalafmt
/ unmanagedSourceDirectories in scalafmt
.
Maybe we could make use of sf:
project.includeFilters = [
plugin/src/sbt-test
]
however looking at how ScalafmtPlugin works I think that settings might not even get taken into account when using sbt-scalafmt?
@mkurz as you correctly surmised, this plugin only processes files used by sbt
during build.
Would be nice to have some config to add additional files/folders which should get formatted.
@mkurz @ihostage have you tried defining a project within your build, pointing to this standalone directory, thus setting source files/dirs for it?
sbt-scalafmt doesn't format stuff that doesn't belong to any project, as formatting happens within the scope of a project. so it seems that you simply need to create a project and put them under it.
Sorry, @kitbellew, but I don't understand what you mean. We already have a project (for example https://github.com/sbt/sbt-maven-plugin) and sbt-test
folder (default for scripted tests) is a part of this project. Yes, sbt-test
isn't a *Sources
folder as @mkurz pointed above, but I think definition another one fictive project only for formatting is inconvenient 😞 Moreover I will need disable compilation/publishing/etc for this project and it's looks very strange for me 🤷♂️
i was simply asking if you tried it and if that worked. if that's inconvenient, then perhaps you -- as sbt plugin experts -- can help fix this problem here. i don't fully understand sbt scopes, projects etc, and others haven't looked at it for a while.
If I'm writing a scripted tests for my SBT plugin, I can't to check a format the files in the default
sbt-test
directory. AndincludePaths
configuration can't help me also.