mirror of https://github.com/databricks/cli.git
3c1e69a064
## Changes Modified interpolation logic to use: `\$\{([a-zA-Z]+([-_]*[a-zA-Z0-9]+)*(\.[a-zA-Z]+([-_]*[a-zA-Z0-9]+)*)*)\}` **Edit**: Suggested by @pietern `\$\{([a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*)*)\}` to be more selective and not allow consequent hyphens or underscores to make the keys more readable. Explanation: 1. All interpolation starts with `${` and ends with `}` 2. All interpolated locations are split by by `.` 3. All sections are expected to start with a alphabet `[a-zA-Z]`; no numbers, hyphens or underscores. 4. All sections are expected to end with an alphanumeric `[a-zA-Z0-9]` no hyphens or underscores This change allows the current interpolation to be more permissive. **Note** it does break backwards compatibility because `[a-zA-Z] != [\w]`. `\w` includes alphanumeric and underscores. `\w = [a-zA-Z0-9_]` ## Tests There are two tests with examples of valid and invalid interpolation and a test to validate expansion. |
||
---|---|---|
.. | ||
interpolation.go | ||
interpolation_test.go | ||
lookup.go | ||
lookup_test.go | ||
setter.go |