Skip to content
CAI
Software that uses CAICheck a score

doorgan/sourceror

69.3

Adequate · 13 November 2026

51.1k

lines of production code

Erlang

with Elixir

8

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Sourceror is an Elixir library that parses, formats, and manipulates Elixir source code by representing it as an Abstract Syntax Tree (AST) with precise position tracking. It provides utilities for traversing and patching code structures, including a high-performance zipper implementation and modules for generating source patches. The system supports backported Elixir syntax features and includes comprehensive tools for AST navigation, comment handling, and code transformation.

How it got here

2021 — v1.12.3 release and internal refactoring

8 changes.

This period focused on releasing version 1.12.3, which included a major internal refactoring of AST manipulation and source mapping with new modules like FastZipper and Patch. The work also established compatibility with Elixir 1.13+ and older versions, added comprehensive test coverage, and introduced documentation and examples for AST traversal and code patching.

2023–2026 — Elixir 1.12+ support and AST utilities

4 changes.

The project integrated vendored Elixir 1.12+ parser and formatter components to support newer syntax features like range steps and updated operator precedence. It also introduced a suite of code-manipulation utilities ported from Igniter for AST navigation and modification, alongside comprehensive tests and benchmarks for the normalizer and traversal performance.

Features

Add TypedStruct macro for defining structs with typespecs and defaults

A new \Sourceror.Utils.TypedStruct\ module has been added, providing a \typedstruct\ macro that simplifies the definition of Elixir structs. This macro allows developers to define struct fields with associated typespecs, default values, and enforcement rules in a single declaration, automatically generating the corresponding \@type\, \@enforce\_keys\, and \defstruct\ directives.

lib/sourceror/utils · high confidence

Add project description

The README.md file has been updated to replace the placeholder 'TODO: Add description' with comprehensive documentation. This includes installation instructions for version 1.11+, a note on compatibility with Elixir 1.10 and OTP 21, an explanation of how Sourceror stores comments in AST metadata, and examples for AST traversal and patching source code.

(repo-wide) · high confidence

Added Elixir example scripts for AST manipulation

New example scripts have been added to the \examples\ directory to demonstrate how to use Sourceror for parsing and transforming Elixir code. The \add\_dependency.exs\ script shows how to programmatically inject a dependency into a \mix.exs\ file by walking the AST, while \sort\_dependencies.exs\ demonstrates sorting existing dependencies alphabetically. These examples use \Mix.install\ to run as standalone scripts.

examples · high confidence

Added Livebook examples for AST manipulation and zippers

New Livebook notebooks have been added to the \notebooks\ directory to demonstrate advanced Sourceror capabilities. The \expand\_multi\_alias.livemd\ notebook provides a step-by-step guide on expanding multi-alias syntax (e.g., \alias Foo.{Bar, Baz}\) into individual alias calls while preserving comments and handling AST block unwrapping. The \zippers.livemd\ notebook introduces the \Sourceror.Zipper\ data structure, explaining how to traverse and modify the AST tree with localized operations like moving focus, inserting siblings, and navigating parent/child relationships.

notebooks · high confidence

Port Igniter.Code utilities to Sourceror

Added a suite of code-manipulation utilities in lib/sourceror/code (Common, Function, Keyword, List, Map, Module, String, Tuple) branched from the Igniter project. These modules provide functions for navigating and modifying Elixir ASTs using Sourceror's Zipper, enabling users to perform operations such as finding and updating function calls, managing keyword lists and maps, and manipulating module structures.

lib/sourceror/code · high confidence

Vendored Elixir 1.12+ parser and formatter for backported language features

The project now includes vendored copies of the Elixir compiler's tokenizer, parser, normalizer, and formatter (specifically \Sourceror.Code.Formatter\ and \Sourceror.Code.Normalizer\ in Elixir, and \sourceror\elixir\\*\ modules in Erlang). These components are integrated to backport Elixir 1.12+ syntax support, enabling the parsing and formatting of newer language constructs such as the range step operator (\..//\), the \+++\ and \---\ operators, and updated operator precedence rules that require parentheses for logical binary operands.

_lib\_vendored, src\vendored · high confidence

Behavioural changes

Compatibility layer for Elixir 1.13+ and column/indentation handling

The library now uses a conditional module alias to switch between the standard \Code\ module (for Elixir 1.13+) and a vendored \Sourceror.Code\ module (for older versions), ensuring compatibility with pre-1.13 Elixir releases. Additionally, \parse\_string\ and \parse\_string!\ now accept \:line\ and \:column\ options to control the starting position of the source code, and include internal logic to apply indentation fixes and handle column offsets specifically for Elixir versions prior to 1.19.

lib · high confidence

Major internal refactoring of AST manipulation and source mapping

This release introduces a high-performance \Sourceror.FastZipper\ as an alternative to the existing \Sourceror.Zipper\, alongside a new \Sourceror.Patch\ module for generating source patches (such as renaming calls or identifiers) and a dedicated \Sourceror.Range\ struct for precise start/end position tracking. The core parsing and formatting pipeline has been restructured with a new \Sourceror.Code\ module and a \Sourceror.LinesCorrector\ to improve line number accuracy and comment placement, while the \Sourceror.Comments\ module has been rewritten to use \Macro.traverse\ for more robust comment merging and extraction.

lib/sourceror · high confidence

Test coverage

Added benchmarks for AST traversal and position calculation; Added comprehensive test suite for Sourceror code manipulation and parsing; Added tests for the code normalizer's AST formatting and quoting.

Dependencies

Initial dependency lock and project configuration for Sourceror v1.12.3

This change introduces the \mix.lock\ file, locking development dependencies such as Credo 1.7.15, Dialyxir 1.3.0, ExDoc 0.31.2, and Sobelow 0.11.1, and updates \mix.exs\ to set the project version to 1.12.3 with Elixir compatibility starting from 1.12. It also adds project metadata (description, licenses, links), configures documentation generation to include notebooks, and sets up Dialyzer and ExCoveralls for static analysis and test coverage.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 69 → 69 (-0.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.3) — scores are not directly comparable.

Lenses

  • Code Health 98 → 98 (+0.0)
  • Architecture 92 → 92 (+0.0)
  • Maturity 53 → 53 (+0.0)
  • Readiness 74 → 74 (+0.0)
  • Security 95 → 93 (-1.4)
  • Performance 90 → 90 (+0.0)

Resolved (2)

  • Duplicated block (14 lines × 2) (lib/sourceror/fast_zipper.ex)
  • Off-boarding risk: anonymized user #1

New (36)

  • Edited copies of one member (3 members, 5+ corresponding lines) (lib/sourceror/patch.ex)
  • Edited copies of one member (3 members, 7+ corresponding lines) (src_vendored/sourceror_elixir_tokenizer.erl)
  • Edited copy of a member (1 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (1 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (1 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (10 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (10 corresponding lines) (lib/sourceror/zipper.ex)
  • Edited copy of a member (11 corresponding lines) (lib_vendored/code/formatter.ex)
  • Edited copy of a member (11 corresponding lines) (lib_vendored/code/formatter.ex)
  • Edited copy of a member (13 corresponding lines) (src_vendored/sourceror_elixir_tokenizer.erl)
  • Edited copy of a member (15 corresponding lines) (lib_vendored/code/formatter.ex)
  • Edited copy of a member (16 corresponding lines) (lib/sourceror/comments.ex)
  • Edited copy of a member (19 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/code/common.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • Edited copy of a member (2 corresponding lines) (lib/sourceror/fast_zipper.ex)
  • …and 16 more

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

doorgan/sourceror was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 13 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 67a8f057a77b14fe2ae5adde12855026379df5d7 — the exact code this score is about.
  • Scored under rubric-2026.11.3 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.61+preprod-b8b1a43ae4c3.