Fix the yaql/jinja vars extraction to ignore methods of base ctx() dict#196
Merged
Fix the yaql/jinja vars extraction to ignore methods of base ctx() dict#196
Conversation
The ctx() method returns a dict and there are use cases where users call supported methods on the dict such as keys(), values(), and get(). The vars extraction would return false positives on these function calls. The regular expressions to extract variables from expressions is refactored to ignore these dict related function calls directly on ctx().
Codecov Report
@@ Coverage Diff @@
## master #196 +/- ##
==========================================
- Coverage 94.04% 94.03% -0.02%
==========================================
Files 41 41
Lines 2739 2733 -6
Branches 542 544 +2
==========================================
- Hits 2576 2570 -6
Misses 100 100
Partials 63 63
Continue to review full report at Codecov.
|
9f5c094 to
c5ef955
Compare
…lify-regexes Simplify Jinja expression context regexes
Copy the simpliciation for Jinja evaluator to the YAQL evaluator. Add more test cases to ensure correctness.
blag
approved these changes
Apr 10, 2020
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.
The ctx() method returns a dict and there are use cases where users call supported methods on the dict such as keys(), values(), and get(). The vars extraction would return false positives on these function calls. The regular expressions to extract variables from expressions is refactored to ignore these dict related function calls directly on ctx(). Fixes StackStorm/st2#4866.