You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How and why it is working currently:
'check_cnf_installed=false'
is evaluated as an assignent of new variable named "check_cnf_installed" to "false". Then the whole assignment returns "false" and passes it as a positional argument.
Most such cases work just accidentally, also due to crystal's loose assignement of positional and named arguments. However when some changes further changes are done, it can stop working.
To Reproduce
Look across the code
Shake your head
Expected behavior
Always use the right way how to pass positional arguments.
Screenshots
Device (please complete the following information):
How will this be tested? aka Acceptance Criteria (optional)
Best if an intelligent grep command is developed to identify all such wrong assignments. Fix it, re-run the grep, it should return no occurrences after fixing.
The text was updated successfully, but these errors were encountered:
Describe the bug
On many occurrence across the cnf-testsuite code, passing of named arguments are done in a wrong way.
Example1:
https://github.com/cncf/cnf-testsuite/blob/main/src/tasks/platform/observability.cr#L112
task_response = CNFManager::Task.task_runner(args, check_cnf_installed=false) do |args|
Example2:
https://github.com/cncf/cnf-testsuite/blob/main/src/tasks/utils/cnf_manager.cr#L269
cnf_configs = self.cnf_config_list(silent=true)
The right way how to pass named arguments in crystal is using ':'
https://crystal-lang.org/reference/1.11/syntax_and_semantics/default_and_named_arguments.html
like this:
task_response = CNFManager::Task.task_runner(args, check_cnf_installed: false) do |args|
cnf_configs = self.cnf_config_list(silent: true)
How and why it is working currently:
'check_cnf_installed=false'
is evaluated as an assignent of new variable named "check_cnf_installed" to "false". Then the whole assignment returns "false" and passes it as a positional argument.
Most such cases work just accidentally, also due to crystal's loose assignement of positional and named arguments. However when some changes further changes are done, it can stop working.
To Reproduce
Expected behavior
Always use the right way how to pass positional arguments.
Screenshots
Device (please complete the following information):
How will this be tested? aka Acceptance Criteria (optional)
Best if an intelligent grep command is developed to identify all such wrong assignments. Fix it, re-run the grep, it should return no occurrences after fixing.
The text was updated successfully, but these errors were encountered: