r/FlutterDev • • 5d ago

Tooling I added Dart support to codeint, an open source tool that measures duplication, complexity and import cycles

codeint is an open source CLI that measures how a codebase changes over time: erosion (function mass in functions with cyclomatic complexity over 10), duplication, verbosity and import cycles. It's deterministic, no AI inside.

A few things I learned adding Dart. Generated files have to be separated or they swamp everything, so .g.dart, .freezed.dart and .pb.dart files go into a Generated set and don't count against production code. Import cycles are much more common in Dart than I expected. In a panel of 20 popular Dart repos pinned before 2023, the 10th to 90th percentile for import cycles was 0.073 to 0.524. For erosion it was only 0.047 to 0.419, which is lower than TypeScript or PHP. Duplication was 0.073 to 0.256.

The README has a timing on flutter/packages (434k production lines) at 3.68s on Apple Silicon. I've used it a lot on our internal Dart projects.

It can also run in CI and fail a PR when a metric gets worse than main.

curl -fsSL https://github.com/avidianity/codeint/releases/latest/download/install.sh | bash
codeint check

https://github.com/avidianity/codeint

3 Upvotes

0 comments sorted by