Repository navigation
Arc now ships a compile-time analyzer, the Elixir counterpart of the ARC Roslyn analyzers. It checks your code against Arc rules on every compile and reports Mix diagnostics in the terminal, in CI and in the editor.
Added
- A
:arc_analyzercompiler. Turn it on withcompilers: [:arc_analyzer] ++ Mix.compilers()inmix.exs, or runmix igniter.install cratis_arc. The installer is safe to run twice and updates every app of an umbrella. - Rules
ARCE0001(a module declares a schema andhandle/2but does notuse Arc.Command),ARCE0002(a command or query is both anonymous and restricted),ARCE0003(an@observequery has neither:watchnor:topics),ARCE0004(a command appends to Chronicle itself) andARCE0005(two commands or queries resolve to the same route). - Configuration with
config :cratis_arc, :analyzer: a globalenabledswitch and a severity per rule (:error,:warning,:infoor:off).@arc_analyzer ignore: ["ARCE0001"]turns a rule off for one module, andmix compile --warnings-as-errorsfails on warnings from the analyzer. - A Code analysis section in the documentation with a page for every rule, and a changelog.
Changed
- Builds that add the analyzer can report new warnings after an upgrade that adds a rule.
ARCE0002andARCE0005default to errors; set a rule to:warningor:offunderconfig :cratis_arc, :analyzerwhile you fix the findings.