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

Skip validation if there are no sources to fix. #29

Merged
merged 2 commits into from
Sep 21, 2018

Conversation

olafurpg
Copy link
Contributor

Previously, the semanticdb-scalac and scalacOptions validation ran for
empty root projects with no sources, failing the build when running
scalafix from the root project. Since there are no sources to fix we
should not run any validation.

Fixes scalacenter/scalafix#884

Previously, the semanticdb-scalac and scalacOptions validation ran for
empty root projects with no sources, failing the build when running
scalafix from the root project.  Since there are no sources to fix we
should not run any validation.
)
)

lazy val root = project
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abdheshkumar I was able to reproduce the bug with this build.sbt, I got the following error before the fix

[info] [error] (Compile / scalafix) scalafix.sbt.InvalidArgument: 2 errors
[info] [error] [E1] The semanticdb-scalac compiler plugin is required to run semantic rules like RemoveUnused.
[info] [error] To fix this problem for this sbt shell session, run `scalafixEnable` and try again.
[info] [error] To fix this problem permanently for your build, add the following settings to build.sbt:
[info] [error]   addCompilerPlugin(scalafixSemanticdb)
[info] [error]   scalacOptions += "-Yrangepos"
[info] [error]
[info] [error] [E2] The Scala compiler option "-Ywarn-unused" is required to use RemoveUnused.
[info] [error] To fix this problem, update your build to use at least one Scala compiler
[info] [error] option that starts with "-Ywarn-unused"

After the fix scalafix runs successfully.

@olafurpg olafurpg merged commit 952bcef into scalacenter:master Sep 21, 2018
@olafurpg olafurpg deleted the validate-root branch September 21, 2018 15:05
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

Successfully merging this pull request may close these issues.

Skip validation if there are no files to fix
1 participant