Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 19 23:32
    steinybot edited #1033
  • Jan 16 16:02
    scala-steward opened #1048
  • Jan 15 01:01
    scala-steward opened #1047
  • Jan 13 07:16
    RobertoUa opened #1046
  • Jan 11 03:14
    gvolpe opened #1045
  • Jan 08 03:32
    scala-steward opened #1044
  • Jan 08 03:31
    scala-steward opened #1043
  • Jan 07 22:43
    benwaffle closed #982
  • Jan 07 22:43
    benwaffle commented #982
  • Jan 06 17:32
    scala-steward opened #1042
  • Jan 06 07:58
    olafurpg reopened #982
  • Jan 06 07:58
    olafurpg commented #982
  • Jan 06 02:01
    benwaffle commented #982
  • Jan 04 08:27
    scala-steward opened #1041
  • Jan 03 21:23
    benwaffle commented #982
  • Dec 29 2019 19:32
    scala-steward opened #1040
  • Dec 27 2019 04:46
    scala-steward opened #1039
  • Dec 26 2019 07:49
    scala-steward opened #1038
  • Dec 20 2019 14:23
    scala-steward opened #1037
  • Dec 18 2019 11:11
    steinybot opened #1036
Ryuhei Ishibashi
@rysh

Hello.
In a project using Scalafix, when Silencer-plugin is added to Dependency, RemoveUnused no longer works.
Can Scalafix be used simultaneously with silencer-plugin?
Or is the setting wrong?

Here is the project to reproduce.
https://github.com/rysh/example-scalafix-with-fatalwarnings

Rikito Taniguchi
@tanishiking
@rysh Though I'm not familiar with silencer-plugin, it looks like silencer plugin drops Diagnostic information from SemanticDB (We can confirm that using metap towards semanticdb generated on compile).
Since RemoveUnused depends on compiler warning, which is retrieved through SemanticDB, scalafix can't run RemovedUnused properly under slicener-plugin.
Ryuhei Ishibashi
@rysh
@tanishiking Thanks.
I'm going to look at the silencer-plugin source code, but it seems to take time because I don't have knowledge of compilers and plugins.
Ólafur Páll Geirsson
@olafurpg
@rysh what happens if you flip the order in which you enable the semanticdb and silencer plugins?
this sounds like an issue related to how the reporter is used by both silencer and semanticdb,
@mtomko example how to upgrade the SemanticDB compiler plugin https://github.com/scalacenter/scalafix/issues/988#issuecomment-546256178
Mark Tomko
@mtomko
@olafurpg thanks!
Ryuhei Ishibashi
@rysh

@olafurpg
Thank you for the advice. When I tried referring to the link destination, silencer was specified after semanticdb in scalacOptions. But sadly, it did not work yet.

Here is my build.sbt
https://github.com/rysh/example-scalafix-with-fatalwarnings/blob/master/build.sbt

James Koch
@jameskoch
Are there any helpers for traversing SemanticTree? I'm trying to "find usages" of an implicit value in a fairly generic way.
Ólafur Páll Geirsson
@olafurpg
@jameskoch there's no traverser for SemanticTree
Mike Slinn
@mslinn
@olafurpg What are the current plans for Scala 3 support?
Ólafur Páll Geirsson
@olafurpg
@mslinn Scala 3 support should be possible once the Scalameta parser can understand Dotty syntax
the dotty syntax has been evolving rapidily past months making it hard to keep up
but once the dotty syntax becomes stable, then it should be possible to extend the scalameta parser to support dotty
there's an open PR adding a -Ysemanticdb flag to dotty, which would make it possible even to run semantic scalafix rules on dotty code
no promises when scala 3 will be supported, but architecturally Scalafix should be able to support it just fine the same way Scalafix already supports 2.11/2.12/2.13
Florian Lecointe
@lecointef_gitlab
Hello guys, i'm currently trying to make scalafix work in my job project. I'm following the user guide documentation and even though i've added "addCompilerPlugin(scalafixSemanticdb)" in my build.sbt, i have this error :
[error] (dao / Compile / scalafix) scalafix.sbt.InvalidArgument: The semanticdb-scalac compiler plugin is required to run semantic rules like RemoveUnused.
[error] To fix this problem for this sbt shell session, run scalafixEnable and try again.
[error] To fix this problem permanently for your build, add the following settings to build.sbt:
[error] addCompilerPlugin(scalafixSemanticdb)
[error] scalacOptions += "-Yrangepos"
Florian Lecointe
@lecointef_gitlab
Also, when i display libraryDependencies I have the line "org.scalameta:semanticdb-scalac:4.2.3:plugin->default(compile)" like shown in documentation
Thanks for your help
Ukonn Ra
@UkonnRa
Hi, while updating my project in Scala 2.13, I found that scalafix cannot correct my code automatically, just throw errors instead?
scalaVersion := "2.13.1"

scalacOptions ++= Seq(
  "-deprecation",
  "-language:postfixOps",
  "-Yrangepos",
  "-Ywarn-unused",
)
addCommandAlias("fix", "all compile:scalafix test:scalafix")
and when using sbt fix, just throw errors, but not correct my code
Ukonn Ra
@UkonnRa
And when using scalafix, just throw:
[error] <>/Jokes.scala:10:63: Unused import
[error] import org.http4s.{EntityDecoder, EntityEncoder, Method, Uri, Request}
[error]                                                               ^
[error] No warnings can be incurred under -Werror.
Ukonn Ra
@UkonnRa
Found! That's because I have used scalafix with sbt-tpolecat together, the latter will enforce you using -Werror
Matt Dziuban
@mrdziuban
hi all, i'm working on developing my first scalafix rule and running into a strange issue when writing my input/output tests
i want to test that using // scalafix:off works, but when i add it i get Unused Scalafix suppression, this can be removed in the test output
it's definitely required though, because if i remove it then i get errors from my rule
is there any way i can work around this?
Matt Dziuban
@mrdziuban

also i'm seeing (what i believe is) unexpected behavior when calling .symbol on the Term representation of some code:

// code
Some(1).map(_ => 2).getOrElse(3)

// symbol
term.symbol // => scala/Option#getOrElse().

is there some other way to get information about the whole term? i'm looking to determine the resulting type of the expression

Matthew Tovbin
@tovbinm
Howdy, folks. Is RemoveUnused option available for Scala 2.13? https://scalacenter.github.io/scalafix/docs/rules/RemoveUnused.html
Jason Pickens
@steinybot
Is the scalafix plugin for sbt missing the Scala213 dialect?
I get an error saying "numeric separators are not allowed"

This error also suggests that it is missing:

[error] (server / Compile / scalafix) scalafix.sbt.InvalidArgument: Unknown input 'Scala213'. Expected one of: Default, Scala212, Scala211, Dotty, Sbt0137, Paradise211, Sbt1, Paradise212.

Jason Pickens
@steinybot
Adam Fraser
@adamgfraser
Hi. I'm trying to implement a semantic rule that rewrites a method to a curried version (e.g. fool(bar, baz) to foo(bar)(baz)). I'm using patchLeft and patchRight to add the parentheses but am struggling a little bit to remove the comma without removing any other commas that might be in the code for bar and baz. Is there a suggested method for doing this?
Ólafur Páll Geirsson
@olafurpg
@adamgfraser have you tried using TokenList? The API isn't great but it allows you to iterate through one token at a time in both directions (forwards + backwards)
Olivier Mélois
@Baccata

:wave: hey all. I have a piece of logic that generates fair complicated scala code (not macro, the code gets dumped to disk and compiled). I've been using Scalameta for this (to get as much compile errors as possible before I even run the code generation), but now I'd like to inline comments into the generated code, which makes me realise that using scalameta to generate code was probably a huge mistake ...

In any case, now I'm fairly committed, and I wonder whether it'd be possible for me to call scalafix programmatically to add the comments where relevant, after the ASTs have been generated.

  • Is it possible to use scalafix with only syntactic information (ie without semanticdb) ?
  • If so, is there a piece of code I could look at to understand how the basics of calling scalafix programmatically ?
Rafael Saraiva Figueiredo
@saraiva132

Hi. I am trying to implement a rule that rewrites any object that does not extends serializable to extend it, if it already extends others traits, to extend the original object and mix-in with said traits.

I am struggling a bit because intellij does not allow me to navigate to the source code and it makes it a bit hard to understand how to manipulate a SemanticDocument

Ólafur Páll Geirsson
@olafurpg

@Baccata I would recommend using something like https://github.com/typelevel/paiges for code generation, even if it comes at the cost of having no compile errors when producing invalid code

There is an experimental Scalameta tree printer that has an explicit API for attaching leading/trailing comments, see https://github.com/scalacenter/scala-syntax/blob/59919fb39d36d46f9b5913c02b2f01927f85d881/tests/unit/src/test/scala/scala/meta/internal/prettyprinters/DocstringSuite.scala I don't think it's published however, you would need to copy the sources over to use it

adding comments after generation using scalafix sounds like a lot of hassle for little worth
@saraiva132 do you have a specific question?
Olivier Mélois
@Baccata
@olafurpg looks like that tree printer could work, many thanks ! (and yeah, next time I'll defo use something else for codegen)
Jonas Amundsen
@badeball
Hi, I'm trying to use scalafix with 2.13.1, but keep getting a bunch of errors saying scala signatures are wrong, that it found 5.2, but expected 5.0. Does this sound familiar to anyone?
I see there's some related discussion here (scalacenter/scalafix#982), but I'm not well versed enough to make sense of it. Is 2.13.1 supposed to be supported, as stated here? (https://scalacenter.github.io/scalafix/docs/users/installation)
Gabriel Volpe
@gvolpe
I think I bumped into a parser bug. Raised an issue with some details: scalacenter/scalafix#1045
Gregg Hernandez
@gregghz

I'm trying to follow the guide posted here: https://scalacenter.github.io/scalafix/docs/developers/setup.html

however on the g8 step (sbt new scalacenter/scalafix.g8 --repo="Repository Name") sbt loads and resolves some things then asks for a username and password. If i don't put those in the whole task fails with https://github.com/scalacenter/scalafx.g8.git: not authorized. Same error if i put my github username/password in