Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Performance penalty with just 1 rule? #1971

Unanswered
S-dn-Y asked this question in Q&A
Discussion options

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:

  1. 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?
  2. 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.
Performance

Thanks in advance!
Best regards,
Sidney

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /