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
I'm trying to use the script analyzer to check for parse errors in a lot of scripts
I could just use the AST directly and parse the errors, but what I like about the scriptanalyzer is that it also catches invalid syntax around the process block with ParseError: InvalidSyntaxAroundProcessBlock.
The way it is implemented means I cannot just do -Severity ParseError as one has to either include the rule "PSAvoidUsingCmdletAliases" or the severity Warning (which parses the rule) to even discover the error. This could be a bugreport I guess but not looking for that.
I basically have two questions:
I want to speed up the process because I don't have to parse everything, I'm only interested in parse errors. But since the "PSAvoidUsingCmdletAliases" rule with severity warning has this nice hidden gem included, are there more?
There seems to be a very big peformance penalty just parsing the file. I mean with Verbose I can see that the rule isn't even processed but analyzing the file of 5100 rules takes nearly a minute. While running all rules only takes about 10 seconds longer. I would have expected a bigger performance gain in analyzing just one rule. Anyone has an idea why this is, parsing a scriptfile with the AST usually goes very fast. Wasn't able to find it in the source code.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey Guys,
I'm trying to use the script analyzer to check for parse errors in a lot of scripts
I could just use the AST directly and parse the errors, but what I like about the scriptanalyzer is that it also catches invalid syntax around the process block with ParseError: InvalidSyntaxAroundProcessBlock.
The way it is implemented means I cannot just do -Severity ParseError as one has to either include the rule "PSAvoidUsingCmdletAliases" or the severity Warning (which parses the rule) to even discover the error. This could be a bugreport I guess but not looking for that.
I basically have two questions:
Thanks in advance!
Best regards,
Sidney
Beta Was this translation helpful? Give feedback.
All reactions