Obtaining a SemanticDocument from a Scala source file using ScalaFix

109 views Asked by At

What are the steps of parsing a Scala source file into a SemanticDocument using ScalaFix?

1

There are 1 answers

0
Uttej Guduru On BEST ANSWER

As of scalafix(0.9.4),

To write a SemanticRule , one has to extend the abstract class SemanticRule and this abstract class has a method fix with the following signature:

def fix(implicit doc: SemanticDocument): Patch

If we override this method to create a Patch either for fixing or linting, we will have access to implicit value doc. Scalafix populates this variable by parsing a single source file. doc represents a single source file.