Credence (credence v0.7.1)
Copy MarkdownCredence — Semantic Linter for Elixir.
Routes analysis and fixing through three phases:
- Syntax — string-level fixes for code that won't parse
- Semantic — fixes for compiler warnings (unused vars, undefined fns)
- Pattern — AST-level anti-pattern rules (the bulk of Credence)
Each phase has its own Rule behaviour and discovers rules automatically.
Summary
Functions
The short names of every rule that would run under opts, across all three
rounds, in execution order. Derived from rule_status/1 so the two answers
never disagree.
Reports which rules would run for the given opts, across all three rounds,
without running them — the opts-only counterpart to fix/2.
Types
Functions
@spec analyze( String.t(), keyword() ) :: %{valid: boolean(), issues: [Credence.Issue.t()]}
The short names of every rule that would run under opts, across all three
rounds, in execution order. Derived from rule_status/1 so the two answers
never disagree.
@spec fix( String.t(), keyword() ) :: %{ code: String.t(), issues: [Credence.Issue.t()], applied_rules: [{module(), non_neg_integer() | :reverted}] }
@spec rule_status(keyword()) :: [rule_status_entry()]
Reports which rules would run for the given opts, across all three rounds,
without running them — the opts-only counterpart to fix/2.
Returns one entry per rule, in execution order (Syntax → Semantic → Pattern), each a map with:
:round—:syntax,:semantic, or:pattern:rule— the rule module:name— its short name:assumptions— the promises it needs (always[]for Syntax/Semantic):enabled— whether it is eligible underopts:missing— the needed promises that are off
Only the Pattern round is opts-filtered — by :assumptions and an explicit
:rules list (see Credence.Pattern.rule_status/1). Syntax and Semantic
rules are never opts-filtered, so every discovered rule comes back
enabled: true. Whether a rule actually fires further depends on the code
itself — Syntax only runs when the source won't parse, Semantic only on the
compiler diagnostics it matches — which this opts-only view does not inspect.