A Visual Studio Code extension for PSRule.
Перейти к файлу
dependabot[bot] e35ea15707
Bump @types/node from 22.5.2 to 22.5.4 (#1517)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.5.2 to 22.5.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-06 14:48:28 +10:00
.devcontainer Bump @types/vscode from 1.91.0 to 1.92.0 (#1491) 2024-08-10 14:45:49 +10:00
.github Improve dev container config (#1484) 2024-07-26 02:39:56 +10:00
.vscode Bump @types/vscode from 1.91.0 to 1.92.0 (#1491) 2024-08-10 14:45:49 +10:00
docs Update to CI (#1190) 2023-07-07 17:26:07 +10:00
dotnet/PSRule.EditorServices Bump Microsoft.PowerShell.SDK from 7.4.4 to 7.4.5 (#1504) 2024-09-04 11:24:35 +10:00
media Getting started walkthrough updates #1099 #1093 (#1100) 2023-04-22 15:59:37 +10:00
schemas Bump schemas (#1433) 2024-08-19 09:37:34 +10:00
scripts Update schemas/ (#1344) 2024-02-03 23:06:45 +10:00
snippets Update snippets (#1281) 2023-11-11 17:43:14 +10:00
src Added server tooling #225 (#1434) 2024-06-04 16:47:14 +10:00
syntaxes Update to CI (#1190) 2023-07-07 17:26:07 +10:00
.editorconfig Support for shipping PSRule tool #1315 (#1351) 2024-02-14 00:31:01 +10:00
.eslintignore Update dependencies and use eslint (#66) 2020-03-17 13:26:05 +10:00
.eslintrc.json Update to CI (#1190) 2023-07-07 17:26:07 +10:00
.gitignore Support for shipping PSRule tool #1315 (#1351) 2024-02-14 00:31:01 +10:00
.markdownlint.json Update to CI (#1190) 2023-07-07 17:26:07 +10:00
.prettierrc Update to CI (#1190) 2023-07-07 17:26:07 +10:00
.vscodeignore Support for shipping PSRule tool #1315 (#1351) 2024-02-14 00:31:01 +10:00
CHANGELOG.md Bump @types/vscode from 1.91.0 to 1.92.0 (#1491) 2024-08-10 14:45:49 +10:00
CODE_OF_CONDUCT.md Migrate repository to Microsoft GitHub org #152 (#165) 2020-12-17 17:20:29 +10:00
CONTRIBUTING.md Migrate repository to Microsoft GitHub org #152 (#165) 2020-12-17 17:20:29 +10:00
GitVersion.yml Bump GitVersion.yml (#1317) 2024-01-02 12:15:19 +10:00
LICENSE Migrate repository to Microsoft GitHub org #152 (#165) 2020-12-17 17:20:29 +10:00
PSRule-vscode.sln Support for shipping PSRule tool #1315 (#1351) 2024-02-14 00:31:01 +10:00
README.md Update to CI (#1190) 2023-07-07 17:26:07 +10:00
SECURITY.md Migrate repository to Microsoft GitHub org #152 (#165) 2020-12-17 17:20:29 +10:00
SUPPORT.md Split extension into two release channels #150 (#221) 2021-05-04 03:35:23 +10:00
package-lock.json Bump @types/node from 22.5.2 to 22.5.4 (#1517) 2024-09-06 14:48:28 +10:00
package.json Bump @types/node from 22.5.2 to 22.5.4 (#1517) 2024-09-06 14:48:28 +10:00
pipeline.build.ps1 Update package name (#1348) 2024-02-12 17:29:38 +10:00
ps-project.yaml Update to CI (#1190) 2023-07-07 17:26:07 +10:00
ps-rule.lock.json Support for shipping PSRule tool #1315 (#1351) 2024-02-14 00:31:01 +10:00
ps-rule.yaml Support for shipping PSRule tool #1315 (#1351) 2024-02-14 00:31:01 +10:00
tsconfig.json Bump @azure/msal-node from 2.7.0 to 2.9.2 (#1446) 2024-06-23 21:39:47 +10:00

README.md

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

CodeLens

CodeLens showing link to create documentation

  • CodeLens shows links to create or edit markdown documentation from rules in YAML, JSON, or PowerShell.
    • Open documentation — Opens rule markdown documentation in the editor.
      • The location for storing documentation is configurable in the extension settings.
      • By default, a locale specific folder is created in the same directory as the rule file.
    • Create documentation — Creates a new markdown file for the rule based on a snippet.
      • New markdown documentation is created with the built-in Rule Doc snippet.
      • An alternative snippet can be specified by configuring extension settings.

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, .Rule.yaml, or .Rule.jsonc 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.
      • Use the built-in analysis task by running or configuring the task from the Terminal menu.

Configuration

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

Name Description
PSRule.codeLens.ruleDocumentationLinks Enables Code Lens that displays links to rule documentation. This is an experimental feature that requires experimental features to be enabled.
PSRule.documentation.path The path to look for rule documentation. When not set, the path containing rules will be used.
PSRule.documentation.localePath The locale path to use for locating rule documentation. The VS Code locale will be used by default.
PSRule.documentation.customSnippetPath The path to a file containing a rule documentation snippet. When not set, built-in PSRule snippets will be used.
PSRule.documentation.snippet The name of a snippet to use when creating new rule documentation. By default, the built-in Rule Doc snippet will be used.
PSRule.execution.notProcessedWarning Warn when objects are not processed by any rule. This option is deprecated and replaced by PSRule.execution.unprocessedObject.
PSRule.execution.ruleExcluded Determines how to handle excluded rules. When set to None, PSRule will use the default (Ignore), unless set by PSRule options.
PSRule.execution.ruleSuppressed Determines how to handle suppressed rules. When set to None, PSRule will use the default (Warn), unless set by PSRule options.
PSRule.execution.unprocessedObject Determines how to report objects that are not processed by any rule. When set to None, PSRule will use the default (Warn), unless set by PSRule options.
PSRule.experimental.enabled Enables experimental features in the PSRule extension.
PSRule.notifications.showChannelUpgrade Determines if a notification to switch to the stable channel is shown on start up.
PSRule.notifications.showPowerShellExtension Determines if a notification to install the PowerShell extension is shown on start up.
PSRule.output.as Configures the output of analysis tasks, either summary or detailed.
PSRule.rule.baseline The name of the default baseline to use for executing rules. This setting can be overridden on individual PSRule tasks.

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.