This room is no longer active, please join the rest of the scalameta community on https://discord.gg/8AHaqGx3Qj
mlachkar on gh-pages
Deploy website Deploy website … (compare)
mlachkar on gh-pages
Deploy website Deploy website … (compare)
bjaglin on main
remote gitter shield Merge pull request #1655 from s… (compare)
bjaglin on main
Update scalafmt-core to 3.5.9 Merge pull request #1656 from s… (compare)
error: The ExplicitResultTypes rule needs to run with the same Scala binary version as the one used to compile target sources (2.13). To fix this problem, either remove ExplicitResultTypes from .scalafix.conf or make sure the scalafixScalaBinaryVersion setting key matches 2.13.
, But I'm using scala 2.13.4. I tried to upgrade to 2.13.6, even downgrade to 2.13.0, but it still not working.DBIOAction
s, but only the last one is returned, others are ignored. This fix wraps them with DBIO.seq
.@/all
We are happy to announce the release of Scalafix 0.9.30
. Huge thanks to @taisukeoe and @adpi2 for their great contributions (release notes: 1 and , 2).
RemoveUnused
rule that allows removing unused function parameters (scalacenter/scalafix#1444, scalacenter/scalafix#1448)scalafix-interfaces
dependency as described in the documentation.-Xmaxwarns
, which limits the number of fixes applied during each run, and the user had to configure this scalacOption to catch more warnings. Starting this release, this configuration is not necessary anymore. The rule will fix all the warnings, even if there are not printed by the compiler.overriddenSymbols
(thanks @tanishiking)I'm trying to replace a method which changes form 1 bracket to 2 bracketed method.
So i expted that i could do, but this will result in code that will rewrite the full chain again.
val t : Term.Apply //these are the flatmap applies gotten in a collect
Patch.replaceTree(t, Term.Apply(t.copy(fun.copy(name = Term.Name("mapParallelUnordered")), List(args.head)), List(args.last)).toString())
input:
Observable(1,2,4)
.flatMap(3, x => Observable.from(x))
.flatMap(3, x => Observable.from(x))
expected output:
Observable(1,2,4)
.mapParallelUnordered(3)(x => Observable.from(x))
.mapParallelUnordered(3)(x => Observable.from(x))
If i would only like to do the rename this works:
val t : Term.Apply
Patch.replaceTree(fun.name, "mapParallelUnordered")
But a seemingly equivalent patch gives will also give repeat the full chain on each replacement:
val t : Term.Apply
Patch.replaceTree(t, t.copy(fun.copy(name = "mapParallelUnordered").toString)
so how do i rename one function to a different one which has 2 apply lists instead of 1.
scalafix.sbt.InvalidArgument: scalafix.v1.Rule: Provider fix.MyFix could not be instantiated
. Is this to do with sbt being scala 2.12 only?
Hello everyone, I'm using a custom dependency loaded on some custom resolvers. When I add them as
ThisBuild / scalafixDependencies += "com.foo.bar" %% "scalafix-foo" % "1.0.0"
ThisBuild / scalafixResolvers ++= ...
lazy val myProject = project
.settings(
// ...
)
everything works fine. If I inspect my build with consoleProject
I can see my scalafixDependencies
and scalafixResolvers
in ThisBuild
and in myProject
.
However if I move the scalafix settings in the project like so:
lazy val myProject = project
.settings(
// ...
scalafixDependencies += "com.foo.bar" %% "scalafix-foo" % "1.0.0",
scalafixResolvers ++= ...
)
scalafixAll
gives me a [error] (scalafixAll) scalafix.sbt.InvalidArgument: Unknown rule 'MyRule'
. If I inspect my build with consoleProject
I can see my scalafixDependencies
and scalafixResolvers
in myProject
but not in ThisBuild
.
Can anyone help? I need to move the settings inside the project as in my company we're using using a custom sbt plugin that creates project with standard settings.
overriddenSymbols
(scalacenter/scalafix#1476). Thanks @tanishiking & @SethTisue for the contributions!
Hi all, I've got a rule defined that has been successfully applied to multiple projects already, but there are some projects that throw this error when I execute it:
[error] [E0] /tmp/scalafix2610516103563897436/Zio2Upgrade.scala3899217760876070558.scala:450:13 error: wrong number of type parameters for method map: [B, That](f: scalafix.v1.SymbolMatcher => B)(implicit bf: scala.collection.generic.CanBuildFrom[List[scalafix.v1.SymbolMatcher],B,That])That
[error] }.map[PartialFunction[Tree, Patch]](symbolMatcher => { case t @ ImporteeNameOrRename(symbolMatcher(tree)) =>
The rule is here: https://github.com/zio/zio/blob/series/2.x/scalafix/rules/src/main/scala/fix/Zio2Upgrade.scala
The project we're applying it to is here: https://github.com/zio/zio-akka-cluster
scalafix.interfaces.Scalafix
(latest) it's not clear what is required to uptake that. I would appreciate if you could provide some pointers on how we could provide equivalent functionality as the plugin for sbt (if any), or maybe just let us know if this is still very early days and we should hold that off for now.
scalafix Collection213Upgrade
the HelloWorld.scala
file doesn't get rewritten with any fixes?? I can't figure out what is wrong. Any help appreciated..
Term.NewAnonymous(tmpl)
when need to turn that tmpl
into a class
Okay figured it out, you can delete the new by accessing the tokens of the Term.NewAnonymous
directly and removing the first one, ie. the solution here is:
val newAnon = ... // bound to the Term.NewAnonymous via matching
Patch.removeTokens(newAnon.tokens.head) +
Patch.addLeft(newAnon, "new Impl\n class Impl extends")
I gotta say, much happier with this than the sed script I was contemplating :)
Patch
but the implementations are all internal and there isn’t much that can be done with Patch
directly.