Description
When you use the Profile parameter, but the value is invalid (hash table, variable containing a hash table, incorrect key name), PSScriptAnalyzer generates a warning, but continues to run the test.
Because the profile is the user's instruction for running the test, when Invoke-ScriptAnalyzer cannot follow that instruction for any reason, the test should immediately fail with a terminating error.
Otherwise, you waste the user's time running the wrong test and, more importantly, if the user has logged output and not examined the warning/error stream, the user might not know that the test they ran was not the test they designed.
Be sure that the error message helps the user to solve the problem. For example, list the valid keys in a profile hash table, rather than just telling the user that the key is invalid.