How adamtornhill/code-maat works
Project type and purpose
• Code Maat is an open-source command-line tool (Clojure) for mining and analyzing version-control logs (git, hg, svn, p4, tfs).
• No GUI/web front end—focus is on parsing input logs, computing metrics, and producing CSV output or piping to visualization tools.
High-level architecture from the file tree and README
• Top-level: Dockerfile, project.clj (build), README.md, Travis config, doc/ (guides & images).
• src/code_maat/: main code divided into:
• cmd_line.clj – command-line dispatcher
• parsers/ – one parser module per VCS plus XML/time parsers
• dataset/ – dataset builder holding in-memory data model
• app/ – grouping logic (team_mapper, time_based_grouper, generic grouper)
• analysis/ – independent analysis modules (authors, churn, coupling, code_age, etc.)
• output/ – CSV formatter and filter modules
• test/ and src/code_maat/test/ cover unit, end-to-end, data-driven tests.
Core dataflow and component interactions
• 1) CLI layer reads arguments (log file path, VCS type, analysis type, flags)
↓
• 2) Parser adapter (selects git/git2/hg/svn/p4/tfs parser) consumes raw log → produces sequence of commit records
↓
• 3) Dataset builder ingests commit records → builds in-memory representation of entities, authors, timestamps
↓
• 4) (Optional) App-level grouping transforms dataset based on layer definitions or temporal periods
↓
• 5) Analysis engine invokes chosen analysis module(s) on the dataset → yields metric records
↓
• 6) Output layer formats metric records (CSV, filters) → writes to STDOUT, file, or pipes to downstream tools
Key architectural patterns and design principles
• Strategy/plugin pattern: parsers and analyses are pluggable modules implementing a common interface
• Functional pipeline: pure data transformations from raw log → dataset → analysis → output
• Separation of concerns: clear layers for input, data model, business logic (analysis), presentation (output)
• Extensibility: adding a new VCS parser or metric analysis requires dropping in a new namespace under parsers/ or analysis/.
External dependencies and packaging
• Clojure runtime + Incanter (for data handling), Leiningen build tool
• Packaged as standalone Uberjar or Docker image (Dockerfile)
• Can also be used as a Clojure library via project.clj dependency