No need to call substituteVariables when no variables
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 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.substituteVariableseven when both config vars and command line vars are missing, to ensure that theValidatorErrorevent for missing value gets added. -
Do a check on
config.failedhere (to ensure the variable substitution did not fail) before callingcheckConfig.
Let me know if I am missing something.
I've merged the recent master changes into this to run the tests on the new CI.
@samratmitra-0812 Check out the PR now, specifically what I added in e555ba2. Does it match what you recommended?