Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ólafur Páll Geirsson
    @olafurpg
    @henricook FWIW, there exists a Scalafix ExplicitResultTypes that automatically inserts the inferred type annotations on public members https://scalacenter.github.io/scalafix/docs/rules/ExplicitResultTypes.html I use it in several of my projects and it's worked pretty well in my experience
    Ruixi Fan
    @rfan-debug
    @rfan-debug no worries, I tried using wart remover v2.3.7 with sbt 0.13.8 and scala 2.11.11..works fine for me (refer this https://github.com/wartremover/wartremover/blob/da1e629e3367c0ec/docs/_posts/2017-02-11-install-setup.md)
    Thank you! that's really helpful!
    Francois Armand
    @fanf
    hello people! I would like to find bad use of toString and StringPlusAny with wartremover. It works well, but we use a lot of integer/long/etc for metrics log, I get tons (several hundreds) of warning, which make it almost unusable. I would like to know if there is a way to tell wartremover "except integer"?
    Stacy Curl
    @stacycurl
    Is it possible to define a custom wart locally to a project, maybe in a ‘project project’, or on plugins.sbt ?
    Alternatively is there an existing wart that’s parameterizable ? I don’t see why it’s necessary to define a new wart for every method I want to forbid.
    Stacy Curl
    @stacycurl
    wartremoverWarnings += Wart.custom(“InvocationNotAllowed(SomeClass, someMethod)”)
    Stacy Curl
    @stacycurl
    I found an answer to my first question: wartremover.WartRemover.dependsOnLocalProjectWarts(myWarts)
    Sven Ludwig
    @iosven
    @fanf I have the same experience.
    Ashesh Singh
    @user501254

    Hi, I am having a hard time trying to exclude files. As per the docs, I can use wartremoverExcluded.
    However this doesn't work:

    lazy val wartremoverSettings = Seq(
      wartremoverWarnings in (Compile, compile) ++= Warts.allBut(Wart.Throw),
      wartremoverExcluded ++= Seq(
        sourceManaged.value,
        baseDirectory.value / "common" / "src" / "main" / "scala" / "com" / "tango" / "charlie" / "clients" / "Github.scala"
      )
    )

    Any pointer would help, Thank you.

    shota jolbordi
    @shotexa

    Hi folks, I’m having issues with wartRemover working in vsCode / metals. It does work normally when I compile, but, when metals compiles it via bloop, I get this errors in metals.log:

    ERROR bad option: -P:wartremover:only-warn-traverser:org.wartremover.warts.Any

    sbt 1.4.4
    scala 2.13.4

    I’ve added

    addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.13”)

    in project/plugins.sbt
    and

    ThisBuild / wartremoverErrors ++= Warts.unsafe

    in build.sbt

    shota jolbordi
    @shotexa
    I’ve tried everything and then I’ve just restarted my mac and it fixed...
    Henri Cook
    @henricook
    Hi everyone. Relatively new wart remover user here. I notice when trying to enable the Equals wart that it also warns on Strings. Can I stop wart remover warning about String comparisons or is this an opinionated thing? i.e. Wartremover is implying I should wrap all my Strings in other types
    Dmitry Polienko
    @nigredo-tori
    @henricook, as I understand it, Equals is intended to be used with libraries that provide type-safe alternatives to ==. For example, Cats provides === and =!= operators for types that have an Eq typeclass instance.
    Henri Cook
    @henricook
    Thanks nigredo-tori - and I'm a user of cats, but I don't even Cats has something for comparing strings.. I can't use === for them for example
    Dmitry Polienko
    @nigredo-tori
    @henricook, you might be missing import cats.implicits._.
    Henri Cook
    @henricook
    Oh wow you've blown my mind, I didn't know cats had that - thanks!
    vonchav
    @voonchav_gitlab
    Hi @shotexa , does wartremover 2.4.13 work with Scala 2.13.4 for you? When I tried it, it doesn't seem wartremover isn't available for 2.13.4.
    I can see 2.13.4 has been added to github repo but there hasn't been a new release for that change. Just wondering how you got it working.
    Dmitry Polienko
    @nigredo-tori
    @voonchav_gitlab, there is a WR 2.4.13 artifact for Scala 2.13.4: https://mvnrepository.com/artifact/org.wartremover/wartremover
    1 reply
    shota jolbordi
    @shotexa
    @voonchav_gitlab yeah it does actually
    1 reply
    Adrian
    @adrian-salajan
    Hi, is it possible to use Wartremover to check for commented code ? I see no built in wart so maybe it is not possible even with a custom one?
    eugeniyk
    @eugeniyk

    Hello guys
    I've implemented custom wart and try to use it in the same project - have compilation error saying
    scala.ScalaReflectionException: object com.{org}.warts.MyWart not found
    I'm connecting it via settings:

    lazy val wartSettings = Seq(
    Compile / compile / wartremoverErrors ++= Seq(Wart.custom("com.{org}.warts.MyWart"))
    )

    is it a limitation or there is a workaround?

    eugeniyk
    @eugeniyk
    I saw there is dependsOnLocalProjectWarts setting but looks like I can't have it set to the same project (otherwise recursion)
    James Hughes
    @jnh5y
    Hi, would it be possible to write a wart which would detect call to a Java method expecting varargs Java Objects? I'm maintaining several Scala projects which depend on a Java library which has moved a bunch of method signatures from Object[] to Object...
    That transition is troubling since Scala Arrays are Java Objects. After the change, the (Scala) Array is being passed into the Varargs argument as a single Object.
    ritschwumm
    @ritschwumm
    @jnh5y might well be doable - i'd probably have a look at how the scala compiler trees differ in those cases first...
    James Hughes
    @jnh5y
    @ritschwumm good idea. Would I do anything differently than using the scalac print options? (I'll admit that I'm new to Wartremover and alternatives like Scalafix, etc)
    ritschwumm
    @ritschwumm
    @jnh5y i forgot about the details - in a macro, i'd just add a println(showRaw(...)) somewhere
    D Cameron Mauch
    @DCameronMauch
    Just started using WartRemover. Works great so far, but when I try to run any tests from within IntelliJ, I get this: scalac: bad option: -P:wartremover:traverser:org.wartremover.warts.Equals
    That is the only wart I am currently checking.
    D Cameron Mauch
    @DCameronMauch
    I found some other reference to this, and they fixed it by downgrading from 2.4.13 to 2.4.10, which also worked for me
    Opened an issue for that on Github
    Marcin Szałomski
    @baldram

    @DCameronMauch This is an IntelliJ issue. I was fixing it earlier by downgrading 2.4.13 to 2.4.10.
    This is fixed already by IntelliJ. I raised an issue there some time ago.
    May current working setup is SBT 1.5.2, Wartremover 2.4.13, IntelliJ 2021.1.1 with the latest Scala plugin.
    All is fine.

    Opened an issue for that on Github

    If this issue was opened for Wartremover I would suggest to close it, as it is not valid due to above mentioned fix in IntelliJ.

    D Cameron Mauch
    @DCameronMauch
    gotcha, thanks
    I closed it
    Henri Cook
    @henricook
    Hi all, sorry for what must be a repeat question, but I can't see any reference to Scala 3 on Github issues, or the documentation site, does/will wartremover support scala 3?
    Buk Lau
    @mk9023_gitlab
    Hi, moving to the latest version of wartremover, I get IO error while decoding UTF-8 with UTF-8: UTF-8 when running sbt doc. Any idea what could cause that?
    Kyle Florence
    @solarmosaic-kflorence
    we use Play JSON and upgrading to Scala 2.13 makes wartremover extremely noisy due to wartremover/wartremover#454 -- is there any workaround short of applying warning suppression all over the place?
    b-gyula
    @b-gyula
    Does anyone know why the directory structure does not match wit the package structure? files in the core\src\main\scala\wartremover** folder are defined in the org.wartremover package