Skip to content

Automatically run scalafmtSbt on reload #2

@olafurpg

Description

@olafurpg

Originally reported by @ches in scalameta/scalafmt#1208

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions