Use it when gating automation around Syntax Validation. Keep authoritative criteria, immutable source/input, exact target identity, validator version, observed/effective state and workload acceptance as separate proof boundaries.
Syntax Validation
Syntax Validation proves that an automation artifact conforms to the grammar and parser rules expected by the exact interpreter, tool or format version.
1. Syntax validation catches errors early.
2. Lint all code types.
3. Run in pre-commit and CI.
4. Fail builds on errors.
5. Consistent formatting.
code → linters/syntax checks → pass/fail
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
bash -n <script.sh>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
artifact revision/hash → parser/version → lexical/grammar parse → diagnostics → syntax verdict → semantic/schema validation → execution eligibility
Healthy evidence: the exact artifact parses cleanly with the intended runtime/parser version and diagnostics are preserved.
Step 2 Command read-back and what it shows Verify boundary
bash -n <script.sh> is the bounded verification surface selected for Validation → Syntax Validation. A known-good result is the exact script revision parses successfully with the interpreter that will execute it and additional bounded tests exercise critical paths before production mutation. Treat parse errors, validation with the wrong interpreter, missing sourced/runtime prerequisites or a syntactically valid script whose critical behavior still fails tests as broken/suspicious. bash -n <script> shows Bash can parse the script without executing normal commands, but it does not show runtime command availability, permissions, data correctness or side-effect safety.
Step 3 Common mistakes Verify boundary
- Syntax checks skipped in CI.
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: validation uses a different toolchain version, ignores warnings that alter meaning or treats a formatter as the authoritative parser.
Step 5 Observation-driven branch and next-check logic Narrow the fault
For a failing Validation → Syntax Validation case, freeze scope first: target/object, desired revision or request, and failure time. Inspect bash -n <script.sh>. Branch on evidence rather than labels: if parser error points to line/token, correct grammar/quoting first; if parser passes but sourced files/variables are missing, validate runtime context; if context is present but behavior fails, move to traced bounded execution or unit/integration tests.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Parseable ≠ deployable or semantically correct.
- Syntax accepted by one version ≠ accepted by another version.
- Formatter success ≠ parser success.
- No syntax error ≠ referenced names, resources or values exist.
yamllint . && ansible-playbook site.yml --syntax-check— YAML/Ansibleterraform validate— HCLshellcheck *.sh— shell
ReferenceWhat it is1 section · depth on demand
Core model
Identify the consuming parser and version, parse the immutable artifact, preserve diagnostics and source location, reject ambiguous or deprecated constructs where policy requires it, and keep syntax success separate from semantic and runtime validity.
ReferenceHow it works1 section · depth on demand
How it works
In Validation → Syntax Validation, effective state is split across the exact script/artifact revision, interpreter grammar and parse-time constructs that can be checked before execution without running the script body. Syntax validation asks the intended interpreter to parse the artifact so quoting, control structures and grammar errors are found before runtime; it deliberately stops short of proving external commands or data paths. Shell version/options, sourced files, environment variables, command availability and runtime permissions remain separate dependencies. This matters because a script can be syntactically valid yet fail immediately at runtime, while using the wrong shell for validation can produce misleading pass/fail results.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
Syntax Validation shows grammar acceptance by a named parser version, but it does not show schema conformity, semantic correctness, dependency resolution or successful execution.
In depth
Syntax validation checks that files parse correctly in their language — YAML, JSON, HCL, Jinja2, shell, device configuration — before they are used. It is fast, cheap and catches many mistakes in CI.
yamllint .
ansible-playbook site.yml --syntax-check
terraform fmt -check && terraform validate
shellcheck scripts/*.sh
python -m json.tool data.json > /dev/null
Syntax validity says nothing about correctness; combine it with schema and behaviour checks.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Validation > Syntax Validation. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://json-schema.org/learn/getting-started-step-by-step · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Syntax Validation validation proof-boundary map
Fast criteria/scope, execution and effective-outcome proof boundaries for Syntax Validation.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Criteria / input | Criteria, source revision, validator and exact target identity are explicit | A generic pass exists without versioned criteria or target correlation |
| Preconditions / operation | Current authoritative facts are bound to the exact operation | Stale preflight or requested state substitutes for execution-time facts |
| Effective outcome | Authoritative state/read-back and service-relevant evidence match the expected result | Tool/test/validator success substitutes for effective target or workload proof |
| Limits / next action | Coverage limits, unknowns and failures drive the next narrower check | Unknown evidence becomes pass, retries hide failures or broad success is inferred from one check |