rcc

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2026 License: MIT Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

rcc (retrospective code coverage + lines of code)

rcc can be used to create a graph/plot of test coverage and LoC data based on a project's git commit history. Graph data is gathered by walking the commit history, cloning each commit into a temporary directory and running LoC and/or unit and/or integration tests on the cloned worktree.

It supports (and tries to auto-detect) few built-in programming languages and their commonly used coverage tools. For other languages or different needs, relevant commands to obtain coverage can be provided by the user. Same applies to regex used to extract coverage value from test output - regexes documented by gitlab should generally work.

Currently built-in support:

  • Go (go test for unit tests, go test -tags=integration for integration tests)
  • Python (pytest / pytest-cov)
  • Java (Gradle / jacoco)

Dependencies for integration tests should possibly be started before running rcc. Alternatively, built-in defaults can be overridden by specifying custom commands for test execution.

By default, five parallel workers will be spawned to run analysis in parallel. In theory, this should work well for unit tests. For integration tests, it's more likely that rcc should be limited to a single worker (see usage below).

rcc supports multiple output formats for gathered data:

  • HTML (embeds a bundled chartjs, or links to it).
  • PNG requires gnuplot to be installed.
  • JSON (using the chartjs dataset structure); raw data, no plot. Output format is determined by the filename (extension) given for output, which defaults to rcc-output.html.

installation

No binary release available (yet?). Go required.

go install github.com/schnoddelbotz/rcc@main

usage

First argument to rcc is a path to the project (under git version control) to be analyzed. Without that argument, the current working directory will be analyzed.

Assuming a Go project in current working directory, to run LoC and unit test coverage, run

rcc

This will produce the default graph format (rcc-output.html). Should the project language not be specified and auto-detection fail, rcc will only analyse LoC.

Overview of currently supported flags to influence rcc behaviour:

Flags:
  -E, --commits-every int              Only look at every Nth commit (default 1)
  -A, --commits-from time              Look at commits since date (default 0)
  -Z, --commits-to time                Look at commits until date (default Now)
  -I, --cover-integration              Run integration tests
  -X, --cover-integration-cmd string   Command for running integration tests
  -R, --cover-regex string             Regex for coverage value extraction
  -C, --cover-unit-cmd string          Command for running unit tests
  -d, --debug                          Enable debug output
  -J, --html-no-embed-chartjs          Don't embed ChartJS into generated .html
  -j, --html-no-embed-json             Don't embed JSON into generated .html
  -i, --include-languages strings      Explicitly list languages for LoC
  -l, --language string                Set project language (default autodetect)
  -D, --no-cover-duration              Don't graph coverage duration
  -U, --no-cover-unit                  Don't run unit tests
  -O, --open                           Open --output file upon completion
  -o, --output string                  Output file (default "rcc-output.html")
  -s, --skip-autodetect                Disable language auto detection
  -T, --timestamps                     Timestamp console log output
  -t, --tmp string                     Temporary work directory (default "/tmp")
  -v, --version                        Print rcc version and exit
  -w, --workers int                    Number of workers (default 5)

A more custom example - analyses the project at given path, opens the graph in PNG format upon completion, also runs integration tests and only analyses (and graphs) LoC for given languages:

rcc -OIi Go,JavaScript,HTML -o my.png /path/to/my/project

libraries used

  • go-git to analyse git history
  • gocloc to get LoC data
  • cobra CLI command line interface

status / todo

Fun project, WIP. Open tasks:

  • fix: --branch option required; uses hard-coded "main" :/
  • add option to disable LoC
  • add cli flag: output png dimensions
  • add option to create/use ramdisk for tmp git clones
  • improve test coverage m( ... and add graph as example here
  • add JSON --append mode, to extend an exist json ouput file (/w 1 or more commits, based on range)

license

MIT

Documentation

Overview

Copyright © 2026 Jan Hacker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL