Gakuo
Gakuo

Reputation: 855

Obtaining a SemanticDocument from a Scala source file using ScalaFix

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

Upvotes: 0

Views: 100

Answers (1)

Uttej Guduru
Uttej Guduru

Reputation: 40

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.

Upvotes: 0

Related Questions