Skip to content

Enforce presence of '$ErrorActionPreference = "Stop"' #1271

@chriskuech

Description

@chriskuech

Summary of the new feature

Defensive Programming is essential to software engineering. To enable fail-fast methodology in PowerShell, you must add $ErrorActionPreference = "Stop" to the top of every PowerShell file. One can easily forget to add this line; I would like a PSScriptAnalyzer rule that enforces the presence of $ErrorActionPreference = "Stop", or at a minimum enforces explicitly setting $ErororActionPreference.

What is the latest version of PSScriptAnalyzer at the point of writing
N/A (whatever comes in the latest version of VS Code PowerShell extension)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions