Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbt Feature Request: auto scalafmtSbt on loading #1208

Closed
ches opened this issue Jun 3, 2018 · 2 comments
Closed

sbt Feature Request: auto scalafmtSbt on loading #1208

ches opened this issue Jun 3, 2018 · 2 comments

Comments

@ches
Copy link
Contributor

ches commented Jun 3, 2018

  • Version: 1.6.0-RC1
  • Integration: sbt-scalafmt

Problem

sbt-scalafmt can keep project source formatted with scalafmtOnCompile, but needs a separate step of scalafmtSbt to maintain formatting of the build too.

Through some tricks, neo-sbt-scalafmt made it possible to have automatic formatting of sbt build files when sbt (re)loaded, if scalafmtOnCompile := true was set in the root and the meta build e.g. project/build.sbt.

Expectation

A means of keeping build files in compliance with project standards without need to remember a separate scalafmtSbt, or frustrating contributors with scalafmtSbtCheck failing CI.

Workaround

I haven't played around with onLoad to try to get something working with the current plugin yet, I'll share if something pans out.

Notes

I can understand if sbt-scalafmt maintainers don't feel this is worthwhile and want to close it. It's a nice-to-have after getting used to it with the neo plugin.

@olafurpg
Copy link
Member

olafurpg commented Jun 3, 2018

Thanks for reporting! I am not against having a similar option in the sbt-scalafmt plugin if someone wants to contribute the feature. One thing that needs to be taken care of is to only trigger formatting on reload and on first load. I had heard reports that the neo-scalafmt implementation triggered reformatting on ++SCALA_VERSION, which is slow since the neo scalafmt task depends on update.

@olafurpg
Copy link
Member

The sbt plugin now lives in a separate repo, I've moved this ticket to here scalameta/sbt-scalafmt#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants