-
Notifications
You must be signed in to change notification settings - Fork 395
ScriptAnalyzer needs to emit Diagnostic records for AST parsing errors #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think we should be careful not to call catching parsing errors a "rule." Calling it a rule comes with some implications that don't fit what this does. To give a couple examples:
I think we should be explicit in calling these parsing errors, and not ScriptAnalyzer Rules. |
Just want to add that the I feel like an analyzer/linter should emit parse errors to stdout (i.e. not to an error stream), as diagnostic records like all the others, with an extent, so that automated tooling can indicate where the error occurs. Currently PSScriptAnalyzer seems to roll its own PSScriptAnalyzer/Engine/ScriptAnalyzer.cs Lines 1531 to 1535 in db2aabf
This basically means applications embedding PSScriptAnalyzer have to call the parser twice on the same script in order to get the actual This is sort of related to #1056, insofar as being able to pass in a pre-parsed AST would mitigate the cost of parsing the script twice (the operation itself is less expensive, but it does have to allocate quite a few objects). |
This has been implemented by PR #1130 |
In current implementation, parsing errors in a given script are treated as non-terminating PowerShell ErrorRecords.
Proposal is to convert these to diagnostic records and create a new rule for parsing issues.
Helps to solve following:
Let us know if the community has any opinions about this proposal
Thanks.
Raghu
The text was updated successfully, but these errors were encountered: