Usage.java

1
package org.egothor.methodatlas;
2
3
import java.io.PrintWriter;
4
5
/**
6
 * Renders the {@code -help} usage screen.
7
 *
8
 * <p>
9
 * The screen is a deliberately terse signpost, not an exhaustive manual: it
10
 * lists the synopsis and a one-line summary per option group, then points at
11
 * the canonical, always-current CLI reference on the documentation site. Keeping
12
 * it terse avoids a third full copy of the flag list (alongside the
13
 * {@link MethodAtlasApp} class Javadoc and {@code docs/cli-reference.md}) drifting
14
 * out of sync.
15
 * </p>
16
 *
17
 * <p>
18
 * This class is a non-instantiable utility holder.
19
 * </p>
20
 *
21
 * @see MethodAtlasApp
22
 * @since 4.0.0
23
 */
24
final class Usage {
25
26
    /** Canonical, always-current CLI reference. */
27
    /* default */ static final String CLI_REFERENCE_URL =
28
            "https://accenture.github.io/MethodAtlas/cli-reference/";
29
30
    private static final String TEXT = """
31
            MethodAtlas — scan test source trees and classify test methods.
32
33
            Usage:
34
              methodatlas [options] [path ...]
35
36
            If no path is given, the current directory is scanned. Multiple roots are allowed.
37
38
            Output modes (default: CSV to stdout):
39
              -plain                 Plain text instead of CSV
40
              -sarif                 SARIF 2.1.0 JSON (security-only by default)
41
              -json                  Flat JSON array
42
              -github-annotations    GitHub Actions ::notice/::warning commands
43
44
            Discovery:
45
              -file-suffix <suffix>  File-name suffix to scan; repeatable (default: java:Test.java)
46
              -test-marker <name>    Annotation/attribute marking a test method; repeatable
47
              -property <key>=<val>  Plugin-specific property; repeatable
48
              -config <file>         Load defaults from a YAML config file (CLI flags override)
49
50
            AI enrichment:
51
              -ai                    Enable AI classification
52
              -ai-provider <name>    auto | ollama | openai | anthropic | azure_openai | ...
53
              -ai-model <model>      Provider-specific model name
54
              -ai-api-key-env <env>  Resolve the API key from an environment variable
55
              (see the reference for the full -ai-* and manual-workflow options)
56
57
            Custom prompt templates (advanced; recorded in the reproducibility receipt):
58
              -classification-prompt <file>     Override the method-classification prompt
59
              -triage-prompt <file>             Override the folded credential-triage appendix
60
              -dedicated-triage-prompt <file>   Override the standalone credential-triage prompt
61
              -check-prompts                    Validate the templates, print their SHA-256, and exit
62
63
            Source write-back:
64
              -apply-tags            Write AI @Tag/@DisplayName back to source (requires -ai)
65
              -apply-tags-from-csv <file>
66
                                     Apply a reviewed CSV as the desired state (Java and C#)
67
              -mismatch-limit <n>    Abort apply-from-csv if mismatches reach n (default: -1 = warn)
68
              -promote-ai            RISKY, NOT RECOMMENDED. With -apply-tags-from-csv, fills blank
69
                                     tags/display_name from ai_tags/ai_display_name — i.e. writes
70
                                     UNVALIDATED AI output into source, bypassing human review. Off
71
                                     by default; do not enable unless reviewed and approved.
72
73
            Credential detection:
74
              -detect-secrets            Enable credential/secret detection alongside the test scan
75
              -secrets-include <glob>    Scan files matching <glob> INSTEAD of the discovered test
76
                                         classes (replaces the set, does not extend it)
77
              -secrets-rules <file>      Custom rule catalog YAML (default: built-in catalog)
78
              -secrets-out <file>        Output path for the secrets CSV (default: methodatlas-credentials.csv)
79
              -secrets-separate-llm      Force a standalone triage LLM call instead of prompt appendix
80
              -secrets-show-values       Print unmasked secret values (default: values are redacted)
81
              -secrets-error-threshold <score>    SARIF error floor (default: 0.8)
82
              -secrets-warning-threshold <score>  SARIF warning floor (default: 0.4)
83
              -secrets-min-score <score>          Suppress findings below this score (default: 0.0)
84
85
            Diagnostics:
86
              -verbose               Detailed diagnostics (notably for -apply-tags-from-csv)
87
              -help, --help, -h      Show this help and exit
88
89
            This is a summary. The complete, authoritative option reference is at:
90
              """ + CLI_REFERENCE_URL;
91
92
    private Usage() {
93
    }
94
95
    /**
96
     * Prints the usage screen.
97
     *
98
     * @param out writer that receives the usage text; never {@code null}
99
     */
100
    /* default */ static void print(PrintWriter out) {
101 1 1. print : removed call to java/io/PrintWriter::println → KILLED
        out.println(TEXT);
102
    }
103
}

Mutations

101

1.1
Location : print
Killed by : org.egothor.methodatlas.MethodAtlasAppTest.[engine:junit-jupiter]/[class:org.egothor.methodatlas.MethodAtlasAppTest]/[method:help_printsUsageAndReferenceUrl(java.nio.file.Path)]
removed call to java/io/PrintWriter::println → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1