-
-
Notifications
You must be signed in to change notification settings - Fork 5
3. CI Usage Guide
This page describes a conservative, CI-friendly workflow for using GDShrapt in automated pipelines.
GDShrapt’s default behavior is safe-by-default: rename --apply applies only Strict edits, and string-based contracts require explicit opt-in.
- Fail fast on analysis regressions
- Never apply unproven edits automatically
- Make rename operations auditable via diffs
- Keep CI output stable and machine-readable when needed
Run full diagnostics on the project:
gdshrapt analyze .If you want CI to fail on warnings too:
gdshrapt analyze . --fail-on warningIf you need a fast, CI-oriented gate:
gdshrapt check .Use --fail-on warning when you want warnings to fail the build.
gdshrapt validate .
gdshrapt lint .In CI, you usually want to detect what would change, not apply it automatically.
gdshrapt rename <old> <new> --diffIf the command finds candidates, you can:
- post the diff as an artifact
- require a maintainer to run
--applylocally
If you have a dedicated refactor job (not every PR), you can allow Strict-only application:
gdshrapt rename <old> <new> --applyRecommended additions:
- keep a clean working tree check before/after
- commit changes automatically in a bot branch, not on PR branches directly
Contract strings are preview-only unless you opt in:
gdshrapt rename <old> <new> --apply --include-contract-stringsOnly enable this in CI if you have a clear policy that string-based contracts are safe to change for your project.
To reduce noisy diffs in CI:
- run with stable log level (avoid
--verboseunless debugging) - set
--color neverfor clean logs - constrain concurrency if your environment needs reproducibility
Examples:
gdshrapt analyze . --color never --log-level info
gdshrapt rename <old> <new> --diff --color never --log-level infoIf necessary:
gdshrapt analyze . --max-parallelism 0When you want to parse results:
gdshrapt analyze . --format json
gdshrapt rename <old> <new> --diff --format json
gdshrapt find-refs <symbol> -p . --format jsonUse this for:
- PR annotations
- dashboards
- regressions/baselines
-
gdshrapt check .(fast gate) -
gdshrapt analyze . --fail-on warning(stricter gate if desired) - No automatic rename application
-
gdshrapt analyze . --format json(trend analysis) - optional:
gdshrapt type-coverage . - optional:
gdshrapt metrics .
gdshrapt rename ... --diff --explain- human review
-
gdshrapt rename ... --apply(Strict only) - optional:
--include-contract-stringsonly when approved
Before applying in automation, ensure no uncommitted changes exist. GDShrapt will modify files when --apply is used, so you should treat it like a codegen step.
During early adoption, prefer scoping:
gdshrapt rename <old> <new> --file path/to/file.gd --diff --explainThen scale up.
- scope by file
- rename incrementally
- avoid contract strings unless necessary
Increase per-file timeout:
gdshrapt analyze . --timeout-seconds 60Or reduce parallelism if your CI runners are constrained.
-
--applyapplies Strict edits only. - Contract strings are preview-only unless
--include-contract-stringsis set. - Potential/NameMatch are intended for manual review, not automation.