Built-in Rules
Scalafix comes with a small set of built-in rules. Rules are either syntactic or semantic.
Syntactic: the rule can run directly on source code without compilation. Syntactic rules are simple to run but they can only do limited code analysis since they do not have access to information such as symbols and types.
Semantic: the rule requires input sources to be compiled beforehand with the Scala compiler and the SemanticDB compiler plugin enabled. Semantic rules are more complicated to run but they can do more advanced code analysis based on symbols and types.
Semantic Rules
Name | Description |
---|---|
ExplicitResultTypes | Inserts type annotations for inferred public members. |
NoAutoTupling | Inserts explicit tuples for adapted argument lists for compatibility with -Yno-adapted-args |
OrganizeImports | Organize import statements |
RemoveUnused | Removes unused imports and terms that reported by the compiler under -Wunused |
Syntactic Rules
Name | Description |
---|---|
DisableSyntax | Reports an error for disabled features such as var or XML literals. |
LeakingImplicitClassVal | Adds 'private' to val parameters of implicit value classes |
NoValInForComprehension | Removes deprecated val inside for-comprehension binders |
ProcedureSyntax | Replaces deprecated Scala 2.x procedure syntax with explicit ': Unit =' |
RedundantSyntax | Removes redundant syntax such as `final` modifiers on an object |