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

chore: add scalafix #1700

Merged
merged 2 commits into from
Mar 28, 2022
Merged

chore: add scalafix #1700

merged 2 commits into from
Mar 28, 2022

Conversation

kpodsiad
Copy link
Collaborator

We have to agree on scalafix settings. Currently, they are very similar to the ones that can be found in Metals.

What I've found is that RemoveUnused have strange behavior - sometimes it removes only val name = and lefts right side of the assignment :/
Moreover, we have to be very careful, for example here

val cancelCliClient = Task
.deferFutureAction(cancel.asScala(_))
.map { cancel =>
if (cancel) {
cliOptions.common.out.println(
s"Client in $configDirectory triggered cancellation. Cancelling tasks..."
)
handle.cancel()
}
}
.runAsync(ExecutionContext.ioScheduler)

there is a side effect (runAsync) that is assigned to the variable and we can't remove both sides. Probably the best way would be to iterate manually over those unused warnings.

scalafix can be run on frontend by frontend/scalafix

cc: @tgodzik

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Looks sensible to me, did you try running scalafix? I remember I had some issues with it, but I tried fixing some dependencies causing those issues, so might be ok now.

.scalafix.conf Show resolved Hide resolved
@kpodsiad
Copy link
Collaborator Author

I temporarily removed RemoveUnused rule

@kpodsiad kpodsiad marked this pull request as ready for review March 24, 2022 19:25
@kpodsiad
Copy link
Collaborator Author

I think there's no point in adding scalafix to the CI for now - first we should handle initial sbt load overhead.

@tgodzik
Copy link
Contributor

tgodzik commented Mar 25, 2022

I think there's no point in adding scalafix to the CI for now - first we should handle initial sbt load overhead.

We can just add it to a separate job, no?

project/Dependencies.scala Outdated Show resolved Hide resolved
@kpodsiad
Copy link
Collaborator Author

I'll do rewrite generation of the test projects to not happen on sbt load task from Bloop next steps and then I'll add a CI job.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for doing this!

@tgodzik tgodzik merged commit 823cde4 into scalacenter:main Mar 28, 2022
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.

2 participants