Scan Azure Resource Manager (ARM) JSON templates for repeated identical string literals above a configurable minimum length and threshold, then report maintainability hotspots where values should be centralized into parameters, variables, or reusable modules instead of being duplicated inline.
Scan Azure Resource Manager (ARM) JSON templates for repeated identical string literals above a configurable minimum length and threshold, then report maintainability hotspots where values should be centralized into parameters, variables, or reusable modules instead of being duplicated inline.
What It Does
Parses ARM JSON templates and Bicep-generated ARM JSON artifacts as JSON.
Detects duplicated decoded string literal values across the whole file, including nested Microsoft.Resources/deployments inline properties.template fragments.
Excludes top-level $schema and common ARM schema/documentation URLs by default.
Emits structured per-file findings and codemod:metrics counters.
Never edits source files. This is a read-only mining codemod.
Usage
Run the local package against a target repository:
bash
pnpm dlx codemod@latest workflow run -w . -t /path/to/repository
If require_arm_shape=true, non-ARM JSON files are skipped without findings.
Development
bash
# Run the read-only fixture suite
pnpm test
# Validate the workflow
pnpm dlx codemod@latest workflow validate -w .
# Type-check the codemod
pnpm run check-types
# Publish to registry
pnpm dlx codemod@latest login
pnpm dlx codemod@latest publish
The fixture suite keeps input.json and expected.json identical because the codemod is analysis-only; verification focuses on successful parsing, read-only behavior, and spec-specific scenario coverage.
License
MIT
Ready to evolve your codebase?
Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.