data-validator icon indicating copy to clipboard operation
data-validator copied to clipboard

No need to call substituteVariables when no variables

Open phpisciuneri opened this issue 5 years ago • 3 comments

Removes a small inefficiency. When there are no vars in the config file or passed at the command line there is no need to call variableSubstitution.

phpisciuneri avatar Jan 15 '21 19:01 phpisciuneri

@phpisciuneri Since you are skipping the call to config.substituteVariables when both config vars and command line vars are missing, the ValidatorError event for missing value will not be added in case user has specified a variable somewhere in the Tables/Checks by mistake. This means that the value of the failed flag will be false for the Tables/Checks, when in fact it should be true because of the missing value for the variable.

IMO, the flow should be somewhat like this:

  • Call config.substituteVariables even when both config vars and command line vars are missing, to ensure that the ValidatorError event for missing value gets added.

  • Do a check on config.failed here (to ensure the variable substitution did not fail) before calling checkConfig.

Let me know if I am missing something.

samratmitra-0812 avatar Jan 18 '21 10:01 samratmitra-0812

I've merged the recent master changes into this to run the tests on the new CI.

colindean avatar Jan 12 '22 23:01 colindean

@samratmitra-0812 Check out the PR now, specifically what I added in e555ba2. Does it match what you recommended?

colindean avatar Jun 07 '22 21:06 colindean