You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I setup scalafmt with my bazel project successfully following the instructions in this repo and some other examples on GitHub. Here is a minimal example .scalafmt.conf file I was using.
# .scalafmt.conf# https://scalameta.org/scalafmt/docs/configuration.htmlmaxColumn = 100
version = 3.7.17
runner.dialect = scala212
# this doesn't workrewrite.trailingCommas.style = always
# this works# trailingCommas = always
However, I noticed that it does not download the same version as specified in the .scalafmt.conf file. I noticed this because the rewrite.trailingCommas.style setting is not available; instead, it was looking for the setting located at trailingCommas. Instead, it downloads version 3.0.0 per this line of code:
However, after overriding this artifact, I still got this error.
external/io_bazel_rules_scala/scala/scalafmt/scalafmt/ScalafmtWorker.scala:8:error: objectFileOps is not a member of packageorg.scalafmt.utilimportorg.scalafmt.util.FileOps
^
external/io_bazel_rules_scala/scala/scalafmt/scalafmt/ScalafmtWorker.scala:21:error: not found: value FileOpsvalsource=FileOps.readFile(namespace.getOrElse("input", newFile("")))(Codec.UTF8)
^
external/io_bazel_rules_scala/scala/scalafmt/scalafmt/ScalafmtWorker.scala:23:error: value fromHoconFile is not a member of objectorg.scalafmt.config.Configvalconfig=Config.fromHoconFile(namespace.getOrElse("config", newFile(""))).get
Looking at that file in the scalafmt repo, you can see that they moved the FileOps object from the scalafmt-core to the scalafmt-sysops package; thus, it is published as a separate Maven package.
I couldn't figure out how to also include that package when running the formatter, but I imagine it is probably better to support it by adding it here.
I imagine the package would need to be added in a handful of spots including (I'm probably missing some spots):
I setup scalafmt with my bazel project successfully following the instructions in this repo and some other examples on GitHub. Here is a minimal example
.scalafmt.conf
file I was using.However, I noticed that it does not download the same version as specified in the
.scalafmt.conf
file. I noticed this because therewrite.trailingCommas.style
setting is not available; instead, it was looking for the setting located attrailingCommas
. Instead, it downloads version 3.0.0 per this line of code:rules_scala/third_party/repositories/scala_2_12.bzl
Line 123 in 98689d0
I was able to override the version like this in my
WORKSPACE
file:However, after overriding this artifact, I still got this error.
Looking at that file in the scalafmt repo, you can see that they moved the
FileOps
object from thescalafmt-core
to thescalafmt-sysops
package; thus, it is published as a separate Maven package.I couldn't figure out how to also include that package when running the formatter, but I imagine it is probably better to support it by adding it here.
I imagine the package would need to be added in a handful of spots including (I'm probably missing some spots):
.bzl
files here.Aside from those updates, I think it would be cool for this automatically download the correct version. But I imagine that would be more complicated.
The text was updated successfully, but these errors were encountered: