glinter/rule

Types

Full lint result with file path and severity, produced by the orchestrator.

pub type LintResult {
  LintResult(
    rule: String,
    severity: Severity,
    file: String,
    location: glance.Span,
    message: String,
  )
}

Constructors

  • LintResult(
      rule: String,
      severity: Severity,
      file: String,
      location: glance.Span,
      message: String,
    )

Pre-computed data from a single AST traversal. Rules receive this instead of walking the AST themselves.

pub type ModuleData {
  ModuleData(
    module: glance.Module,
    expressions: List(glance.Expression),
    statements: List(glance.Statement),
  )
}

Constructors

pub type Rule {
  Rule(
    name: String,
    default_severity: Severity,
    needs_collect: Bool,
    check: fn(ModuleData, String) -> List(RuleResult),
  )
}

Constructors

  • Rule(
      name: String,
      default_severity: Severity,
      needs_collect: Bool,
      check: fn(ModuleData, String) -> List(RuleResult),
    )

    Arguments

    needs_collect

    Whether this rule uses the pre-collected expression/statement lists. When False, walker.collect() can be skipped if no other active rule needs it.

    check

    The source parameter provides the raw file content for rules that need string-level analysis beyond what the parsed AST offers.

Result returned by individual rules. Does not include file or severity — those are set by the orchestrator from the Rule and file context.

pub type RuleResult {
  RuleResult(
    rule: String,
    location: glance.Span,
    message: String,
  )
}

Constructors

  • RuleResult(rule: String, location: glance.Span, message: String)
pub type Severity {
  Error
  Warning
  Off
}

Constructors

  • Error
  • Warning
  • Off
Search Document