Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ publish = false
clap = { version = "=4.6.9", features = ["derive"] }
codeint-config = { path = "crates/config" }
codeint-git = { path = "crates/git" }
codeint-lang-dart = { path = "plugins/languages/dart" }
codeint-lang-php = { path = "plugins/languages/php" }
codeint-lang-rust = { path = "plugins/languages/rust" }
codeint-lang-ts = { path = "plugins/languages/ts" }
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ It is for developers whose code is increasingly written by coding agents, so the

codeint reports each Metric on its own, with the Findings behind it, and never blends them into one score.
It gates CI on per-Metric Budgets and on Regressions against a base Git ref.
Languages and Metrics are Plugins: TypeScript/JavaScript, Rust, and PHP ship as built-in Language plugins, and third-party languages and Metrics load as WebAssembly Plugins.
Languages and Metrics are Plugins: TypeScript/JavaScript, Rust, PHP, and Dart ship as built-in Language plugins, and third-party languages and Metrics load as WebAssembly Plugins.

<p align="center">
<a href="#install">Install</a> ·
Expand Down Expand Up @@ -95,15 +95,16 @@ Without `codeint.json`, codeint measures every supported language with default s
"languages": [
{ "plugin": "typescript-javascript", "include": ["web"], "exclude": ["web/dist"] },
{ "plugin": "rust", "include": ["crates"], "exclude": [] },
{ "plugin": "php", "include": ["app", "src"], "exclude": [] }
{ "plugin": "php", "include": ["app", "src"], "exclude": [] },
{ "plugin": "dart", "include": ["lib"], "exclude": [] }
]
}
```

- **`source_sets`**: classify paths into `production`, `test`, `generated`, or `vendored` using globs (overrides built-in rules).
- **`budgets`**: hard maximum ratios (`0` to `1`) per Source set and Metric; `codeint check` and `codeint diff` exit `1` when exceeded.
- **`regression_limits`**: per-Metric or per-Source-set limits for `codeint diff` (`ratio_rise` defaults to `0.01`; `new_findings` accepts `any_new_finding`, `numerator_rise_with_new_findings`, or `never`).
- **`languages`**: scope built-in Language plugins (`typescript-javascript`, `rust`, `php`) or external plugins to specific folders and exclusions.
- **`languages`**: scope built-in Language plugins (`typescript-javascript`, `rust`, `php`, `dart`) or external plugins to specific folders and exclusions.
- **`plugins`** and **`plugin_limits`**: load external WebAssembly Language or Metric plugins with SHA-256 verification and memory/time caps.

See [docs/reference.md#codeintjson](./docs/reference.md#codeintjson) for every key, default value, and tested example.
Expand Down Expand Up @@ -148,6 +149,15 @@ Sample Production measurements from `codeint check` (release build, Apple Silico
| `laravel/laravel` | 29 | 762 | 0.0% | 0.0% | 0.0% | 8.0% | 0.03s |
| `laravel/framework` | 3,208 | 132,791 | 16.9% | 8.1% | 8.2% | 4.4% | 0.47s |

### Dart measurements and speed

Sample Production measurements from `codeint check` (release build, Apple Silicon):

| Repository | Files | Prod lines | Erosion | Duplication | Verbosity | Import cycles | Time |
| ---------- | ----- | ---------- | ------- | ----------- | --------- | ------------- | ---- |
| `dart-lang/pub` | 547 | 26,170 | 44.4% | 0.5% | 1.7% | 78.6% | 0.88s |
| `flutter/packages` | 4,137 | 434,407 | 45.9% | 23.1% | 23.3% | 18.5% | 3.68s |

## GitHub Actions

Add `.github/workflows/codeint.yml` to run `codeint diff` on each pull request and upload its SARIF report to GitHub code scanning:
Expand Down
2 changes: 1 addition & 1 deletion checks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project = ["correction"]

[commit]
types = ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"]
scopes = ["cli", "model", "host", "lang-ts", "lang-rust", "lang-php", "metrics", "git", "report", "config", "npm", "install", "release", "checks", "ci", "docs", "deps", "rules", "skills"]
scopes = ["cli", "model", "host", "lang-ts", "lang-rust", "lang-php", "lang-dart", "metrics", "git", "report", "config", "npm", "install", "release", "checks", "ci", "docs", "deps", "rules", "skills"]

[placeholders]
paths = [".rules", "docs/agents/**", "docs/checks/**"]
Expand Down
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ path = "src/main.rs"
[dependencies]
codeint-config = { workspace = true }
codeint-git = { workspace = true }
codeint-lang-dart = { workspace = true }
codeint-lang-php = { workspace = true }
codeint-lang-rust = { workspace = true }
codeint-lang-ts = { workspace = true }
Expand Down
7 changes: 6 additions & 1 deletion crates/cli/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use codeint_config::{
SourceSetOverrides, read_configuration,
};
use codeint_git::{GitError, Repository, Snapshot};
use codeint_lang_dart::Dart;
use codeint_lang_php::Php;
use codeint_lang_rust::Rust;
use codeint_lang_ts::TypeScriptAndJavaScript;
Expand Down Expand Up @@ -71,7 +72,7 @@ pub(crate) struct NamedLanguagePlugin<'plugin> {
pub(crate) plugin: &'plugin dyn LanguagePlugin,
}

pub(crate) const BUILT_IN_LANGUAGE_PLUGINS: [NamedLanguagePlugin<'static>; 3] = [
pub(crate) const BUILT_IN_LANGUAGE_PLUGINS: [NamedLanguagePlugin<'static>; 4] = [
NamedLanguagePlugin {
name: "typescript-javascript",
plugin: &TypeScriptAndJavaScript,
Expand All @@ -84,6 +85,10 @@ pub(crate) const BUILT_IN_LANGUAGE_PLUGINS: [NamedLanguagePlugin<'static>; 3] =
name: "php",
plugin: &Php,
},
NamedLanguagePlugin {
name: "dart",
plugin: &Dart,
},
];

pub(crate) struct LoadedPlugins {
Expand Down
30 changes: 29 additions & 1 deletion crates/cli/tests/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2875,7 +2875,7 @@ fn a_languages_entry_that_names_an_unknown_language_plugin_names_it_and_exits_2(
{ "plugin": "python", "include": ["scripts"] }
] }"#,
"codeint.json names an unknown Language plugin python at languages[1].plugin; \
the Language plugins are typescript-javascript, rust, php",
the Language plugins are typescript-javascript, rust, php, dart",
"Name one of the Language plugins listed, or remove the entry from languages.",
);
}
Expand Down Expand Up @@ -4700,3 +4700,31 @@ fn built_in_php_plugin_measures_composer_workspace_metrics_and_psr4_cycles() {
repository.commit_all();
assert_built_in_workspace_cycle_report(&repository, 2, "modules/core");
}

#[test]
fn built_in_dart_plugin_measures_pub_workspace_metrics_and_cycles() {
let repository = Repository::new();
for (path, body) in [
(
"pubspec.yaml",
"name: ws\nworkspace:\n - packages/mobile\n",
),
("packages/mobile/pubspec.yaml", "name: mobile\n"),
(
"packages/mobile/lib/alpha.dart",
"import 'package:mobile/beta.dart';\nbool check(bool x) { if (x) { return true; } else { return false; } }\n",
),
(
"packages/mobile/lib/beta.dart",
"import 'package:mobile/alpha.dart';\nint run() => 1;\n",
),
(
"packages/mobile/lib/alpha.g.dart",
"int generatedHelper() => 42;\n",
),
] {
repository.write(path, body);
}
repository.commit_all();
assert_built_in_workspace_cycle_report(&repository, 2, "packages/mobile");
}
1 change: 1 addition & 0 deletions crates/model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::fmt;

mod metric;
mod runtime_imports;
pub mod scan;
mod source_set;
#[cfg(test)]
mod tests;
Expand Down
Loading