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-tpolecat is conflict with scalafix #15

Closed
UkonnRa opened this issue Dec 3, 2019 · 3 comments
Closed

sbt-tpolecat is conflict with scalafix #15

UkonnRa opened this issue Dec 3, 2019 · 3 comments

Comments

@UkonnRa
Copy link

UkonnRa commented Dec 3, 2019

scalafix has to use -Ywarn-unused for removing the unused things, but tpolecat uses -Werror. And conflict happens

@DavidGregory084
Copy link
Member

Hi @UkonnRa, a lot of users use sbt-tpolecat because it ensures that code with warnings can't be committed. Could you potentially use something like the following to resolve this conflict?

scalacOptions.in(Compile, scalafix) ~= { options: Seq[String] =>
  options.filterNot(Set("-Werror"))
}

scalacOptions.in(Test, scalafix) ~= { options: Seq[String] =>
  options.filterNot(Set("-Werror"))
}

@UkonnRa
Copy link
Author

UkonnRa commented Dec 6, 2019

Cool! THX a lot!

@UkonnRa UkonnRa closed this as completed Dec 6, 2019
@mrt181
Copy link

mrt181 commented Jan 31, 2020

Hi, that suggestion does not work for me. I still get this error:

sbt> scalafix RemoveUnused
[error] import java.util.UUID                             
[error]                  ^                                
[error] No warnings can be incurred under -Werror.        
[error] two errors found                                  
[error] (Compile / compileIncremental) Compilation failed 

I have to set -Ywarn-unused:imports explicitly otherwise I get an error that at least one -Ywarn-unused setting must be set

lazy val settings = 
  Seq(
    scalacOptions += "-Ymacro-annotations",
    scalacOptions += "-Ywarn-unused:imports",
    scalacOptions.in(Compile, scalafix) ~= { options: Seq[String] =>
      options.filterNot(Set("-Werror"))
    },
    scalacOptions.in(Test, scalafix) ~= { options: Seq[String] =>
      options.filterNot(Set("-Werror"))
    }
  )

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

No branches or pull requests

3 participants