Elevator Pitch
PSScriptAnalyzer is great. You use it to check all your code to make sure it follows PowerShell best practices, right? In this session, I’ll show you how to take your PSScriptAnalyzer skills to the next level by showing you how to write your own custom rules, and make PSSA check your code for them.
Description
PSScriptAnalyzer is great, not just because it comes with a bunch of rules that Microsoft and the community support, but because it allows you to put your own rules on top of (or instead of) it. Maybe you want to make sure that you’re using camelCase for your variables but PascalCase for your parameters. You’re going to need to write your own rule for that one. Writing your own PSSA rules can be intimidating up front, but I’m going to share some examples of rules I’ve written, used, and even got implemented as rules included with PSSA, to show attendees the unique authoring process, how to get started ripping apart the AST, and making their lives better with custom PSSA rules.
Notes
I can run this entirely locally on my own laptop - no external network connectivity required.
I’m the best person to speak on this topic because I’ve been writing my own PSScriptAnalyzer rules for a good long time. I’ve got rules that are used all over the place, including some that prompted Microsoft to change how their core rule set works so that mine (and others like mine) could be included when someone installs the PSSA module.