AG014: Inherited Field Missing Default Pattern
| Property | Value |
|---|---|
| Code | AG014 |
| Severity | Warning |
| Since | v0.8.0 |
Description
A field with the :^ (inherited) modifier does not use the
${var:-...} default pattern in its local declaration. Without this
pattern, the parent's value is shadowed by the child's empty default instead
of being inherited.
The bare ${var} form is not accepted because it fails under set -u when
the variable is unset.
Example
This triggers AG014:
How to Fix
Use the ${var:-...} pattern to inherit the parent's value:
You can also chain environment variable fallbacks:
How to Suppress
Or file-wide:
Was this section helpful?