dart-decimate 0.0.38 → 0.0.40
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.
- package/Cargo.lock +27 -28
- package/Cargo.toml +3 -3
- package/README.md +6 -2
- package/package.json +2 -2
- package/src/baseline.rs +7 -7
- package/src/ci_template.rs +6 -6
- package/src/cli/coverage_run.rs +12 -12
- package/src/cli/dupes_args.rs +16 -16
- package/src/cli/health_args.rs +28 -28
- package/src/cli/request_args.rs +4 -4
- package/src/cli.rs +4 -4
- package/src/dart_parser.rs +261 -31
- package/src/extract/members.rs +4 -4
- package/src/extract/primary_constructors.rs +5 -5
- package/src/extract/references.rs +8 -8
- package/src/extract/routes.rs +38 -40
- package/src/extract/signatures.rs +8 -8
- package/src/extract/strings.rs +2 -3
- package/src/extract.rs +8 -8
- package/src/graph/parts.rs +5 -6
- package/src/graph.rs +24 -25
- package/src/health/runtime_coverage.rs +5 -5
- package/src/output/next_steps.rs +4 -4
- package/src/output/security_sarif.rs +10 -10
- package/src/output/suppressions.rs +12 -12
- package/src/package_map.rs +18 -20
- package/src/security/detect/weak_randomness.rs +3 -5
- package/src/security/detect.rs +18 -17
- package/src/widgets/patterns.rs +2 -0
- package/src/widgets/tests.rs +28 -5
- package/src/widgets/top_level.rs +2 -0
- package/src/widgets/unrendered.rs +8 -8
package/Cargo.lock
CHANGED
|
@@ -19,9 +19,9 @@ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
|
|
|
19
19
|
|
|
20
20
|
[[package]]
|
|
21
21
|
name = "bitflags"
|
|
22
|
-
version = "2.13.
|
|
22
|
+
version = "2.13.2"
|
|
23
23
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
-
checksum = "
|
|
24
|
+
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
25
25
|
|
|
26
26
|
[[package]]
|
|
27
27
|
name = "bstr"
|
|
@@ -35,9 +35,9 @@ dependencies = [
|
|
|
35
35
|
|
|
36
36
|
[[package]]
|
|
37
37
|
name = "cc"
|
|
38
|
-
version = "1.4.
|
|
38
|
+
version = "1.4.6"
|
|
39
39
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
-
checksum = "
|
|
40
|
+
checksum = "a3eb0f42d6c360dc3f8a821f6bf2fdea7f72bfd36b3076eb0e6d1e9e0752fff4"
|
|
41
41
|
dependencies = [
|
|
42
42
|
"find-msvc-tools",
|
|
43
43
|
"shlex",
|
|
@@ -77,9 +77,9 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
|
|
|
77
77
|
|
|
78
78
|
[[package]]
|
|
79
79
|
name = "crossbeam-deque"
|
|
80
|
-
version = "0.8.
|
|
80
|
+
version = "0.8.8"
|
|
81
81
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
82
|
-
checksum = "
|
|
82
|
+
checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
|
|
83
83
|
dependencies = [
|
|
84
84
|
"crossbeam-epoch",
|
|
85
85
|
"crossbeam-utils",
|
|
@@ -87,22 +87,22 @@ dependencies = [
|
|
|
87
87
|
|
|
88
88
|
[[package]]
|
|
89
89
|
name = "crossbeam-epoch"
|
|
90
|
-
version = "0.9.
|
|
90
|
+
version = "0.9.21"
|
|
91
91
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
|
-
checksum = "
|
|
92
|
+
checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
|
|
93
93
|
dependencies = [
|
|
94
94
|
"crossbeam-utils",
|
|
95
95
|
]
|
|
96
96
|
|
|
97
97
|
[[package]]
|
|
98
98
|
name = "crossbeam-utils"
|
|
99
|
-
version = "0.8.
|
|
99
|
+
version = "0.8.23"
|
|
100
100
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
-
checksum = "
|
|
101
|
+
checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
|
|
102
102
|
|
|
103
103
|
[[package]]
|
|
104
104
|
name = "dart-decimate"
|
|
105
|
-
version = "0.0.
|
|
105
|
+
version = "0.0.40"
|
|
106
106
|
dependencies = [
|
|
107
107
|
"clap",
|
|
108
108
|
"glob",
|
|
@@ -149,9 +149,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
|
149
149
|
|
|
150
150
|
[[package]]
|
|
151
151
|
name = "find-msvc-tools"
|
|
152
|
-
version = "0.1.
|
|
152
|
+
version = "0.1.12"
|
|
153
153
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
154
|
-
checksum = "
|
|
154
|
+
checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d"
|
|
155
155
|
|
|
156
156
|
[[package]]
|
|
157
157
|
name = "fixedbitset"
|
|
@@ -184,9 +184,9 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
|
|
|
184
184
|
|
|
185
185
|
[[package]]
|
|
186
186
|
name = "globset"
|
|
187
|
-
version = "0.4.
|
|
187
|
+
version = "0.4.20"
|
|
188
188
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
189
|
-
checksum = "
|
|
189
|
+
checksum = "07c34a9410465b45bd9787443bc7370f37735bad04b0f0cd57ff1a3186c98988"
|
|
190
190
|
dependencies = [
|
|
191
191
|
"aho-corasick",
|
|
192
192
|
"bstr",
|
|
@@ -212,9 +212,9 @@ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
|
212
212
|
|
|
213
213
|
[[package]]
|
|
214
214
|
name = "ignore"
|
|
215
|
-
version = "0.4.
|
|
215
|
+
version = "0.4.33"
|
|
216
216
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
217
|
-
checksum = "
|
|
217
|
+
checksum = "00b69833ed729dc5aa7d19541d96d6cf8e9137194207a04916d658e43168402f"
|
|
218
218
|
dependencies = [
|
|
219
219
|
"crossbeam-deque",
|
|
220
220
|
"globset",
|
|
@@ -228,9 +228,9 @@ dependencies = [
|
|
|
228
228
|
|
|
229
229
|
[[package]]
|
|
230
230
|
name = "indexmap"
|
|
231
|
-
version = "2.14.
|
|
231
|
+
version = "2.14.2"
|
|
232
232
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
-
checksum = "
|
|
233
|
+
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
|
234
234
|
dependencies = [
|
|
235
235
|
"equivalent",
|
|
236
236
|
"hashbrown 0.17.1",
|
|
@@ -471,9 +471,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|
|
471
471
|
|
|
472
472
|
[[package]]
|
|
473
473
|
name = "syn"
|
|
474
|
-
version = "3.0.
|
|
474
|
+
version = "3.0.5"
|
|
475
475
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
476
|
-
checksum = "
|
|
476
|
+
checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9"
|
|
477
477
|
dependencies = [
|
|
478
478
|
"proc-macro2",
|
|
479
479
|
"quote",
|
|
@@ -515,9 +515,9 @@ dependencies = [
|
|
|
515
515
|
|
|
516
516
|
[[package]]
|
|
517
517
|
name = "toml"
|
|
518
|
-
version = "1.1.
|
|
518
|
+
version = "1.1.6+spec-1.1.0"
|
|
519
519
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
520
|
-
checksum = "
|
|
520
|
+
checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a"
|
|
521
521
|
dependencies = [
|
|
522
522
|
"indexmap",
|
|
523
523
|
"serde_core",
|
|
@@ -554,13 +554,12 @@ checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
|
|
|
554
554
|
|
|
555
555
|
[[package]]
|
|
556
556
|
name = "tree-sitter"
|
|
557
|
-
version = "0.
|
|
557
|
+
version = "0.27.0"
|
|
558
558
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
559
|
-
checksum = "
|
|
559
|
+
checksum = "2038684e0058edba0d17302619f62eabce4a8e11c6ac59506996a8d79848851d"
|
|
560
560
|
dependencies = [
|
|
561
561
|
"cc",
|
|
562
562
|
"regex",
|
|
563
|
-
"regex-syntax",
|
|
564
563
|
"serde_json",
|
|
565
564
|
"streaming-iterator",
|
|
566
565
|
"tree-sitter-language",
|
|
@@ -578,9 +577,9 @@ dependencies = [
|
|
|
578
577
|
|
|
579
578
|
[[package]]
|
|
580
579
|
name = "tree-sitter-language"
|
|
581
|
-
version = "0.1.
|
|
580
|
+
version = "0.1.8"
|
|
582
581
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
583
|
-
checksum = "
|
|
582
|
+
checksum = "ca0d1bf6fdd806e43ae5198f82f527056d359def39e54e67a0f478ac09dac081"
|
|
584
583
|
|
|
585
584
|
[[package]]
|
|
586
585
|
name = "unicode-ident"
|
package/Cargo.toml
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "dart-decimate"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.40"
|
|
4
4
|
edition = "2024"
|
|
5
|
-
rust-version = "1.
|
|
5
|
+
rust-version = "1.90"
|
|
6
6
|
description = "Rust-native codebase intelligence for Dart and Flutter module graphs."
|
|
7
7
|
license = "MIT"
|
|
8
8
|
repository = "https://github.com/sgaabdu4/dart-decimate"
|
|
@@ -25,7 +25,7 @@ serde_yaml_ng = "0.10"
|
|
|
25
25
|
tempfile = "3"
|
|
26
26
|
thiserror = "2"
|
|
27
27
|
toml = "1.1"
|
|
28
|
-
tree-sitter = "0.
|
|
28
|
+
tree-sitter = "0.27"
|
|
29
29
|
tree-sitter-dart = "0.2"
|
|
30
30
|
|
|
31
31
|
[lints.rust]
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Find dead Dart code, circular dependencies, duplicated code, complex functions,
|
|
6
6
|
dependency problems, risky Flutter wiring, and PR risk fast.
|
|
7
7
|
|
|
8
|
-

|
|
9
9
|

|
|
10
10
|

|
|
11
11
|
|
|
@@ -21,6 +21,10 @@ It is not a formatter. It is not a replacement for `dart analyze`. It is not a
|
|
|
21
21
|
Flutter style guide. It does not enforce opinions like "all providers must use
|
|
22
22
|
Riverpod code generation."
|
|
23
23
|
|
|
24
|
+
The parser accepts Dart 3.13 primary and concise constructors, dot shorthand,
|
|
25
|
+
and null-aware collection elements. Flutter UI detection includes the
|
|
26
|
+
standalone `material_ui` and `cupertino_ui` packages.
|
|
27
|
+
|
|
24
28
|
It answers practical questions:
|
|
25
29
|
|
|
26
30
|
- What code can probably be deleted?
|
|
@@ -667,7 +671,7 @@ This repository forbids `unsafe_code`.
|
|
|
667
671
|
|
|
668
672
|
## Release Flow
|
|
669
673
|
|
|
670
|
-
Current version: `0.0.
|
|
674
|
+
Current version: `0.0.40`.
|
|
671
675
|
|
|
672
676
|
After the first public release, changes should go through pull requests. Every
|
|
673
677
|
PR to `main` must bump both `Cargo.toml` and `package.json` above the base
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dart-decimate",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "Rust-native codebase intelligence for Dart and Flutter module graphs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -52,6 +52,6 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@biomejs/biome": "2.5.
|
|
55
|
+
"@biomejs/biome": "2.5.13"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/src/baseline.rs
CHANGED
|
@@ -269,13 +269,13 @@ pub fn save_regression_baseline(
|
|
|
269
269
|
|
|
270
270
|
fn save_json<T: Serialize>(path: impl AsRef<Path>, value: &T) -> Result<(), BaselineError> {
|
|
271
271
|
let path = path.as_ref();
|
|
272
|
-
if let Some(parent) = path.parent()
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
272
|
+
if let Some(parent) = path.parent()
|
|
273
|
+
&& !parent.as_os_str().is_empty()
|
|
274
|
+
{
|
|
275
|
+
fs::create_dir_all(parent).map_err(|source| BaselineError::CreateDir {
|
|
276
|
+
path: parent.to_path_buf(),
|
|
277
|
+
source,
|
|
278
|
+
})?;
|
|
279
279
|
}
|
|
280
280
|
let mut json = serde_json::to_string_pretty(value).map_err(|source| BaselineError::Json {
|
|
281
281
|
path: path.to_path_buf(),
|
package/src/ci_template.rs
CHANGED
|
@@ -348,8 +348,8 @@ jobs:
|
|
|
348
348
|
with:
|
|
349
349
|
fetch-depth: 0
|
|
350
350
|
- run: |
|
|
351
|
-
rustup toolchain install 1.
|
|
352
|
-
rustup default 1.
|
|
351
|
+
rustup toolchain install 1.90.0 --profile minimal
|
|
352
|
+
rustup default 1.90.0
|
|
353
353
|
- run: cargo install --git https://github.com/sgaabdu4/dart-decimate --locked dart-decimate
|
|
354
354
|
- run: dart-decimate audit --format json --base origin/${{ github.base_ref || 'main' }}
|
|
355
355
|
";
|
|
@@ -361,8 +361,8 @@ dart-decimate:
|
|
|
361
361
|
stage: quality
|
|
362
362
|
image: rust:latest
|
|
363
363
|
before_script:
|
|
364
|
-
- rustup toolchain install 1.
|
|
365
|
-
- rustup default 1.
|
|
364
|
+
- rustup toolchain install 1.90.0 --profile minimal
|
|
365
|
+
- rustup default 1.90.0
|
|
366
366
|
- cargo install --git https://github.com/sgaabdu4/dart-decimate --locked dart-decimate
|
|
367
367
|
script:
|
|
368
368
|
- dart-decimate audit --format json --base "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}"
|
|
@@ -375,8 +375,8 @@ const GITLAB_VENDORED_CI: &str = r".dart-decimate:
|
|
|
375
375
|
stage: quality
|
|
376
376
|
image: rust:latest
|
|
377
377
|
before_script:
|
|
378
|
-
- rustup toolchain install 1.
|
|
379
|
-
- rustup default 1.
|
|
378
|
+
- rustup toolchain install 1.90.0 --profile minimal
|
|
379
|
+
- rustup default 1.90.0
|
|
380
380
|
- cargo install --git https://github.com/sgaabdu4/dart-decimate --locked dart-decimate
|
|
381
381
|
script:
|
|
382
382
|
- ci/scripts/review.sh
|
package/src/cli/coverage_run.rs
CHANGED
|
@@ -314,20 +314,20 @@ fn coverage_health_options(subcommand: &ArgMatches, mut options: HealthOptions)
|
|
|
314
314
|
options.ownership = false.into();
|
|
315
315
|
|
|
316
316
|
options.runtime_coverage_path = subcommand.get_one::<PathBuf>("runtime-coverage").cloned();
|
|
317
|
-
if subcommand.value_source("min-invocations-hot") == Some(ValueSource::CommandLine)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
if subcommand.value_source("min-invocations-hot") == Some(ValueSource::CommandLine)
|
|
318
|
+
&& let Some(value) = subcommand.get_one::<usize>("min-invocations-hot")
|
|
319
|
+
{
|
|
320
|
+
options.min_invocations_hot = (*value).max(1);
|
|
321
321
|
}
|
|
322
|
-
if subcommand.value_source("min-observation-volume") == Some(ValueSource::CommandLine)
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
if subcommand.value_source("min-observation-volume") == Some(ValueSource::CommandLine)
|
|
323
|
+
&& let Some(value) = subcommand.get_one::<usize>("min-observation-volume")
|
|
324
|
+
{
|
|
325
|
+
options.min_observation_volume = (*value).max(1);
|
|
326
326
|
}
|
|
327
|
-
if subcommand.value_source("low-traffic-threshold") == Some(ValueSource::CommandLine)
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
if subcommand.value_source("low-traffic-threshold") == Some(ValueSource::CommandLine)
|
|
328
|
+
&& let Some(value) = subcommand.get_one::<f64>("low-traffic-threshold")
|
|
329
|
+
{
|
|
330
|
+
options.low_traffic_threshold = LowTrafficThreshold::from_ratio(*value);
|
|
331
331
|
}
|
|
332
332
|
if let Some(top) = subcommand.get_one::<usize>("top") {
|
|
333
333
|
options.top = Some(*top);
|
package/src/cli/dupes_args.rs
CHANGED
|
@@ -98,25 +98,25 @@ pub(super) fn duplicate_options_with_defaults(
|
|
|
98
98
|
if is_command_line(matches, "cross-language") && matches.get_flag("cross-language") {
|
|
99
99
|
return Err(CliError::UnsupportedCrossLanguageDupes);
|
|
100
100
|
}
|
|
101
|
-
if is_command_line(matches, "mode")
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
if is_command_line(matches, "mode")
|
|
102
|
+
&& let Some(mode) = matches.get_one::<String>("mode")
|
|
103
|
+
{
|
|
104
|
+
options.mode = DuplicateMode::parse(mode).unwrap_or(DuplicateMode::Mild);
|
|
105
105
|
}
|
|
106
|
-
if is_command_line(matches, "min-tokens")
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
if is_command_line(matches, "min-tokens")
|
|
107
|
+
&& let Some(min_tokens) = matches.get_one::<usize>("min-tokens")
|
|
108
|
+
{
|
|
109
|
+
options.min_tokens = *min_tokens;
|
|
110
110
|
}
|
|
111
|
-
if is_command_line(matches, "min-lines")
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
if is_command_line(matches, "min-lines")
|
|
112
|
+
&& let Some(min_lines) = matches.get_one::<usize>("min-lines")
|
|
113
|
+
{
|
|
114
|
+
options.min_lines = *min_lines;
|
|
115
115
|
}
|
|
116
|
-
if is_command_line(matches, "min-occurrences")
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
if is_command_line(matches, "min-occurrences")
|
|
117
|
+
&& let Some(min_occurrences) = matches.get_one::<usize>("min-occurrences")
|
|
118
|
+
{
|
|
119
|
+
options.min_occurrences = (*min_occurrences).max(2);
|
|
120
120
|
}
|
|
121
121
|
if is_command_line(matches, "top") {
|
|
122
122
|
options.top = matches.get_one::<usize>("top").copied();
|
package/src/cli/health_args.rs
CHANGED
|
@@ -147,20 +147,20 @@ pub(super) fn health_options_with_defaults(
|
|
|
147
147
|
matches: &ArgMatches,
|
|
148
148
|
mut options: HealthOptions,
|
|
149
149
|
) -> HealthOptions {
|
|
150
|
-
if is_command_line(matches, "max-cyclomatic")
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
if is_command_line(matches, "max-cyclomatic")
|
|
151
|
+
&& let Some(max_cyclomatic) = matches.get_one::<usize>("max-cyclomatic")
|
|
152
|
+
{
|
|
153
|
+
options.max_cyclomatic = *max_cyclomatic;
|
|
154
154
|
}
|
|
155
|
-
if is_command_line(matches, "max-cognitive")
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
if is_command_line(matches, "max-cognitive")
|
|
156
|
+
&& let Some(max_cognitive) = matches.get_one::<usize>("max-cognitive")
|
|
157
|
+
{
|
|
158
|
+
options.max_cognitive = *max_cognitive;
|
|
159
159
|
}
|
|
160
|
-
if is_command_line(matches, "max-unit-size")
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
if is_command_line(matches, "max-unit-size")
|
|
161
|
+
&& let Some(max_unit_size) = matches.get_one::<usize>("max-unit-size")
|
|
162
|
+
{
|
|
163
|
+
options.max_unit_size = *max_unit_size;
|
|
164
164
|
}
|
|
165
165
|
if is_command_line(matches, "top") {
|
|
166
166
|
options.top = matches.get_one::<usize>("top").copied();
|
|
@@ -180,20 +180,20 @@ pub(super) fn health_options_with_defaults(
|
|
|
180
180
|
if is_command_line(matches, "runtime-coverage") {
|
|
181
181
|
options.runtime_coverage_path = matches.get_one::<PathBuf>("runtime-coverage").cloned();
|
|
182
182
|
}
|
|
183
|
-
if is_command_line(matches, "min-invocations-hot")
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
if is_command_line(matches, "min-invocations-hot")
|
|
184
|
+
&& let Some(min_invocations_hot) = matches.get_one::<usize>("min-invocations-hot")
|
|
185
|
+
{
|
|
186
|
+
options.min_invocations_hot = (*min_invocations_hot).max(1);
|
|
187
187
|
}
|
|
188
|
-
if is_command_line(matches, "min-observation-volume")
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
if is_command_line(matches, "min-observation-volume")
|
|
189
|
+
&& let Some(min_observation_volume) = matches.get_one::<usize>("min-observation-volume")
|
|
190
|
+
{
|
|
191
|
+
options.min_observation_volume = (*min_observation_volume).max(1);
|
|
192
192
|
}
|
|
193
|
-
if is_command_line(matches, "low-traffic-threshold")
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
if is_command_line(matches, "low-traffic-threshold")
|
|
194
|
+
&& let Some(low_traffic_threshold) = matches.get_one::<f64>("low-traffic-threshold")
|
|
195
|
+
{
|
|
196
|
+
options.low_traffic_threshold = LowTrafficThreshold::from_ratio(*low_traffic_threshold);
|
|
197
197
|
}
|
|
198
198
|
if is_command_line(matches, "file-scores") {
|
|
199
199
|
options.file_scores = matches.get_flag("file-scores").into();
|
|
@@ -216,10 +216,10 @@ pub(super) fn health_options_with_defaults(
|
|
|
216
216
|
{
|
|
217
217
|
options.flutter_style = true.into();
|
|
218
218
|
}
|
|
219
|
-
if is_command_line(matches, "min-score")
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
if is_command_line(matches, "min-score")
|
|
220
|
+
&& let Some(min_score) = matches.get_one::<usize>("min-score")
|
|
221
|
+
{
|
|
222
|
+
options.min_score = (*min_score).min(100);
|
|
223
223
|
}
|
|
224
224
|
options
|
|
225
225
|
}
|
package/src/cli/request_args.rs
CHANGED
|
@@ -50,10 +50,10 @@ pub(super) fn policy_pack_paths(
|
|
|
50
50
|
config: &DartDecimateConfig,
|
|
51
51
|
) -> Vec<PathBuf> {
|
|
52
52
|
let mut paths = config.policy_packs.clone();
|
|
53
|
-
if matches!(command, ReportCommand::Check | ReportCommand::Audit)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if matches!(command, ReportCommand::Check | ReportCommand::Audit)
|
|
54
|
+
&& let Some(values) = subcommand.get_many::<PathBuf>("policy-pack")
|
|
55
|
+
{
|
|
56
|
+
paths.extend(values.cloned());
|
|
57
57
|
}
|
|
58
58
|
paths
|
|
59
59
|
}
|
package/src/cli.rs
CHANGED
|
@@ -621,10 +621,10 @@ fn report_changed_since(
|
|
|
621
621
|
|
|
622
622
|
fn baseline_paths(command: ReportCommand, subcommand: &ArgMatches) -> Vec<PathBuf> {
|
|
623
623
|
let mut paths = Vec::new();
|
|
624
|
-
if supports_global_baseline(command)
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
624
|
+
if supports_global_baseline(command)
|
|
625
|
+
&& let Some(path) = subcommand.get_one::<PathBuf>("baseline")
|
|
626
|
+
{
|
|
627
|
+
paths.push(path.clone());
|
|
628
628
|
}
|
|
629
629
|
if command == ReportCommand::Audit {
|
|
630
630
|
for id in ["dead-code-baseline", "health-baseline", "dupes-baseline"] {
|