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

Document scalacOptions for sbt-scalafix and explicitReturnTypes config #267

Closed
MasseGuillaume opened this issue Aug 1, 2017 · 3 comments

Comments

@MasseGuillaume
Copy link
Contributor

Hey Olaf,

I tried to run scalafmt on the scaladex codebase. This is how it's configured:

scalacenter/scaladex@f8dabd5

The doc has mentioned I should configure this rewrite https://scalacenter.github.io/scalafix/#ExplicitReturnTypes

@MasseGuillaume
Copy link
Contributor Author

I think the solution is to do this:

x.explicitReturnTypes {
   memberKind = [
     Def
     Var
     Val
   ]
   memberVisibility = [
     Public
     Protected 
  ]
}

@MasseGuillaume
Copy link
Contributor Author

Also, unrelated to this issue. I ran RemoveUnusedImports. I see some unused import warning from the compiler, but they are not removed by scalafix.

@olafurpg olafurpg changed the title java.lang.IllegalStateException: Object {} has no field 'explicitReturnTypes'. Did you mean '' instead? Document scalacOptions for sbt-scalafix and explicitReturnTypes config Aug 10, 2017
@olafurpg
Copy link
Contributor

I managed to reproduce your issue and the problem was that build.sbt sets scalacOptions := instead of ++=. By replacing := with ++= I was able to run the rewrites. Alternatively, the next release of sbt-scalafix exposes a scalafixScalacOptions setting which can be appended to scalacOptions if you prefer to keep :=. This is not documented so I'm gonna keep this issue open.

bjaglin pushed a commit to liancheng/scalafix that referenced this issue May 23, 2023
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