kareki 0.1.0 copy "kareki: ^0.1.0" to clipboard
kareki: ^0.1.0 copied to clipboard

A multi-package dead code detector for Dart and Flutter monorepos. Finds unused public APIs, files, and pub dependencies across Melos / pub workspaces.

example/example.md

kareki examples #

Most users invoke kareki through its CLI; the entries below cover both the CLI and the programmatic API.

CLI — default text output #

$ cd path/to/your-monorepo
$ dart run kareki

• Package: analytics
  [unused_element] lib/event/value/seek_reason.dart:1:6
    Unused public enumDecl 'SeekReasonA'.
• Package: app
  [unused_file] lib/foundation/slo/slo_sampling_rate.dart:1:1
    File is never imported, parted, or exported.
• Package: legacy_data
  [unused_pub_dependency] pubspec.yaml:1:1
    Dependency 'rxdart' is declared in pubspec.yaml but never imported within 'legacy_data'.

kareki: 3 finding(s) across 3 package(s).

CLI — JSON for CI #

$ dart run kareki --format json | jq '.findings | length'
3

CLI — restrict to a single rule #

$ dart run kareki --rule unused_pub_dependency

CLI — restrict to specific packages #

$ dart run kareki --packages app --packages domain

Programmatic API #

See example.dart:

import 'package:kareki/kareki.dart';

void main() {
  const root = '.';
  final config = KarekiConfig.load(root);
  final result = KarekiRunner().run(
    RunRequest(rootPath: root, config: config),
  );
  // ignore: avoid_print
  print(TextReporter().render(result.findings, rootPath: root));
}

kareki-config.yaml #

See the Configuration section in the README for the full schema, and example/kareki-config.yaml for a runnable minimum.

keep_alive_annotations:
  presets: [freezed, riverpod, json_serializable, auto_route]

custom_presets:
  my_internal_di:
    keep_alive_annotations: [Injectable]
    annotation_implied_packages:
      Injectable: [my_di_package]

ignore:
  packages: [internal_library_pkg]
  dependencies:
    my_app:
      - geolocator_android
      - google_sign_in_ios
1
likes
0
points
3.74k
downloads

Publisher

unverified uploader

Weekly Downloads

A multi-package dead code detector for Dart and Flutter monorepos. Finds unused public APIs, files, and pub dependencies across Melos / pub workspaces.

Repository (GitHub)
View/report issues

Topics

#dead-code #linter #monorepo #melos #cli

License

unknown (license)

Dependencies

analyzer, args, glob, path, pool, pub_semver, yaml

More

Packages that depend on kareki