Skip to main content

codeint 0.10.1 copy "codeint: ^0.10.1" to clipboard
codeint: ^0.10.1 copied to clipboard

Programmatic Dart client SDK and CLI runner for codeint, measuring Software entropy and Hazards.

codeint #

Official pure Dart client SDK and CLI runner for codeint.

codeint measures the Software entropy of a codebase and reports Hazards next to Software entropy across TypeScript, JavaScript, Rust, PHP, Dart, Python, Go, SQL, and Shell.

Installation #

Add codeint to your pubspec.yaml:

dev_dependencies:
  codeint: ^0.10.1

Pre-warm the verified native binary cache if desired:

dart run codeint:install

Run the CLI directly through Dart:

dart run codeint check

Programmatic usage #

import 'package:codeint/codeint.dart';

Future<void> main() async {
  final client = CodeintClient(cwd: '.');
  final result = await client.check();
  if (!result.passed) {
    throw StateError('codeint failed: ${result.failures.join(', ')}');
  }
  final production = result.report.sourceSets['production'];
  print('Erosion ratio: ${production?.erosion.ratio}');
}

client.diff(baseRef, const DiffOptions(format: ReportRenderFormat.markdown, renameThreshold: 50)) runs codeint diff once, parses the typed DiffReport, and pipes the raw JSON into codeint report - so GatedOutcome.rendered holds the formatted output alongside report. client.stateCheck(baseRef, const StateCheckOptions(path: ..., headRef: ..., renameThreshold: 50)) returns GatedOutcome<StateCheckReport> with typed StateCheckViolation entries on exit 0 or 1 and throws CodeintError on exit 2. client.trend(const TrendOptions(last: N)) forwards --commits N directly to the CLI and throws CodeintError for non-positive last or when combined with since. client.report(input, const ReportOptions(output: path)) resolves relative output paths against cwd, reads back the written file, and returns the rendered report text (throwing CodeintError if reading fails).

Typed report models cover every built-in Metric. File size is typed as fileSize on SourceSetReport, PackageSection, SourceSetChanges, and TrendRow, and is null unless file_size.max_source_lines is set in the configuration. Each Oversized file Finding carries path, sourceLines, and excessLines.

Binary resolution #

ensureBinary() resolves the native codeint binary in four deterministic steps:

  1. Explicit binaryPath option.
  2. CODEINT_BIN environment variable.
  3. Version-matching codeint executable on PATH.
  4. Version-pinned GitHub Release archive verified against SHA256SUMS before extraction and stored in the local user cache.

Set allowDownload: false in offline CI environments to fail fast without network access when no local binary is available.

0
likes
0
points
345
downloads

Publisher

unverified uploader

Weekly Downloads

Programmatic Dart client SDK and CLI runner for codeint, measuring Software entropy and Hazards.

Repository (GitHub)
View/report issues

Topics

#static-analysis #code-quality #metrics #cli #linter

License

unknown (license)

Dependencies

archive, crypto

More

Packages that depend on codeint