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

Sublime​Linter-contrib-Powershell

by EdrisT ST3

SublimeLinter plugin for PowerShell

Details

  • 1.0.7
  • github.​com
  • github.​com
  • 8 months ago
  • 41 minutes ago
  • 8 months ago

Installs

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

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.1.0 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 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.

  3. 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