Skip to content
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

Unable to set RuleSuppressionID in DiagnosticRecord object from custom powershell rule #1143

Closed
jegannathanmaniganadan opened this issue Feb 21, 2019 · 2 comments · Fixed by #1144
Assignees
Milestone

Comments

@jegannathanmaniganadan
Copy link
Contributor

jegannathanmaniganadan commented Feb 21, 2019

I have been trying to set RuleSuppressionID in the [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord]::new() object from a custom Powershell rules. But for some reason that is not working. Not sure if PSSA removes the property before writing it out

I could see that DiagnosticRecord constructor takes value for RuleSuppressionID.

{
            Message  = message;
            RuleName = ruleName;
            Extent   = extent;
            Severity = severity;
            ScriptPath = scriptPath;
            RuleSuppressionID = ruleId;
            this.suggestedCorrections = suggestedCorrections;
}

@bergmeister

@bergmeister
Copy link
Collaborator

bergmeister commented Feb 21, 2019

@manigandan-jegannathan-developer Yes, that could be. This reminds of this PR where I had to set the SuggestedCorrections property for custom rules because otherwise it got lost in translation. By looking at the code here it seems to be quite clear that the RuleSuppressionID does not get translated. Since this is an easy one, I opened a PR for this below (also to show you how easy it is to make changes)

@jegannathanmaniganadan
Copy link
Contributor Author

jegannathanmaniganadan commented Feb 22, 2019

@bergmeister Thanks for the PR. I thought of creating one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants