Add new MissingTryBlock rule (#2179)
* #2098 Add new MissingTryBlock rule * Changed severity level of MissingTryBlock rule from Error to Warning in the rule definition and resolved copy-pasta in the rule description. Co-authored-by: Copilot <copilot@github.com> * Updated tests for MissingTryBlock rule to reflect severity change from Error to Warning. * Update Rules/MissingTryBlock.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Grammar: “which is likely a mistake and result in … error” is ungrammatical. * Update Rules/Strings.resx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Rules/MissingTryBlock.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * minor but worthwhile * Update docs/Rules/MissingTryBlock.md Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com> * Applied feedback from @andrewconnell to add a note about the rule not being enabled by default, and to add a note about potential false positives with functions named "catch" or "finally". Also added a test context for when the rule is disabled. Updated the rule implementation to inherit from ConfigurableRule and set Enable to false in the constructor. Updated the AnalyzeScript method to be an override, and added overrides for GetCommonName, GetDescription, GetName, GetSeverity, and GetSourceName. * Update docs/Rules/MissingTryBlock.md Co-authored-by: Liam Peters <liamjpeters@gmail.com> * Update Tests/Rules/MissingTryBlock.tests.ps1 Co-authored-by: Liam Peters <liamjpeters@gmail.com> * Update Rules/MissingTryBlock.cs Co-authored-by: Liam Peters <liamjpeters@gmail.com> * Update Rules/MissingTryBlock.cs Co-authored-by: Liam Peters <liamjpeters@gmail.com> --------- Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com> Co-authored-by: Liam Peters <liamjpeters@gmail.com>
I
iRon7 committed
97f30d63d8ec2ff4cec492bcb52dae895389c4e1
Parent: 9c04a44
Committed by GitHub <noreply@github.com>
on 5/15/2026, 6:05:30 PM