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

Enable scalafix plugin #1218

Merged
merged 6 commits into from
Oct 7, 2020
Merged

Enable scalafix plugin #1218

merged 6 commits into from
Oct 7, 2020

Conversation

mlachkar
Copy link
Collaborator

No description provided.

@mlachkar mlachkar force-pushed the plugin branch 4 times, most recently from 20397b8 to 1eb1b55 Compare July 30, 2020 14:39
@mlachkar
Copy link
Collaborator Author

I have issues with semanticdb file not generated for tests anymore.

@bjaglin
Copy link
Collaborator

bjaglin commented Aug 20, 2020

I have issues with semanticdb file not generated for tests anymore.

I think this is because you added the semanticdb compiler plugin via the sbt 1.3.x way (SemanticDBPlugin), which has a different, non-default output directory than the raw scalac way, used in

lazy val semanticdbSettings = Seq(
scalacOptions ++= List(
"-Yrangepos",
"-Xplugin-require:semanticdb",
"-P:semanticdb:synthetics:on"
),
addCompilerPlugin(
"org.scalameta" % "semanticdb-scalac" % scalametaV cross CrossVersion.full
)
)
.

@mlachkar mlachkar force-pushed the plugin branch 2 times, most recently from 02d3d06 to 83664f5 Compare August 28, 2020 08:14
@mlachkar
Copy link
Collaborator Author

To fix the issue, I just didn't enable scalafix-semanticDb in the entire build. I don't know if it's the correct way to fix the issue I was experimenting with.
I don't know if we want or not to enable scalafix rules. In my opinion, it's nice to have a number of rules applied automatically (organizeImport, and ExplicitResultType)

@mlachkar mlachkar requested a review from bjaglin August 28, 2020 08:53
@bjaglin
Copy link
Collaborator

bjaglin commented Aug 28, 2020

To fix the issue, I just didn't enable scalafix-semanticDb in the entire build. I don't know if it's the correct way to fix the issue I was experimenting with.

I think we should keep it everywhere - but you need to stick to one way to enable the plugin, not two as I mentioned above (probably the sbt 1.3 way documented in https://scalacenter.github.io/scalafix/docs/users/installation.html#sbt since we are running 1.3+)

@bjaglin
Copy link
Collaborator

bjaglin commented Aug 28, 2020

As for whether we should enable a few rules on the project itself: yes I think it's always good to eat your own dog food!

* deactivate a small snippet of code in docs.
This snippet is supposed to fail, and it's failing when evaluated,
but mdoc reports `Expected compile errors but program compiled successfully without errors`
@mlachkar
Copy link
Collaborator Author

mlachkar commented Oct 7, 2020

A weird error is now happening with mdoc.
One of the snippet of semantic-tree.md fails when running docs/run

val x: Int = ""
[info] error: /Users/meriamlachkar/scalacenter/scalafix/docs/developers/semantic-tree.md:164:1: Expected compile errors but program compiled successfully without errors
[info] val x: Int = ""
[info] ^^^^^^^^^^^^^^^

And of course, it also fails if we remove mdoc:fails. I just removed scala mdoc:fail from this snippet for now

@mlachkar
Copy link
Collaborator Author

mlachkar commented Oct 7, 2020

@bjaglin I would like another review on this (since it required a rebase every time.) Thanks.
I will create another PR/issue to fix warnings and errors on documentation

Copy link
Collaborator

@bjaglin bjaglin left a comment

Choose a reason for hiding this comment

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

Sure, let's get that in, I can open a PR to address #1218 (comment) if you want?

@mlachkar
Copy link
Collaborator Author

mlachkar commented Oct 7, 2020

Now, it only uses the new way of semanticdb (sbt 1.3+). I removed all "org.scalameta" % "semanticdb-scalac".
So I think this comment has been addressed

@mlachkar
Copy link
Collaborator Author

mlachkar commented Oct 7, 2020

It's left only as Library dependency for Rules, since it's used to read semanticdb files.

@mlachkar mlachkar merged commit e31e5c9 into scalacenter:master Oct 7, 2020
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