scalafix
A Scalafix Rule.
To provide automatic fixes for this rule, override the fix method. Example:
fix
object ReverseNames extends Rule("ReverseNames") { override def fix(ctx: RuleCtx) = ctx.tree.collect { case name @ Name(value) => ctx.replaceTree(name, value.reverse) }.asPatch }
To report violations of this rule (without automatic fix), override the check method. Example:
check
// example syntactic linter object NoNulls extends Rule("NoNulls") { val error = LintCategory.error("Nulls are not allowed.") override def check(ctx: RuleCtx): List[LintMessage] = ctx.tree.collect { case nil @ q"null" => error.at(nil.pos) } }
A thin wrapper around a string name and optional deprecation warning.
A thin wrapper around a list of RuleIdentifier.
A Scalafix Rule.
To provide automatic fixes for this rule, override the
fix
method. Example:To report violations of this rule (without automatic fix), override the
check
method. Example: