uncloak

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 2 Imported by: 0

README

uncloak

uncloak is a CLI tool for analyzing new Go code coverage on the current branch with the current branch's nearest parent branch.

At a high level, it:

  • runs git diff against the parent branch
  • runs Go tests to collect coverage data
  • compares new Go lines from the diff against the coverage profile
  • reports uncovered new lines and fails when coverage drops below the configurable threshold

Installation

Install the latest version with:

go install github.com/engmtcdrm/uncloak@latest

This installs the uncloak binary into your Go bin directory.

Usage

Run uncloak from the root of a Git repository:

uncloak

By default, uncloak will analyze against the nearest parent branch of the current branch. That default behavior requires a branch with a parent branch, so feature branches are the intended use.

If coverage is below the threshold, the command exits with an error and prints the uncovered new line ranges.

Configuration

uncloak reads configuration from a YAML file in the current working directory.

Supported file names:

  • .uncloak.yml
  • .uncloak.yaml

If no config file is present, uncloak uses built-in defaults. Empty config files are rejected.

Default configuration
version: 0
coverage-threshold: 80
exclusions: []
Configuration fields
  • version: config file version
  • coverage-threshold: minimum acceptable coverage percentage for new code
  • exclusions: list of file paths or glob patterns to exclude from analysis
Example configuration
version: 0
coverage-threshold: 90
exclusions:
  - "docs/**"
  - "**/*_generated.go"
Exclusions

Exclusions support exact file matches and glob patterns. For example:

  • main.go
  • internal/**
  • **/*_generated.go

Flags

uncloak supports these command-line flags:

  • -c, --coverage-threshold <float>: (optional) coverage threshold override. This will also overwrite what is specified in the configuration file
  • -d, --debug: (optional) enable debug output, e.g. what commands are run
  • -h, --help: help for uncloak
  • -o, --output: (optional) file to write new code missing coverage out to
  • -t, --target-ref <string>: (optional) git target ref to compare against (default: current branch's nearest parent branch)
  • -v, --verbose: (optional) enable verbose output, e.g. output from go test command
  • --version: version for uncloak

Example:

uncloak --coverage-threshold 70.31 --verbose

Exit status

  • 0 when coverage meets the configured threshold
  • non-zero when coverage is below the threshold or an analysis error occurs

Example workflow

  1. Create or switch to a feature branch.
  2. Make changes.
  3. Run uncloak from the repository root.
  4. Review any uncovered new lines.
  5. Add tests or adjust code until the new coverage meets the threshold.

Notes

  • Brand new Go files must be staged or committed for uncloak to analyze them.
  • The tool expects to run inside a Git repository on a branch with a parent branch.
  • The default coverage threshold is 80%.
  • Unknown YAML fields are rejected, so config files should only contain supported keys.

Documentation

Overview

Package main provides the entry point for the uncloak command-line application.

Directories

Path Synopsis
Package cmd provides the command-line interface for the uncloak application.
Package cmd provides the command-line interface for the uncloak application.
internal
analyzer
Package analyzer provides functions and types for analyzing code coverage and exclusions in the uncloak application.
Package analyzer provides functions and types for analyzing code coverage and exclusions in the uncloak application.
app
Package app provides application information such as name, version, description, etc.
Package app provides application information such as name, version, description, etc.
colors
Package colors provides utility functions for formatting text with different colors.
Package colors provides utility functions for formatting text with different colors.
config
Package config provides functionality for loading and validating the configuration of the uncloak application.
Package config provides functionality for loading and validating the configuration of the uncloak application.
gitdiff
Package gitdiff provides functions and types for working with Git diffs in the uncloak application.
Package gitdiff provides functions and types for working with Git diffs in the uncloak application.
gocover
Package gocover provides functions and types for working with Go test coverage in the uncloak application.
Package gocover provides functions and types for working with Go test coverage in the uncloak application.
header
Package header provides a function to write the uncloak title/header to the terminal.
Package header provides a function to write the uncloak title/header to the terminal.
task
Package task provides functionality for managing and rendering the status of multiple tasks in the terminal.
Package task provides functionality for managing and rendering the status of multiple tasks in the terminal.
testing/testconfig
Package testconfig provides utilities for creating and managing test configuration files for the uncloak application.
Package testconfig provides utilities for creating and managing test configuration files for the uncloak application.
testing/testfiles
Package testfiles provides utility functions and types for working with test files in Go tests.
Package testfiles provides utility functions and types for working with test files in Go tests.
testing/testgit
Package testgit provides functions and types for working with Git repositories in the context of testing within the uncloak application.
Package testgit provides functions and types for working with Git repositories in the context of testing within the uncloak application.
testing/testrepo
Package testrepo provides utility functions for setting up and initializing test git repositories in Go tests.
Package testrepo provides utility functions for setting up and initializing test git repositories in Go tests.
testing/testutils
Package testutils provides utility functions and types for testing terminal interactions and handling standard output in Go tests.
Package testutils provides utility functions and types for testing terminal interactions and handling standard output in Go tests.
utils
Package utils provides utility functions for error handling.
Package utils provides utility functions for error handling.

Jump to

Keyboard shortcuts

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