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

How can I load contrib warts into IntelliJ IDEA? #218

Open
umireon opened this issue Aug 31, 2022 · 6 comments
Open

How can I load contrib warts into IntelliJ IDEA? #218

umireon opened this issue Aug 31, 2022 · 6 comments

Comments

@umireon
Copy link

umireon commented Aug 31, 2022

My question

I tried to use contrib warts on this repository on IntelliJ IDEA. Contrib warts were successfully loaded on SBT builds and it procuded wart violations with SBT. However, when I instructed IntelliJ IDEA to build Scala classes, the contrib warts were completely ignored by IntelliJ IDEA's compiler. Warts that are built in Wartremover core could be loaded into IntelliJ IDEA's compiler and it produced wart violation as expected. How can I load contrib warts into IntelliJ IDEA?

My code

https://github.com/umireon/umireon-wartremover-contrib-intellij-idea/tree/intellij-idea-cannot-load-wartremover-contrib-classes

We prefer the -Xfatal-warnings flag and this problem also prevents us to use many IntelliJ IDEA features.

This problem causes the following error:

IntelliJ IDEA cannot load contrib warts

scalac: load failure warts = (org.wartremover.contrib.warts.Apply,scala.ScalaReflectionException: object org.wartremover.contrib.warts.Apply not found.)

I checked the configuration of Scala compiler on Intellij IDEA and it revealed that it loaded Wartremover core but didn't load Wartremover contrib.

The Scala compile on IntelliJ IDEA only loads wartremover not wartremover-contrib

Thanks in advance.

Best,

@tsawada
Copy link

tsawada commented Oct 18, 2022

@xuwei-k do you have any idea how to get contrib warts work in IntelliJ IDEA?

@hagay3
Copy link

hagay3 commented Apr 13, 2023

@xuwei-k
having same issue with intellij idea, I think it should be addressed somehow.
currently, it's not possible to use contrib wart with IntelliJ idea.

scalac: load failure warts = (org.wartremover.contrib.warts.DiscardedFuture,scala.ScalaReflectionException: object org.wartremover.contrib.warts.DiscardedFuture not found.)

@tsawada
Copy link

tsawada commented Apr 15, 2023

@hagay3
I believe there's something missing in the IntelliJ Scala plugin. I filed an issue here: https://youtrack.jetbrains.com/issue/SCL-21154

@mvestola
Copy link

This seems to be fixed in IntelliJ IDEA latest 2023.3 EAP at least (which will be soon future 2023.3 release). I was using EAP version "Build #IU-233.9802.14, built on October 12, 2023". I got the same kind of failure with the EAP build: scalac: load failure warts = (org.wartremover.contrib.warts.DiscardedFuture,scala.ScalaReflectionException: object org.wartremover.contrib.warts.OldTime not found.) when running scala in IDEA. But updating Scala plugin to the latest one 2023.3.489 fixed the issue for me.

So basically, update to latest IDEA and update Scala plugin should make it work.

@mvestola
Copy link

This seems to be fixed in IntelliJ IDEA latest 2023.3 EAP at least (which will be soon future 2023.3 release). I was using EAP version "Build #IU-233.9802.14, built on October 12, 2023". I got the same kind of failure with the EAP build: scalac: load failure warts = (org.wartremover.contrib.warts.DiscardedFuture,scala.ScalaReflectionException: object org.wartremover.contrib.warts.OldTime not found.) when running scala in IDEA. But updating Scala plugin to the latest one 2023.3.489 fixed the issue for me.

So basically, update to latest IDEA and update Scala plugin should make it work.

Seems that I was partly wrong. Still getting the same issue even with the latest Intellij IDEA releases. I have following line in my build.sbt:

wartremoverErrors += ContribWart.OldTime,

If I comment that out and run sbt update on IDEA (by clicking the sbt refresh icon) and then uncomment it and run sbt update again -> I get no errors. But after any dependency is updated and sbt update happens automatically by IDEA again, it suddenly starts producing the same error again. Seems really weird but definitely there is still some issue in the IDEA or IDEA's scala plugin...

@ncreep
Copy link
Contributor

ncreep commented Nov 1, 2023

The workaround suggested here seems to be working for me.

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

No branches or pull requests

5 participants