(#17260) Issue warning for hypens in variables#1243
Merged
zaphod42 merged 3 commits intopuppetlabs:2.7.xfrom Oct 30, 2012
Merged
Conversation
In commit b26699a I fixed an accidentally introduced change to the lexer, allowing `-` to be part of a variable name. That had lasted for a while and was surprisingly popular. It was also hugely ambiguous around `-` as minus, and led to all sorts of failures - unexpected interpolations to nothing - because of that. A much better strategy would have been to deprecate the feature, issue proper warnings, and include an option to allow users to toggle the behaviour. Initially defaulting that to "permit", and eventually toggling over to "deny", would have made the whole experience much smoother - even if this was totally documented as not working, and was a clear bug that it changed. So, thanks to prompting from Benjamin Irizarry, we do just that: introduce the configuration option, default it to "deny" to match current behaviour, but allow users the choice to change this back. Please be aware that allowing variables with `-` might break all sorts of things around, for example, Forge modules though. Most people write code to the documented standard, and their code might well totally fail to work with this changed away from the default! Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
This commit shortens and tightens the description of this setting.
Previously the deprecation warnings for hyphens in variables
incorrectly warned even when there were no hyphens in the variable.
There was also no warning about hypens in variable interpolations when
the bare-word form of interpolation was used, e.g. "${foo-bar}".
This commit causes those two cases to warn correctly and also cleans up
the tests to be more directed to just the lexing of specific tokens.
This also removes some duplication that crept in around checking and
issuing the warning.
Paired-with: henrik.lindberg@cloudsmith.com
Contributor
Author
|
I'm going to merge this now, as @haus informed me, rightly, that if I don't do it now we won't get our acceptance tests run against this by the time we want it to go out later tomorrow. |
zaphod42
added a commit
that referenced
this pull request
Oct 30, 2012
…n-warning-for-hyphens-in-variables (#17260) Issue warning for hypens in variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In commit b26699a, daniel-pittman fixed an accidentally introduced change to
the lexer, allowing
-to be part of a variable name. That had lasted for awhile and was surprisingly popular. It was also hugely ambiguous around
-asminus, and led to all sorts of failures - unexpected interpolations to nothing
This adds the ability to turn hypens back on in the lexer, but issues a
deprecation warning when they are used. By default hyphens are still turned
off.
Puppet 3 should not have this feature and so this change must not be merged
into the 3.0.x or master branches.