~/talk

A Crash Course in Writing Your Own PSScriptAnalyzer Rules

links:none on file
slides:none on file

Shows how to extend PSScriptAnalyzer by writing PowerShell rules that parse the abstract syntax tree and inspect parameter AST objects to detect concrete violations. Builds a rule that flags multiple parameters with value from pipeline in the same parameter set, runs it against a sample file, and finds two real violations. Outputs diagnostic record objects so results integrate with PSScriptAnalyzer formatting. Solution works end to end but has edge cases (quoting, nested scopes, unit tests) and needs refinement.

AI-written summary · about

  1. 0:00Introduction
  2. 8:00Importing Modules
  3. 9:15Simple Function
  4. 11:25Different AST Objects
  5. 12:48Parameter AST
  6. 13:32Parameter Parameter
  7. 13:58Parameter Name
  8. 14:53Variable Path
  9. 16:42Attributes
  10. 19:50Warnings
  11. 20:33Detecting Violations
  12. 21:30Command with Binding
  13. 22:27Parameters AST
  14. 23:39Parameter Attributes
  15. 29:31Parameter Set Name
  16. 30:04Custom Object
  17. 31:15PSScriptAnalyzer Role
  18. 33:37Invoke Custom Role
  19. 40:10Parameter Sets
  20. 41:41Running the Rule
  21. 43:40Ideas for Improvement
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.