dart-decimate 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/Cargo.lock +572 -0
  2. package/Cargo.toml +41 -0
  3. package/LICENSE +21 -0
  4. package/README.md +617 -0
  5. package/assets/dart-decimate-banner.png +0 -0
  6. package/npm/bin/dart-decimate-mcp.js +48 -0
  7. package/npm/bin/dart-decimate.js +48 -0
  8. package/npm/scripts/postinstall.js +46 -0
  9. package/npm/scripts/test-npx-local.js +54 -0
  10. package/npm/scripts/test-npx-mcp-local.js +56 -0
  11. package/package.json +45 -0
  12. package/src/baseline.rs +643 -0
  13. package/src/bin/dart-decimate-mcp.rs +11 -0
  14. package/src/boundaries/tests.rs +60 -0
  15. package/src/boundaries.rs +317 -0
  16. package/src/changed_scope.rs +117 -0
  17. package/src/ci_template.rs +399 -0
  18. package/src/cli/analyze.rs +462 -0
  19. package/src/cli/analyzer_options.rs +82 -0
  20. package/src/cli/audit_run.rs +327 -0
  21. package/src/cli/boundary_args.rs +44 -0
  22. package/src/cli/ci_template_run.rs +196 -0
  23. package/src/cli/command_name.rs +20 -0
  24. package/src/cli/common_args.rs +167 -0
  25. package/src/cli/config_run.rs +78 -0
  26. package/src/cli/coverage_run.rs +393 -0
  27. package/src/cli/decision_surface_run.rs +99 -0
  28. package/src/cli/default_command.rs +69 -0
  29. package/src/cli/dupes_args.rs +150 -0
  30. package/src/cli/entry_points.rs +121 -0
  31. package/src/cli/error.rs +149 -0
  32. package/src/cli/error_output.rs +68 -0
  33. package/src/cli/explain_run.rs +72 -0
  34. package/src/cli/fix_run.rs +162 -0
  35. package/src/cli/flags_args.rs +23 -0
  36. package/src/cli/health_args.rs +200 -0
  37. package/src/cli/hooks_run.rs +191 -0
  38. package/src/cli/impact_run.rs +95 -0
  39. package/src/cli/init_run.rs +49 -0
  40. package/src/cli/inspect_args.rs +20 -0
  41. package/src/cli/inspect_run.rs +66 -0
  42. package/src/cli/issue_filter_args.rs +240 -0
  43. package/src/cli/list_run.rs +311 -0
  44. package/src/cli/mode_args.rs +72 -0
  45. package/src/cli/output_format.rs +62 -0
  46. package/src/cli/regression_args.rs +156 -0
  47. package/src/cli/request_args.rs +175 -0
  48. package/src/cli/schema_commands.rs +72 -0
  49. package/src/cli/scope_args.rs +174 -0
  50. package/src/cli/security_args.rs +175 -0
  51. package/src/cli/security_gate_run.rs +66 -0
  52. package/src/cli/security_summary_run.rs +43 -0
  53. package/src/cli/summary_args.rs +12 -0
  54. package/src/cli/tests.rs +516 -0
  55. package/src/cli/trace_args.rs +67 -0
  56. package/src/cli/trace_run.rs +131 -0
  57. package/src/cli/trace_tests.rs +235 -0
  58. package/src/cli/unsupported_run.rs +116 -0
  59. package/src/cli/watch_run.rs +153 -0
  60. package/src/cli.rs +603 -0
  61. package/src/config/boundary_config.rs +235 -0
  62. package/src/config/cache.rs +25 -0
  63. package/src/config/dependencies.rs +114 -0
  64. package/src/config/health.rs +237 -0
  65. package/src/config/jsonc.rs +66 -0
  66. package/src/config/policy.rs +91 -0
  67. package/src/config/rule_aliases.rs +487 -0
  68. package/src/config/rules.rs +339 -0
  69. package/src/config.rs +635 -0
  70. package/src/coverage.rs +469 -0
  71. package/src/dart_parser.rs +673 -0
  72. package/src/decision_surface.rs +405 -0
  73. package/src/dependencies/analyze.rs +218 -0
  74. package/src/dependencies/codegen.rs +118 -0
  75. package/src/dependencies/discovery.rs +60 -0
  76. package/src/dependencies/overrides.rs +76 -0
  77. package/src/dependencies/private_src_imports.rs +32 -0
  78. package/src/dependencies/pubspec_document.rs +86 -0
  79. package/src/dependencies/pubspec_entry.rs +96 -0
  80. package/src/dependencies/tests.rs +544 -0
  81. package/src/dependencies/usage.rs +33 -0
  82. package/src/dependencies.rs +553 -0
  83. package/src/dependency_scripts.rs +91 -0
  84. package/src/dupes/lex.rs +236 -0
  85. package/src/dupes/tests.rs +119 -0
  86. package/src/dupes.rs +625 -0
  87. package/src/explain.rs +692 -0
  88. package/src/extract/directives.rs +252 -0
  89. package/src/extract/error_tests.rs +25 -0
  90. package/src/extract/members.rs +210 -0
  91. package/src/extract/primary_constructors.rs +421 -0
  92. package/src/extract/references.rs +151 -0
  93. package/src/extract/routes.rs +691 -0
  94. package/src/extract/signatures.rs +266 -0
  95. package/src/extract/string_tests.rs +18 -0
  96. package/src/extract/strings.rs +107 -0
  97. package/src/extract/tests.rs +697 -0
  98. package/src/extract.rs +680 -0
  99. package/src/feature_flags/tests.rs +76 -0
  100. package/src/feature_flags.rs +453 -0
  101. package/src/finding_identity.rs +60 -0
  102. package/src/fix.rs +551 -0
  103. package/src/generated.rs +53 -0
  104. package/src/graph/augment_tests.rs +212 -0
  105. package/src/graph/conditionals.rs +74 -0
  106. package/src/graph/package_config_tests.rs +100 -0
  107. package/src/graph/parts.rs +248 -0
  108. package/src/graph/pubspec_tests.rs +119 -0
  109. package/src/graph/tests.rs +837 -0
  110. package/src/graph/uri_tests.rs +102 -0
  111. package/src/graph.rs +644 -0
  112. package/src/health/coverage.rs +309 -0
  113. package/src/health/ownership.rs +175 -0
  114. package/src/health/runtime_coverage.rs +616 -0
  115. package/src/health/runtime_intelligence.rs +511 -0
  116. package/src/health/scores.rs +296 -0
  117. package/src/health/tests.rs +240 -0
  118. package/src/health/threshold_types.rs +163 -0
  119. package/src/health/thresholds.rs +229 -0
  120. package/src/health/types.rs +636 -0
  121. package/src/health.rs +597 -0
  122. package/src/hooks/agent_settings.rs +175 -0
  123. package/src/hooks/templates.rs +51 -0
  124. package/src/hooks.rs +569 -0
  125. package/src/impact.rs +287 -0
  126. package/src/init.rs +237 -0
  127. package/src/inspect.rs +142 -0
  128. package/src/intelligence/tests.rs +232 -0
  129. package/src/intelligence.rs +305 -0
  130. package/src/lib.rs +198 -0
  131. package/src/main.rs +5 -0
  132. package/src/manifest/mcp.rs +565 -0
  133. package/src/manifest.rs +552 -0
  134. package/src/mcp/cli_args/value_args.rs +175 -0
  135. package/src/mcp/cli_args.rs +658 -0
  136. package/src/mcp/cli_args_tests.rs +522 -0
  137. package/src/mcp/code_execute.rs +671 -0
  138. package/src/mcp/tools.rs +660 -0
  139. package/src/mcp.rs +325 -0
  140. package/src/output/audit_risk.rs +135 -0
  141. package/src/output/dependency_findings.rs +327 -0
  142. package/src/output/duplication_findings.rs +114 -0
  143. package/src/output/feature_flag_findings.rs +122 -0
  144. package/src/output/format.rs +31 -0
  145. package/src/output/graph_findings.rs +461 -0
  146. package/src/output/health_findings.rs +612 -0
  147. package/src/output/human.rs +27 -0
  148. package/src/output/next_steps.rs +92 -0
  149. package/src/output/route_findings.rs +76 -0
  150. package/src/output/runtime_coverage.rs +515 -0
  151. package/src/output/scope.rs +183 -0
  152. package/src/output/security_findings.rs +390 -0
  153. package/src/output/security_sarif.rs +150 -0
  154. package/src/output/suppressions.rs +323 -0
  155. package/src/output/symbol_findings.rs +257 -0
  156. package/src/output/tests.rs +114 -0
  157. package/src/output/types.rs +604 -0
  158. package/src/output/widget_findings.rs +213 -0
  159. package/src/output.rs +682 -0
  160. package/src/package_map.rs +495 -0
  161. package/src/policy/packs.rs +232 -0
  162. package/src/policy/tests.rs +134 -0
  163. package/src/policy.rs +640 -0
  164. package/src/project_list.rs +376 -0
  165. package/src/report_schema/inventory.rs +418 -0
  166. package/src/report_schema.rs +488 -0
  167. package/src/routes.rs +354 -0
  168. package/src/scan/tests.rs +250 -0
  169. package/src/scan.rs +275 -0
  170. package/src/security/detect.rs +639 -0
  171. package/src/security/tests.rs +178 -0
  172. package/src/security.rs +373 -0
  173. package/src/security_gate.rs +555 -0
  174. package/src/symbols/path_filters.rs +27 -0
  175. package/src/symbols/private_type_leaks.rs +125 -0
  176. package/src/symbols/riverpod.rs +113 -0
  177. package/src/symbols/tests.rs +692 -0
  178. package/src/symbols.rs +693 -0
  179. package/src/trace/tests.rs +225 -0
  180. package/src/trace.rs +690 -0
  181. package/src/unsupported.rs +47 -0
  182. package/src/widgets/lifecycle.rs +484 -0
  183. package/src/widgets/params.rs +236 -0
  184. package/src/widgets/tests.rs +430 -0
  185. package/src/widgets/top_level.rs +110 -0
  186. package/src/widgets/unrendered.rs +374 -0
  187. package/src/widgets.rs +590 -0
  188. package/src/workspace_scope.rs +358 -0
@@ -0,0 +1,399 @@
1
+ use std::collections::BTreeSet;
2
+ use std::fs;
3
+ use std::path::{Path, PathBuf};
4
+
5
+ use serde::{Deserialize, Serialize};
6
+ use serde_json::Value;
7
+ use thiserror::Error;
8
+
9
+ /// Stable schema version for CI template output.
10
+ pub const CI_TEMPLATE_SCHEMA_VERSION: &str = "dart-decimate.ci-template.v1";
11
+ pub const CI_RECONCILE_REVIEW_SCHEMA_VERSION: &str = "dart-decimate.ci-reconcile-review.v1";
12
+
13
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
14
+ #[serde(rename_all = "kebab-case")]
15
+ pub enum CiTemplatePlatform {
16
+ Github,
17
+ Gitlab,
18
+ }
19
+
20
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
21
+ #[serde(rename_all = "kebab-case")]
22
+ pub enum CiReviewProvider {
23
+ Github,
24
+ Gitlab,
25
+ }
26
+
27
+ impl CiTemplatePlatform {
28
+ #[must_use]
29
+ pub const fn as_str(self) -> &'static str {
30
+ match self {
31
+ Self::Github => "github",
32
+ Self::Gitlab => "gitlab",
33
+ }
34
+ }
35
+ }
36
+
37
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
38
+ pub struct CiTemplateReport {
39
+ pub schema_version: String,
40
+ pub kind: String,
41
+ pub tool: String,
42
+ pub command: String,
43
+ pub platform: CiTemplatePlatform,
44
+ pub vendor: bool,
45
+ pub files: Vec<CiTemplateFile>,
46
+ }
47
+
48
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
49
+ pub struct CiTemplateFile {
50
+ pub path: String,
51
+ pub executable: bool,
52
+ pub content: String,
53
+ }
54
+
55
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
56
+ pub struct CiReconcileReviewReport {
57
+ pub schema_version: String,
58
+ pub kind: String,
59
+ pub tool: String,
60
+ pub command: String,
61
+ pub provider: CiReviewProvider,
62
+ pub dry_run: bool,
63
+ pub envelope: PathBuf,
64
+ pub repo: Option<String>,
65
+ pub project_id: Option<String>,
66
+ pub pr: Option<String>,
67
+ pub mr: Option<String>,
68
+ pub api_url: Option<String>,
69
+ pub summary: CiReconcileReviewSummary,
70
+ pub fingerprints: Vec<String>,
71
+ pub failed_fingerprints: Vec<String>,
72
+ pub unapplied_fingerprints: Vec<String>,
73
+ pub apply_hint: String,
74
+ }
75
+
76
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
77
+ pub struct CiReconcileReviewSummary {
78
+ pub envelope_fingerprints: usize,
79
+ pub stale_candidates: usize,
80
+ pub applied: usize,
81
+ pub unapplied: usize,
82
+ pub apply_errors: usize,
83
+ }
84
+
85
+ #[derive(Debug, Clone, PartialEq, Eq)]
86
+ pub struct CiReconcileReviewOptions {
87
+ pub provider: CiReviewProvider,
88
+ pub envelope: PathBuf,
89
+ pub dry_run: bool,
90
+ pub repo: Option<String>,
91
+ pub project_id: Option<String>,
92
+ pub pr: Option<String>,
93
+ pub mr: Option<String>,
94
+ pub api_url: Option<String>,
95
+ }
96
+
97
+ #[derive(Debug, Error)]
98
+ pub enum CiTemplateError {
99
+ #[error("ci reconcile-review is dry-run only in this release; pass --dry-run")]
100
+ ReconcileDryRunRequired,
101
+ #[error("failed to read review envelope {path}: {source}")]
102
+ ReadEnvelope {
103
+ path: PathBuf,
104
+ source: std::io::Error,
105
+ },
106
+ #[error("failed to parse review envelope {path}: {source}")]
107
+ ParseEnvelope {
108
+ path: PathBuf,
109
+ source: serde_json::Error,
110
+ },
111
+ #[error("refusing to overwrite existing CI template file {path}; pass --force")]
112
+ AlreadyExists { path: PathBuf },
113
+ #[error("failed to create directory {path}: {source}")]
114
+ CreateDir {
115
+ path: PathBuf,
116
+ source: std::io::Error,
117
+ },
118
+ #[error("failed to write CI template file {path}: {source}")]
119
+ Write {
120
+ path: PathBuf,
121
+ source: std::io::Error,
122
+ },
123
+ #[error("failed to mark CI helper executable {path}: {source}")]
124
+ Permissions {
125
+ path: PathBuf,
126
+ source: std::io::Error,
127
+ },
128
+ }
129
+
130
+ #[must_use]
131
+ pub fn ci_template_report(platform: CiTemplatePlatform, vendor: bool) -> CiTemplateReport {
132
+ CiTemplateReport {
133
+ schema_version: CI_TEMPLATE_SCHEMA_VERSION.to_owned(),
134
+ kind: "ci-template".to_owned(),
135
+ tool: "dart-decimate".to_owned(),
136
+ command: "ci-template".to_owned(),
137
+ platform,
138
+ vendor,
139
+ files: template_files(platform, vendor),
140
+ }
141
+ }
142
+
143
+ /// Write the selected CI template files under `root`.
144
+ ///
145
+ /// # Errors
146
+ ///
147
+ /// Returns [`CiTemplateError`] when a target file already exists without
148
+ /// `force`, or when directories, files, or executable permissions cannot be
149
+ /// written.
150
+ pub fn vendor_ci_template(
151
+ root: impl AsRef<Path>,
152
+ platform: CiTemplatePlatform,
153
+ force: bool,
154
+ ) -> Result<CiTemplateReport, CiTemplateError> {
155
+ let report = ci_template_report(platform, true);
156
+ let root = root.as_ref();
157
+ for file in &report.files {
158
+ let path = root.join(&file.path);
159
+ write_template_file(&path, file, force)?;
160
+ }
161
+ Ok(report)
162
+ }
163
+
164
+ /// Build a dry-run CI review reconciliation report.
165
+ ///
166
+ /// # Errors
167
+ ///
168
+ /// Returns [`CiTemplateError`] when the envelope cannot be read or parsed, or
169
+ /// when provider mutation is requested.
170
+ pub fn ci_reconcile_review_report(
171
+ options: CiReconcileReviewOptions,
172
+ ) -> Result<CiReconcileReviewReport, CiTemplateError> {
173
+ if !options.dry_run {
174
+ return Err(CiTemplateError::ReconcileDryRunRequired);
175
+ }
176
+ let envelope = &options.envelope;
177
+ let source = fs::read_to_string(envelope).map_err(|source| CiTemplateError::ReadEnvelope {
178
+ path: envelope.clone(),
179
+ source,
180
+ })?;
181
+ let value = serde_json::from_str::<Value>(&source).map_err(|source| {
182
+ CiTemplateError::ParseEnvelope {
183
+ path: envelope.clone(),
184
+ source,
185
+ }
186
+ })?;
187
+ let fingerprints = envelope_fingerprints(&value);
188
+ Ok(CiReconcileReviewReport {
189
+ schema_version: CI_RECONCILE_REVIEW_SCHEMA_VERSION.to_owned(),
190
+ kind: "ci-reconcile-review".to_owned(),
191
+ tool: "dart-decimate".to_owned(),
192
+ command: "ci reconcile-review".to_owned(),
193
+ provider: options.provider,
194
+ dry_run: options.dry_run,
195
+ envelope: envelope.clone(),
196
+ repo: options.repo,
197
+ project_id: options.project_id,
198
+ pr: options.pr,
199
+ mr: options.mr,
200
+ api_url: options.api_url,
201
+ summary: CiReconcileReviewSummary {
202
+ envelope_fingerprints: fingerprints.len(),
203
+ stale_candidates: 0,
204
+ applied: 0,
205
+ unapplied: fingerprints.len(),
206
+ apply_errors: 0,
207
+ },
208
+ failed_fingerprints: Vec::new(),
209
+ unapplied_fingerprints: fingerprints.clone(),
210
+ fingerprints,
211
+ apply_hint:
212
+ "dry-run only: provider comment mutation is not implemented by Dart Decimate yet"
213
+ .to_owned(),
214
+ })
215
+ }
216
+
217
+ #[must_use]
218
+ pub fn render_ci_template(report: &CiTemplateReport) -> String {
219
+ if !report.vendor {
220
+ return report
221
+ .files
222
+ .first()
223
+ .map_or_else(String::new, |file| file.content.clone());
224
+ }
225
+
226
+ report
227
+ .files
228
+ .iter()
229
+ .map(|file| format!("# {}\n{}", file.path, file.content))
230
+ .collect::<Vec<_>>()
231
+ .join("\n")
232
+ }
233
+
234
+ fn write_template_file(
235
+ path: &Path,
236
+ file: &CiTemplateFile,
237
+ force: bool,
238
+ ) -> Result<(), CiTemplateError> {
239
+ if path.exists() && !force {
240
+ return Err(CiTemplateError::AlreadyExists {
241
+ path: path.to_path_buf(),
242
+ });
243
+ }
244
+ if let Some(parent) = path.parent() {
245
+ fs::create_dir_all(parent).map_err(|source| CiTemplateError::CreateDir {
246
+ path: parent.to_path_buf(),
247
+ source,
248
+ })?;
249
+ }
250
+ fs::write(path, &file.content).map_err(|source| CiTemplateError::Write {
251
+ path: path.to_path_buf(),
252
+ source,
253
+ })?;
254
+ mark_executable(path, file.executable)
255
+ }
256
+
257
+ fn mark_executable(path: &Path, executable: bool) -> Result<(), CiTemplateError> {
258
+ if !executable {
259
+ return Ok(());
260
+ }
261
+ #[cfg(unix)]
262
+ {
263
+ use std::os::unix::fs::PermissionsExt;
264
+ let mut permissions = fs::metadata(path)
265
+ .map_err(|source| CiTemplateError::Permissions {
266
+ path: path.to_path_buf(),
267
+ source,
268
+ })?
269
+ .permissions();
270
+ permissions.set_mode(0o755);
271
+ fs::set_permissions(path, permissions).map_err(|source| CiTemplateError::Permissions {
272
+ path: path.to_path_buf(),
273
+ source,
274
+ })
275
+ }
276
+ #[cfg(not(unix))]
277
+ {
278
+ let _ = path;
279
+ Ok(())
280
+ }
281
+ }
282
+
283
+ fn template_files(platform: CiTemplatePlatform, vendor: bool) -> Vec<CiTemplateFile> {
284
+ match (platform, vendor) {
285
+ (CiTemplatePlatform::Github, _) => vec![template_file(
286
+ ".github/workflows/dart-decimate.yml",
287
+ false,
288
+ GITHUB_WORKFLOW,
289
+ )],
290
+ (CiTemplatePlatform::Gitlab, false) => {
291
+ vec![template_file(".gitlab-ci.yml", false, GITLAB_CI)]
292
+ }
293
+ (CiTemplatePlatform::Gitlab, true) => vec![
294
+ template_file("ci/gitlab-ci.yml", false, GITLAB_VENDORED_CI),
295
+ template_file("ci/scripts/review.sh", true, GITLAB_REVIEW_SCRIPT),
296
+ template_file("ci/scripts/comment.sh", true, GITLAB_COMMENT_SCRIPT),
297
+ ],
298
+ }
299
+ }
300
+
301
+ fn template_file(path: &str, executable: bool, content: &str) -> CiTemplateFile {
302
+ CiTemplateFile {
303
+ path: path.to_owned(),
304
+ executable,
305
+ content: content.to_owned(),
306
+ }
307
+ }
308
+
309
+ fn envelope_fingerprints(value: &Value) -> Vec<String> {
310
+ let mut fingerprints = BTreeSet::new();
311
+ collect_fingerprints(value, &mut fingerprints);
312
+ fingerprints.into_iter().collect()
313
+ }
314
+
315
+ fn collect_fingerprints(value: &Value, fingerprints: &mut BTreeSet<String>) {
316
+ match value {
317
+ Value::Object(object) => {
318
+ if let Some(fingerprint) = object.get("fingerprint").and_then(Value::as_str) {
319
+ fingerprints.insert(fingerprint.to_owned());
320
+ }
321
+ for value in object.values() {
322
+ collect_fingerprints(value, fingerprints);
323
+ }
324
+ }
325
+ Value::Array(values) => {
326
+ for value in values {
327
+ collect_fingerprints(value, fingerprints);
328
+ }
329
+ }
330
+ _ => {}
331
+ }
332
+ }
333
+
334
+ const GITHUB_WORKFLOW: &str = r"name: Dart Decimate
335
+
336
+ on:
337
+ pull_request:
338
+ push:
339
+ branches: [main]
340
+
341
+ jobs:
342
+ dart-decimate:
343
+ runs-on: ubuntu-latest
344
+ permissions:
345
+ contents: read
346
+ steps:
347
+ - uses: actions/checkout@v4
348
+ with:
349
+ fetch-depth: 0
350
+ - run: |
351
+ rustup toolchain install 1.85.0 --profile minimal
352
+ rustup default 1.85.0
353
+ - run: cargo install --git https://github.com/sgaabdu4/dart-decimate --locked dart-decimate
354
+ - run: dart-decimate audit --format json --base origin/${{ github.base_ref || 'main' }}
355
+ ";
356
+
357
+ const GITLAB_CI: &str = r#"stages:
358
+ - quality
359
+
360
+ dart-decimate:
361
+ stage: quality
362
+ image: rust:latest
363
+ before_script:
364
+ - rustup toolchain install 1.85.0 --profile minimal
365
+ - rustup default 1.85.0
366
+ - cargo install --git https://github.com/sgaabdu4/dart-decimate --locked dart-decimate
367
+ script:
368
+ - dart-decimate audit --format json --base "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}"
369
+ rules:
370
+ - if: $CI_MERGE_REQUEST_IID
371
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
372
+ "#;
373
+
374
+ const GITLAB_VENDORED_CI: &str = r".dart-decimate:
375
+ stage: quality
376
+ image: rust:latest
377
+ before_script:
378
+ - rustup toolchain install 1.85.0 --profile minimal
379
+ - rustup default 1.85.0
380
+ - cargo install --git https://github.com/sgaabdu4/dart-decimate --locked dart-decimate
381
+ script:
382
+ - ci/scripts/review.sh
383
+ rules:
384
+ - if: $CI_MERGE_REQUEST_IID
385
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
386
+ ";
387
+
388
+ const GITLAB_REVIEW_SCRIPT: &str = r#"#!/usr/bin/env sh
389
+ set -eu
390
+
391
+ BASE="origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}"
392
+ dart-decimate audit --format json --base "$BASE"
393
+ "#;
394
+
395
+ const GITLAB_COMMENT_SCRIPT: &str = r#"#!/usr/bin/env sh
396
+ set -eu
397
+
398
+ dart-decimate review --format json --base "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}"
399
+ "#;