Package

scalafix

rule

Permalink

package rule

Visibility
  1. Public
  2. All

Type Members

  1. abstract class Rule extends AnyRef

    Permalink

    A Scalafix Rule.

    A Scalafix Rule.

    To provide automatic fixes for this rule, override the fix method. Example:

    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:

    // 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)
      }
    }
  2. trait RuleCtx extends PatchOps

    Permalink
  3. final case class RuleIdentifier(value: String, deprecated: Option[Deprecated]) extends Product with Serializable

    Permalink

    A thin wrapper around a string name and optional deprecation warning.

  4. final case class RuleName(identifiers: List[RuleIdentifier]) extends Product with Serializable

    Permalink

    A thin wrapper around a list of RuleIdentifier.

  5. abstract class SemanticRule extends Rule

    Permalink

Value Members

  1. object Rule

    Permalink
  2. object RuleCtx

    Permalink
  3. object RuleIdentifier extends Serializable

    Permalink
  4. object RuleName extends Serializable

    Permalink
  5. object ScalafixRules

    Permalink

Ungrouped