ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter-contrib-Powershell

by EdrisT ST3

SublimeLinter plugin for PowerShell

Details

Installs

  • Total 7K
  • Win 5K
  • Mac 738
  • Linux 577
Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7
Windows 1 1 1 3 0 1 0 0 0 1 2 1 4 0 0 0 1 0 0 1 1 2 2 1 3 1 0 1 2 1 1 3 1 3 3 2 2 2 2 1 0 0 1 0 3 1
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 1
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

SublimeLinter-contrib-powershell

This linter plugin for SublimeLinter provides an interface to PSScriptAnalyzer. It will be used with files that have the PowerShell syntax.

This linter works on Windows PowerShell 3.0 or greater and PowerShell Core 6.2 or greater on Windows/Linux/macOS.
You can check your powershell version with $PSVersionTable.PSVersion from a powershell prompt.

Installation

SublimeLinter must be installed in order to use this plugin. Please use Package Control to install the linter plugin.

Before installing this plugin, you must ensure that PSScriptAnalyzer is installed on your system and available on powershell startup.

PSScriptAnalyzer can be installed with Install-Module -Name PSScriptAnalyzer from a powershell prompt, which automatically makes the module available on powershell startup.

Settings

The simplest way to change the ScriptAnalyzer settings is from a settings file.
An example settings file with commented options is located in this plugins root folder. The provided example settings file checks for compatibility with powershell 3.0 and excludes the check for trailing spaces.

The linter will decide which settings to use in the following order:

  1. If a valid PSScriptAnalyzerSettings.psd1 file exists in your project folder, those settings will have precedence over all other settings. This enables you to use different settings for different projects.

  2. If the environment variable Env:PSScriptAnalyzerSettingsPath exists in your powershell environment and is populated with the full path to a valid settings file, those settings will be used.

  3. If the variable $GlobalPSScriptAnalyzerSettingsPath exists in your powershell environment and is populated with the full path to a valid settings file, those settings will be used. This enables you to use global custom settings. For persistency, set this variable in your powershell profile.

  4. If no settings file is found in your project folder and the $GlobalPSScriptAnalyzerSettingsPath variable is not set, default settings of PSScriptAnalyzer will be used. (all default rules enabled and no compatibility checks)

PSScriptAnalyzer have the ability to automatically fix certain warnings. For example expanding aliases. Even though I believe this functionality is fairly tested, always make sure to back your files before using it.
Type Powershell: Fix warnings in the command palette to try it out.

SublimeLinter settings