Skip to content
CAI
Software that uses CAICheck a score

erikerlandson/coulomb

58.0

Adequate · 20 September 2026

5.8k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Coulomb is a Scala library for type-safe physical quantity management, supporting both compile-time unit analysis and runtime parsing. It provides comprehensive arithmetic, conversion, and display capabilities for standard, derived, and offset-based units like temperature. The system integrates with popular Scala ecosystems including Cats, Refined, Pureconfig, and Java Time, and includes tools for property-based testing.

Features

Add Refined integration for Coulomb quantities

This change introduces a new integration module that allows Coulomb quantities to be built using \eu.timepit.refined\ types. Users can now create quantities with refined predicates (such as \Positive\ or \NonNegative\) using syntax like \withRP\ and \refineVU\. The integration supports algebraic operations (addition, multiplication) on refined values, handling validation failures via \Either\[String, Refined\[...\]\]\ when operations violate predicates. It also provides unit and value conversions for refined types, enabling seamless use of refined values in unit conversions and arithmetic.

refined · high confidence

Add testkit for property-based testing

A new testkit module has been added to provide Scalacheck Arbitrary and Cogen instances for Quantity and DeltaQuantity types, enabling users to easily write property-based tests for their code using Coulomb.

testkit · high confidence

Expanded unit library with new physical domains and Java Time integration

The library now includes comprehensive definitions for several new unit systems and domains. Users can work with accepted non-SI metric units (such as hectare, liter, and tonne) via the new \accepted\ object, and US customary units (including yard, pound, gallon, and BTU) via the \us\ object. New files define fundamental physical constants (like the speed of light and Planck's constant) in \constants\, information units (bit, byte, and binary prefixes) in \info\, and temperature scales (Celsius, Fahrenheit) in \temperature\. Additionally, the \javatime\ package provides seamless conversion between coulomb \Quantity\ types and Java's \java.time.Duration\ and \Instant\ classes, allowing users to interoperate with standard Java date/time APIs.

units/src/main · high confidence

Introduce runtime unit parsing and Pureconfig integration

This change adds a new runtime unit parsing capability and a Pureconfig integration for Coulomb. The parser module introduces a DSL-based \RuntimeUnitParser\ that can parse string expressions (e.g., "kilometer") into \RuntimeUnit\ objects and render them back, supporting operations like multiplication, division, and powers. This parser is integrated into the Pureconfig module, providing \ConfigReader\ and \ConfigWriter\ instances for \RuntimeUnit\ and \RuntimeQuantity\ via both DSL (string-based) and JSON (structured) formats. Additionally, a \PureconfigRuntime\ is provided to wire together the unit parser, coefficient runtime, and path mappers, enabling seamless configuration loading of quantities with runtime-determined units.

parser, pureconfig, runtime · high confidence

Introduction of DeltaQuantity for offset-based units

The library now supports quantities with an offset, such as temperature (Celsius/Fahrenheit) and epoch time, via the new DeltaQuantity type. This allows users to create, display, and convert offset-based values using methods like withDeltaUnit, toUnit, and toValue, and to perform arithmetic operations like subtraction between delta-quantities or addition of standard quantities to delta-quantities, ensuring correct handling of unit conversions that involve non-zero origins.

core/src/main/scala/coulomb · high confidence

New Cats integration and benchmark suite for Coulomb

This change introduces a new Cats integration module that provides cats.kernel typeclasses (Eq, Order, and Hash) for both Quantity and DeltaQuantity, allowing Coulomb values to be used seamlessly with Cats-based libraries. It also adds a new benchmark suite to evaluate performance improvements from inlining optimizations in the implicit type system, comparing regular versus optimized algebra implementations for unit addition and summation operations.

benchmarks, core/src/main/scala/coulomb/integrations, core/src/main/scala/coulomb/io · high confidence

Removals

Removal of core unit-analysis and quantity-operation infrastructure

The \coulomb\ module has removed its foundational infrastructure for compile-time unit analysis and quantity operations. This includes the deletion of the \Rational\ class used for unit coefficients, the \Quantity\ opaque type and its extension methods (such as \withUnit\, \show\, and arithmetic operators like \+\ and \\*\), and the entire \conversion\, \define\, \infra\, \ops\, and \policy\ packages. Consequently, the library no longer provides the mechanisms for defining base/derived units, performing type-safe arithmetic, or converting between units at compile time.

coulomb · high confidence

Behavioural changes

Migration to sbt and Scala 3 with updated formatting

The project has migrated its build system from Mill to sbt (evidenced by the removal of \build.sc\ and the \mill\ wrapper script) and adopted Scala 3 as the target language. A new \.scalafmt.conf\ file enforces code formatting rules for Scala 3, and the \README.md\ has been updated to reflect the new project identity, including updated badges and documentation links.

(repo-wide) · high confidence

New compile-time unit analysis and expression infrastructure

The \coulomb.infra\ package introduces a new set of Scala 3 macro-based utilities for compile-time unit analysis. This includes \meta.scala\ for canonical and simplified unit signature computation, coefficient extraction, and offset handling; \show.scala\ for rendering unit types into human-readable strings; \simplified.scala\ for transparently simplifying unit types; \typeexpr.scala\ for converting type-level expressions to runtime values (Int, Double, Rational, etc.); and \utils.scala\ for helper extensions. These changes enable more precise and efficient compile-time unit checking and conversion.

core/src/main/scala/coulomb/infra · high confidence

New unit definition hierarchy with named classes

The library introduces a new set of abstract base classes for defining units: \NamedUnit\, \BaseUnit\, \DerivedUnit\, \DeltaUnit\, and \ShowUnitAlias\. This structure allows users to define units with explicit names and abbreviations, supporting derived units (based on other units) and delta units (for offsets like temperature). The implementation uses named inner classes (\NC\) to avoid anonymous class code generation, improving performance and clarity in unit declarations.

core/src/main/scala/coulomb/define · high confidence

Refactored unit conversion system with dedicated DeltaQuantity support

The conversion logic in the core library has been restructured into a new, simplified implicit type system. This change introduces dedicated typeclasses and macros for handling unit conversions, including specific support for DeltaQuantity (temperature and time deltas) via new \DeltaUnitConversion\, \Coefficient\, \Offset\, and \ValueConversion\ components. Users will benefit from a more robust and explicit conversion mechanism that correctly handles offset-based units alongside standard multiplicative conversions, with all conversion logic now centralized in the \coulomb.conversion\ package.

core/src/main/scala/coulomb/conversion · high confidence

Test coverage

Added comprehensive test suites for core quantity operations; Added test infrastructure and unit definitions for Coulomb; Added unit tests for physical constants, SI units, temperature, and time conversions.

Dependencies

Update Scala 3 to 3.3.8 and upgrade core dependencies

The build configuration now targets Scala 3.3.8 as the cross-compiled version, aligning with the current LTS release. Several library dependencies have been updated to their latest versions: algebra and algebra-laws to 2.10.0, pureconfig-core to 0.17.10, refined to 0.11.1, cats-parse to 1.0.0, scala-java-time to 2.5.0, and scalacheck to 1.17.1. Additionally, the test framework munit is set to 1.0.0, and the base version for MIMA compatibility checks has been bumped to 0.9.

(dependencies) · high confidence

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

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 58.

Lenses

  • Code Health 99
  • Architecture 88
  • Maturity 53
  • Readiness 50
  • Security 65

Changes since last survey

  • 300 commits — 293 feature/other, 7 fixes

By area

  • (root) — 85 commits
  • project/plugins.sbt — 58 commits
  • project/build.properties — 32 commits
  • core/src — 25 commits
  • docs/index.md — 21 commits
  • (repo) — 20 commits
  • .github/workflows — 16 commits
  • units/src — 16 commits
  • docs/concepts.md — 11 commits
  • docs/coulomb-spire.md — 4 commits
  • docs/README.md — 2 commits
  • docs/styles.css — 2 commits
  • refined/src — 2 commits
  • spire/src — 2 commits
  • docs/assets — 1 commit
  • docs/coulomb-units.md — 1 commit
  • docs/develop.md — 1 commit
  • runtime/src — 1 commit

Notable commits

  • fix: fix and test toInstant with YearsBC (#388)
  • fix: fix bug in deltaunit offset checking (#432)
  • fix: fix implicitNotFound messages
  • fix: fix scaladoc for coefficient
  • fix: fix section titles
  • fix: fix sonatype link
  • fix: fix workflow name
  • change: 7 + false
  • change: Add a testkit (#253)
  • change: Add cats instances for Quantity (#281)
  • change: Add refined module to root (#417)
  • change: Flesh out the scaladoc for scala3 (#278)
  • change: Named unit defs (#269)
  • change: Physical constants (#270)
  • change: Rational -> integer is truncating
  • change: Rational conversions
  • change: Refactor rules to use priorities (#289)
  • change: Setup scrolling code blocks (#308)
  • change: Time and Temperature
  • change: US customary units
  • …and 280 more

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

Survey your own repository

erikerlandson/coulomb 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 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 3e01b74b517e244f14b3af38703f55a8a4ef636d — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.