scalacenter / scalafix

Refactoring and linting tool for Scala
https://scalacenter.github.io/scalafix/
BSD 3-Clause "New" or "Revised" License
821 stars 185 forks source link

sbt-scalafix: default scalafixScalaBinaryVersion to scalaBinaryVersion #1658

Closed bjaglin closed 1 week ago

bjaglin commented 2 years ago

For ExplicitResultTypes to work out of the box, it would better to set by default

scalafixScalaBinaryVersion := scalaBinaryVersion.value

Current blockers:

ssanj commented 2 years ago

In the short term would a note about adding the scalafixScalaBinaryVersion to build.sbt in ExplicitResultTypes documentation be of any use?

Eg.

The ExplicitResultTypes rule needs to run with the same Scala binary version as the one used to compile target sources. Please add the following scalafixScalaBinaryVersion to your build.sbt file:

scalafixScalaBinaryVersion := scalaBinaryVersion.value //supported versions are 2.11, 2.12, 2.13

I stumbled across this issue recently and would have found some documentation about configuring scalafixScalaBinaryVersion at the location of the rule configuration helpful.

bjaglin commented 2 years ago

In the short term would a note about adding the scalafixScalaBinaryVersion to build.sbt in ExplicitResultTypes documentation be of any use?

Feel free to open a PR to update the docs. Remember this page is about scalafix, so your message should mention that this hint is for sbt only.

I am not familiar with community clients, but it looks like the scala binary version is not configurable for the mill and the maven ones (to be confirmed):

ssahayam-zd commented 2 years ago

Feel free to open a PR to update the docs. Remember this page is about scalafix, so your message should mention that this hint is for sbt only.

Sure. The installation page only has explicit config for SBT, so I was going to do something similar to that.

I will mention that it's only for SBT.

bjaglin commented 1 week ago

fixed in https://github.com/scalacenter/sbt-scalafix/pull/419 / https://github.com/scalacenter/sbt-scalafix/pull/430