olafurpg on v0.9.7
olafurpg on master
Cross-build against 2.13. Remove Scala 2.13 from build fo… Fix failing CI tests. 2.12.8 w… and 3 more (compare)
Hello, I would like to perform scalatest's scalafix rule from GitHub.
I know it is possible to add a dependency to
scalafixDependencies described in https://github.com/scalatest/autofix/blob/master/3.0.x/README.md,
but I need running it from GitHub since it is a easy way to integrate scalafix rule into Scala Steward (A bot for updating Scala dependencies).
I tried the below sbt command for scio
will dowloads https://raw.githubusercontent.com/spotify/scio/master/scalafix/rules/src/main/scala/fix/AddMissingImports.scala from GitHub, and works fine.
However, the below does not works.
Sicne salafix try to download
but actual path is
I could not find a document for scalafix's
github: schema handling.
Is it possible to specify scalafix rule in arbitrary project strcture, like in scalatest/autofix repo ?
Or scalafix rule authors should follow some convetion regarding project structure?
def a[A](implicit s: MyImplicit[A]): A = ???. I'm able to get it to work when I add call parentheses using
term.synthetic. The difference in the ADT from semanticdb is that the one with call parentheses is wrapped in a Term.Apply. Should samanticdb had wrapped the Term in an apply or is there any other way I can get hold of the implicit parameter? Here is a complete example including the AST https://gist.github.com/ingarabr/c8c81fb2f2e0ad05bbeb882d39de04c1
What's the best way to handle types which have been renamed on import when you want to rewrite those types?
@holdenk it's usually best to work at the level of symbols instead of trees using
SymbolMatcherhelps you avoid matching against hardcoded identifier names
nvm I think I can just re-order how i'm doing the traversal and that will make my life much happier
That's the recommended way to order patches : )
RDD[String]I would maybe use something like
Patch.replaceTree(Tree, "RDD[String]") + Patch.addGlobalImport(Symbol("spark/RDD#")).
addGlobalImportde-duplicates in the case the symbol is already imported in scope. Scalafix unfortunately doesn't have an API to lookup a name in the scope
Is there way to define and use scalafix as a project submodule ? I’d like to create rules that are (mostly) linters and are to be applied only on some submodules of the same project (they are not public). I could use the
file:… syntax but it’s a bit limited.
put simply, I'd like my project directory to look smth like:
├── project ├── commons ├── submoduleA ├── submoduleB └── scalafix
and I want to rules defined in
scalafix to be applied on
class:fix.MyFixshould do the trick but looking at
set-scalafix, it seems to restrict what the
ClassLoadercan access, effectively hidding my classes
file:...is probably the best workaround
@holdenk you can try to write two symbol matchers, one for
RDD and one for
String and then
case Type.Apply(rddMatcher(_), List(stringMatcher(_))) =>
I haven't tried running that but that what I would first try if matching
columnmay show a generic type like
RDD[T]even if the expression
foo.column("bar")has the type
RDD[String]. It's a bit tricky to explain but in the general case, Scalafix is not able to tell you the type of an expression. Scalafix only knows the generic signature of symbols.
Patch.replaceSymbols( "monix.eval.Task.raiseError" -> "zio.Task.fail", "monix.eval.Task" -> "zio.Task" )
TaskTask.fail, instead of