Skip to content

Latest commit

 

History

History
136 lines (97 loc) · 6.6 KB

README.md

File metadata and controls

136 lines (97 loc) · 6.6 KB

PSRule

Validate infrastructure as code (IaC) and DevOps repositories using the PSRule PowerShell module. PSRule is powerful, feature rich, and highly customizable to meet your needs.

module-version-badge

This extension is available in two release channels:

Channel Description Version/ downloads
Preview More frequent releases but more likely to contain bugs. Preview ext-preview-installs-badge
Stable Less frequent releases, with more user testing, experimental features are disabled. Stable ext-stable-installs-badge

Features

IntelliSense

Options suggestion context menu

  • Adds IntelliSense and validation support for configuring options and resources.
    • Workspace options — use IntelliSense to configure options for the workspace.
      • Type or trigger IntelliSense with Ctrl+Space from ps-rule.yaml.
    • Create resources — define baselines and selectors by using pre-built snippets and IntelliSense.

Rule definition snippet

  • Adds snippets for defining new rules.
    • Define rules with snippets and IntelliSense support.
      • Trigger IntelliSense by typing rule in a .Rule.ps1 file. IntelliSense can also be triggered by using the shortcut Ctrl+Space.

Rule markdown documentation snippet

  • Adds snippets for creating markdown documentation.
    • Quick documentation — create rule documentation to provide rule recommendations and examples.
      • Trigger IntelliSense by typing rule in a .md file. IntelliSense can also be triggered by using the shortcut Ctrl+Space.

Quick tasks

Built-in tasks shown in task list

  • Adds quick tasks for analysis directly from Visual Studio Code.
    • Run analysis — Runs rules against files in the current workspace.
      • Input path, Baseline, Modules, and Outcome options can be configured per task.
      • Output as, and showing a Not processed warning options can be configured by workspace or user.
      • Rule stored in .ps-rule/ are automatically used by default.

Configuration

In addition to configuring the ps-rule.yaml options file, the following settings are available.

Name Description
PSRule.execution.notProcessedWarning Warn when objects are not processed by any rule.
PSRule.experimental.enabled Enables experimental features in the PSRule extension.
PSRule.notifications.showChannelUpgrade Specifies if a notification to switch to the stable channel is shown on start up.
PSRule.output.as Configures the output of analysis tasks, either summary or detailed.

Support

This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates.

  • For new issues, file your bug or feature request as a new issue.
  • For help, discussion, and support questions about using this project, join or start a discussion.

Support for this project/ product is limited to the resources listed above.

Installing PSRule module

PSRule is available from the PowerShell Gallery and is required for this extension to work.

To install the module use the following command from a PowerShell prompt.

Install-Module -Name PSRule -Scope CurrentUser;

Installing the extension

You can install the latest release of the extension by following the steps in the Visual Studio Code documentation. In the Extensions pane, search for PSRule extension and install it there. You will get notified automatically about any future extension updates.

code --install-extension bewhite.psrule-vscode-preview

NOTE: If you are using VS Code Insiders, the command will be code-insiders.

Contributing

This project welcomes contributions and suggestions. If you are ready to contribute, please visit the contribution guide.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Maintainers

License

This project is licensed under the MIT License.