ENT-13833: Added checks for correct number of args for bundle-/body-calls#72
Open
SimonThalvorsen wants to merge 3 commits intocfengine:mainfrom
Open
ENT-13833: Added checks for correct number of args for bundle-/body-calls#72SimonThalvorsen wants to merge 3 commits intocfengine:mainfrom
SimonThalvorsen wants to merge 3 commits intocfengine:mainfrom
Conversation
Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
f4290f6 to
0efdede
Compare
olehermanse
reviewed
Apr 17, 2026
| string => canonify(); | ||
| ^--------^ | ||
| Error: Expected 1 arguments, received 0 at tests/lint/013_function_call_arg_count.x.cf:5:15 | ||
| Error: Expected 1 arguments, received 0 for function 'canonify'at tests/lint/013_function_call_arg_count.x.cf:5:15 |
Member
There was a problem hiding this comment.
Suggested change
| Error: Expected 1 arguments, received 0 for function 'canonify'at tests/lint/013_function_call_arg_count.x.cf:5:15 | |
| Error: Expected 1 arguments, received 0 for function 'canonify' at tests/lint/013_function_call_arg_count.x.cf:5:15 |
olehermanse
reviewed
Apr 17, 2026
| string => canonify("test", "test"); | ||
| ^----------------------^ | ||
| Error: Expected 1 arguments, received 2 at tests/lint/013_function_call_arg_count.x.cf:9:15 | ||
| Error: Expected 1 arguments, received 2 for function 'canonify'at tests/lint/013_function_call_arg_count.x.cf:9:15 |
Member
There was a problem hiding this comment.
Suggested change
| Error: Expected 1 arguments, received 2 for function 'canonify'at tests/lint/013_function_call_arg_count.x.cf:9:15 | |
| Error: Expected 1 arguments, received 2 for function 'canonify' at tests/lint/013_function_call_arg_count.x.cf:9:15 |
olehermanse
reviewed
Apr 17, 2026
| if len(params) != len(args): | ||
| _highlight_range(node, lines) | ||
| print( | ||
| f"Error: Expected {len(params)} arguments, received {len(args)} for body '{call}'{location}" |
Member
There was a problem hiding this comment.
Suggested change
| f"Error: Expected {len(params)} arguments, received {len(args)} for body '{call}'{location}" | |
| f"Error: Expected {len(params)} arguments, received {len(args)} for body '{call}' {location}" |
olehermanse
reviewed
Apr 17, 2026
Comment on lines
+5
to
+15
| Error: Expected 2 arguments, received 0 for bundle 'test' at tests/lint/014_num_args_bundle_body.x.cf:5:20 | ||
|
|
||
| "test2" | ||
| usebundle => test("a"); | ||
| ^-------^ | ||
| Error: Expected 2 arguments, received 1 for bundle 'test' at tests/lint/014_num_args_bundle_body.x.cf:7:20 | ||
|
|
||
| "test4" | ||
| usebundle => test("a", "b", "c"); | ||
| ^-----------------^ | ||
| Error: Expected 2 arguments, received 3 for bundle 'test' at tests/lint/014_num_args_bundle_body.x.cf:11:20 |
Member
There was a problem hiding this comment.
All 3 cases are for bundle, maybe make one for body as well :)
nickanderson
approved these changes
Apr 17, 2026
Member
nickanderson
left a comment
There was a problem hiding this comment.
That looks nicer than cf-promises today:
bundle agent main
{
methods:
"t" usebundle => t();
}
bundle agent t( param )
{
defaults:
"param" string => "DEFAULT VALUE", if_match_regex => "";
reports: "$(param)";
}
cf-promises -cf ./test.cf
./test.cf:5:0: error: Conflicting arity in calling bundle t, expected 1 arguments, 0 given
error: There are syntax errors in policy files
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.
No description provided.