bjaglin on untagged-621a8517dbdd8b06c14f
github-actions[bot] on untagged-621a8517dbdd8b06c14f
mlachkar on gh-pages
Deploy website Deploy website … (compare)
mlachkar on v0.9.25
mlachkar on gh-pages
Deploy website Deploy website … (compare)
tgodzik on master
Update Scala versions to 2.13.4… Merge pull request #1314 from t… (compare)
Does scalafix have an easy way to do something like this intellij lint: https://github.com/zio/zio-intellij/blob/idea202.x/src/main/scala/zio/intellij/inspections/mistakes/UnusedZIOExpressionsInspection.scala#L20
expr.nextSiblingNotWhitespace
IO
types (eg someIO; anotherIO
)
stats.sliding(2)
from Term.Block
, see https://github.com/scalameta/scalameta/blob/7270830ca74fc7971988624c373087bf6840a6b9/tests/shared/src/test/scala/scala/meta/tests/parsers/TermSuite.scala#L152
Unrelated, I'd like to be able to detect usage of toString
on specific types. I found this: https://github.com/mrdziuban/disable-to-string
but I'm wondering how easy it would be to check what toString is being invoked on, type-wise
Array[_]
; you basically never want to toString that
OrganizeImports
rule. Right now, it's written in a pretty plain FP style for clarity, but can be slow when executed against large repositories. Would like to see whether there're any low-hanging fruits there (e.g., rewriting certain hot for-loops into while-loops).
Hello All,
How to make sbt-scalafix
work with custom project directory structure in multi-module build. I am migrating this project from gradle to sbt only because gradle-scalafix
doesn't organize imports correctly for few files
examples
├── file1.scala
├── file2.scala
src
├── main
│ └── scala
├── build.sbt
My build config looks like this:
lazy val core = project
.in(file("."))
.settings(
name := "root-lib-project",
libraryDependencies ++= Seq(...)
)
lazy val examples = project
.in(file("examples"))
.settings(
name := "lib-examples",
Compile / scalaSource := baseDirectory.value,
libraryDependencies ++= Seq(..)
)
.dependsOn(core)
The core/scalafix
, scalafmt
works fine without any issues and I am also able to compile the sources. Even organize-imports
via metals is working correctly. But running examples/scalafix
gives the below error.
[error] error while loading Object, Missing dependency 'object scala.native in compiler mirror', required by /modules/java.base/java/lang/Object.class
[error] ## Exception when compiling 2 sources to <proj_dir>/examples/target/scala-2.12/scalafix-classes
[error] scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
[error] scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:24)
[error] scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:25)
[error] scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$6(Mirrors.scala:65)
...
2.13.4
Hey folks.
I have a bunch of objects for which I want to guarantee that those objects are only accessed from a few specific packages of the code base. I'm looking for a way to basically do this:
object O {
private[otherPackageA,otherPackageB] object Inner { }
}
Is this something that I could write a rule for, to check that during continuous integration? Seems like something scalafix could do, but before learning how write custom rules, I thought I'd better ask.
I want to use Scalafix at work. We use gradle as our build tool and therefore want to use the gradle plug-in (https://github.com/cosmicsilence/gradle-scalafix). Unfortunately, when running Scalafix, the rules do not appear to be being applied. For example, I expect Scalafix to insert return types when applying the rule ExplicitResultTypes. I thought I may of set up the project incorrectly so I cloned the following project which uses gradle-Scalafix - https://github.com/Workday/warp-core/. I added the following code to a Scala file -
def d = ""
implicit class RichString(val string: String) {
def scream = string.toUpperCase
}
and ran the following command ./gradlew clean scalafix
but still did not see any code changes. Any ideas on what might be the problem?
Foo.bar(x)
to x.baz
and y.foo
to y.bar
. For the first, I'm using Patch.replaceTree on the Apply tree, and for the second, I'm using Patch.replaceTree
on the Term.Name
tree of foo
. Now when I have Foo.bar(x.foo)
, it gets replaced with x.bar.bazbar
instead of the expected x.bar.baz
$ scalafix replaceType 'scalaz.\/' 'scala.Either'
2.12.13
and a bug fix for Patch.replaceSymbols that affects ScalaTest rulebuild.sbt
scalaVersion := "3.0.0-M3",
addCompilerPlugin(
"org.scalameta" %% "semanticdb-scalac" % "4.4.6" cross CrossVersion.full
),
scalacOptions += "-Yrangepos"
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.scalameta:semanticdb-scalac_3.0.0-M3:4.4.6
[error] Not found
[error] Not found
[error] not found: /home/user/.ivy2/localorg.scalameta/semanticdb-scalac_3.0.0-M3/4.4.6/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/scalameta/semanticdb-scalac_3.0.0-M3/4.4.6/semanticdb-scalac_3.0.0-M3-4.4.6.pom
[error] not found: https://jcenter.bintray.com/org/scalameta/semanticdb-scalac_3.0.0-M3/4.4.6/semanticdb-scalac_3.0.0-M3-4.4.6.pom
[error] not found: https://maven.pkg.github.com/fernarzt/_/org/scalameta/semanticdb-scalac_3.0.0-M3/4.4.6/semanticdb-scalac_3.0.0-M3-4.4.6.pom
addCompilerPlugin
but you need to add a scalacOption which is -Xsemanticdb
or you can use a newer version of sbtsbt.version=1.5.0-M1
and add in your build file ThisBuild / semanticdbEnabled := true