Skip to content

Releases: PowerShell/PSScriptAnalyzer

PSScriptAnalyzer v1.18.0

22 Mar 20:55
23a18f6
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release. You can download this version from PowerShellGallery.

Breaking Changes

  • Minimum required version of PowerShell Core was raised from 6.0.2 to 6.1.0 due to 6.0 having reached the end of its support life-cycle. (#1165)
  • Updated used version of Newtonsoft.Json to 11.0.2. (#1165) (by @bergmeister)
  • Command data files of PowerShell 6.0 were removed. Updated files for PowerShell 6.1 were added. This means that users that have customized the UseCompatibleCmdlets rule, need to either adapt the version string as per rule documentation or can alternatively copy in the old command data files into the Settings installation folder (#1075) (by @bergmeister)
  • The minimum required runtime of the full .Net Framework was raised from 4.5.1 to 4.5.2 as 4.5.1 is not supported any more. If the OS is patched then Windows update will have ensured that the newer runtime patch is available. (#1108) (by @bergmeister)
  • Emit parsing errors as diagnostic records (#1130) (by @JamesWTruher)

Formatter Rules

  • Add UseCorrectCasing formatting rule for cmdlet/function name (#1117) (by @bergmeister)
  • Fix PSUseConsistentIndentationRule to handle pipes correctly when there is a multi-line statement after a pipe and add PipelineIndentation customisation option for it (#1102) (by @bergmeister)
  • Add CheckInnerBrace and CheckPipe options to PSUseConsistentWhitespace (#1092) (by @bergmeister)

Script Analysis Rules

  • Add command data file for PowerShell 2.0 (#1091) (by @bergmeister)
  • Add command data files of PowerShell 6.1.0 (#1075) (by @bergmeister)
  • New PowerShell compatibility rules: UseCompatibleCommands, UseCompatibleSyntax and UseCompatibleTypes (#1156, #1133, #1176 and #1179) (by @rjmholt and @JamesWTruher)
  • Make PossibleIncorrectComparisonWithNull rule return a SuggestCorrection for auto-fixes in VS-Code or via the -Fix switch (#1115) (by @bergmeister)
  • Make UseCompatibleCmdlets not throw if default reference desktop-5.1.14393.206-windows is specified in the list of platforms and use core-6.1.0-windows as an alternative default reference (#1043 and #1075) (by @bergmeister)

Custom Rules

DSC

  • Add support for Hashtable syntax of Import-DscRessource for -SaveDscDependency switch (#1138) (by @bergmeister)
  • Take module version into account for -SaveDscDependency switch (#1094) (by @bergmeister)

Performance

Multi-threading efficiency was highly improved leading to a speedup whilst keeping the CPU usage roughly the same. One can expect PSScriptAnalyzer (PSSA) 1.18.0 to be more than twice as fast in most situations (including 'cold' runs) compared to its predecessor 1.17.0.

Fixes and General Improvements

  • Fix bug when culture was set to Turkish (#1095) (by @bergmeister)
  • Fix settings file array parsing when no commas are present (#1161) (by @rjmholt)
  • Ensure correct disposal with using statement (#1164) (by @bergmeister)
  • Fix bug that caused Invoke-ScriptAnalyzer to not run any rule after an execution of Invoke-Formatter in the same session (but Invoke-ScriptAnalyzer would've recovered when being called again) (#1121) (by @bergmeister)
  • Fix parsing of empty hashtable when string is provided as settings object (#1073) (by @bergmeister)
  • Fix AlignAssignment rule to calculate alignment position correctly and avoid crash (#1070) (by @bergmeister)
  • Don't crash on CIM classes with no superclass (#1046) (Thanks @edyoung!)
  • Trigger AvoidPositionalParameters rule for function defined and called inside a script. (#963 and #1175) (Thanks @kalgiz! and @bergmeister)
  • Add OutputType attributes to cmdlets to enhance tab completion (#1020) (by @bergmeister)
  • Allow paths to be pipelined to Invoke-ScriptAnalyzer (#1040) (Thanks @edyoung!)
  • PSGallery will no longer use PSAvoidUsingConvertToSecureStringWithPlainText and PSAvoidUsingUserNameAndPasswordParams rules (#1037) (Thanks @edyoung!)

Build

  • Update platyps to 0.13 (#1172) (by @bergmeister)
  • Raise minimum required PS version of PS 6 to 6.1.0 due to 6.0 running out of support now and update Newtonsoft.Json to 11.0.2 (#1165) (by @bergmeister)
  • Unify reference to Microsoft.Management.Infrastructure and update System.Reflection.TypeExtensions NuGet package (#1105) (by @bergmeister)
  • Update .Net Core SDK from 2.2.103 to 2.2.104 (latest patch) (#1158) (by @bergmeister)
  • Make it easier to install the dotnet CLI tools (#1139) (by @JamesWTruher)
  • Simplify build scripts even more and upgrade platyPS in Appveyor #1088 (by @bergmeister)
  • Upgrade .Net SDK to 2.2.102 to fix new test failures on AppVeyor's Ubuntu image due an image update (#1128) (by @bergmeister)
  • Mark setting files as content for easier out-of-the-box debugging (#1104) (by @bergmeister)
  • Upgrade from net451 to net452 since net451 is not supported any more and net452 is an in-place upgrade anyway (#1108) (by @bergmeister)
  • Install dotnet sdk if missing on Unix as well to fix failing Ubuntu build due to image update and Pester/PowerShell bug (#1107) (by @bergmeister)
  • Removes update of pwsh since appveyor images are updated (#1084) (Thanks @wilmardo!)
  • Update, simplify, and consolidate build scripts (#1082) (by @JamesWTruher)
  • Bump .Net Core SDK version to 2.1.401 (#1086) (Thanks @wilmardo!)
  • Use RTM version of Microsoft.Management.Infrastructure (#1059) (by @bergmeister)
  • Upgrade Microsoft.PowerShell.5.ReferenceAssemblies from 1.0.0 to 1.1.0 and remove redundant/transitive references (#1050) (by @bergmeister)
  • Remove RuntimeFrameworkVersion as this is given by the running version of PS anyway and .Net would upgrade automatically anyway if possible (#1052) (by @bergmeister)
  • Upgrade Nuget packages (System.Reflection.TypeExtensions and Microsoft.CSharp) and make them more consistent (#1051) (by @bergmeister)
  • give explicit error on unsupported versions of pscore and document it (#1049) (by @bergmeister)
  • Remove old and redundant test settings file core-6.0.0-alpha-windows.json (#1044) (by @bergmeister)
  • Use TLS 1.2 for bootstrapping dotnet in CI (#1047) (by @bergmeister)
  • Remove redundant/outdated build scripts and cleanup (#1011) (by @bergmeister)
  • Upload only out folder as artifact, which is the actual PSSA artifact (#1009) (by @bergmeister)

Documentation

  • Fix the "How" section #1127 (Thanks @alexandair!)
  • Make the correct example use the declared variable (#1111) (Thanks @f0nt4!)
  • Correcting CommunityRules to CommunityAnalyzerRules (#1119) (Thanks @kvprasoon!)
  • Add summary comment to some rules with short description (#1087) (Thanks @pedrocodacy!)
  • Update PR template to be more similar to the one of PowerShell but still distinguish where necessary (#1077)
  • Update documentation of PSUseConsistentWhiteSpace: enhance example and correct argument type. #1069 (Thanks @TheIncorrigible1!)
  • Update AvoidNullOrEmptyHelpMessageAttribute.md fix typo (#1068) (Thanks @TheIncorrigible1!)

PSScriptAnalyzer v1.17.1

05 Jun 23:07
3a3ff48
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release. You can download this version from PowerShellGallery.

Note: The minimum supported/working version of PowerShell Core is 6.0.2.

Patches 1.17.0 mainly to fix

PSScriptAnalyzer v1.17.0

01 Jun 21:46
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release. You can download this version from PowerShellGallery.

Because We noticed an issue with installing from the gallery where one had to use -SkipPublisherCheck when running Install-Module
Install-Module -Name PSScriptAnalyzer -SkipPublisherCheck due to a wrong file catalog signing hash, therefore the module was pulled from the Gallery at the end and version 1.17.1 should be used instead.

New Parameters

  • Add -ReportSummary switch (#895) (Thanks @StingyJack! for the base work that got finalized by @bergmeister)
  • Add -EnableExit switch to Invoke-ScriptAnalyzer for exit and return exit code for CI purposes (#842) (by @bergmeister)
  • Add -Fix switch to -Path parameter set of Invoke-ScriptAnalyzer (#817, #852) (by @bergmeister)

New Rules and Warnings

  • Warn when 'Get-' prefix was omitted in AvoidAlias rule. (#927) (by @bergmeister)
  • AvoidAssignmentToAutomaticVariable. NB: Currently only warns against read-only automatic variables (#864, #917) (by @bergmeister)
  • PossibleIncorrectUsageOfRedirectionOperator and PossibleIncorrectUsageOfAssignmentOperator. (#859, #881) (by @bergmeister)
  • Add PSAvoidTrailingWhitespace rule (#820) (Thanks @dlwyatt!)

Fixes and Improvements

  • AvoidDefaultValueForMandatoryParameter triggers when the field has specification: Mandatory=value and value!=0 (#969) (by @kalgiz)
  • Do not trigger UseDeclaredVarsMoreThanAssignment for variables being used via Get-Variable (#925) (by @bergmeister)
  • Make UseDeclaredVarsMoreThanAssignments not flag drive qualified variables (#958) (by @bergmeister)
  • Fix PSUseDeclaredVarsMoreThanAssignments to not give false positives when using += operator (#935) (by @bergmeister)
  • Tweak UseConsistentWhiteSpace formatting rule to exclude first unary operator when being used in argument (#949) (by @bergmeister)
  • Allow -Setting parameter to resolve setting presets as well when object is still a PSObject in BeginProcessing (#928) (by @bergmeister)
  • Add macos detection to New-CommandDataFile (#947) (Thanks @GavinEke!)
  • Fix PlaceOpenBrace rule correction to take comment at the end of line into account (#929) (by @bergmeister)
  • Do not trigger UseShouldProcessForStateChangingFunctions rule for workflows (#923) (by @bergmeister)
  • Fix parsing the -Settings object as a path when the path object originates from an expression (#915) (by @bergmeister)
  • Allow relative settings path (#909) (by @bergmeister)
  • Fix AvoidDefaultValueForMandatoryParameter documentation, rule and tests (#907) (by @bergmeister)
  • Fix NullReferenceException in AlignAssignmentStatement rule when CheckHashtable is enabled (#838) (by @bergmeister)
  • Fix FixPSUseDeclaredVarsMoreThanAssignments to also detect variables that are strongly typed (#837) (by @bergmeister)
  • Fix PSUseDeclaredVarsMoreThanAssignments when variable is assigned more than once to still give a warning (#836) (by @bergmeister)

Engine, Building and Testing

  • Support SuggestedCorrections property on DiagnosticRecord for script based rules #1000 (by @bergmeister)
  • Add CommandData files of PowerShell Core 6.0.2 for Windows/Linux/macOS and WMF3/4 that are used by UseCompatibleCmdlets rule (#954) (by @bergmeister)
  • If no path is found or when using the -ScriptDefinition parameter set, default to the current location for the directory search of the implicit settings file (#979) (by @bergmeister)
  • Allow TypeNotFound parser errors (#957) (by @bergmeister)
  • Fix release script by building also for v3 and misc. improvements (#996) (by @bergmeister)
  • Scripts needed to build and sign PSSA via MS VSTS so it can be published in the gallery (#983) (by @JamesWTruher)
  • Move common test code into AppVeyor module (#961) (by @bergmeister)
  • Remove extraneous import-module commands in tests (#962) (by @JamesWTruher)
  • Upgrade 'System.Automation.Management' NuGet package of version 6.0.0-alpha13 to version 6.0.2 from powershell-core feed, which requires upgrade to netstandard2.0. NB: This highly improved behavior on WMF3 but also means that the latest patched version (6.0.2) of PowerShell Core should be used. (#919) by @bergmeister)
  • Add Ubuntu Build+Test to Appveyor CI (#940) (by @bergmeister)
  • Add PowerShell Core Build+Test to Appveyor CI (#939) (by @bergmeister)
  • Update Newtonsoft.Json NuGet package of Rules project from 9.0.1 to 10.0.3 (#937) (by @bergmeister)
  • Fix Pester v4 installation for Visual Studio 2017 image and use Pester v4 assertion operator syntax (#892) (by @bergmeister)
  • Have a single point of reference for the .Net Core SDK version (#885) (by @bergmeister)
  • Fix regressions introduced by PR 882 (#891) (by @bergmeister)
  • Changes to allow tests to be run outside of CI (#882) (by @JamesWTruher)
  • Upgrade platyPS from Version 0.5 to 0.9 (#869) (by @bergmeister)
  • Build using .Net Core SDK 2.1.101 targeting netstandard2.0 and net451 (#853, #854, #870, #899, #912, #936) (by @bergmeister)
  • Add instructions to make a release (#843) (by @kapilmb)

Documentation, Error Messages and miscellaneous Improvements

  • Added Chocolatey Install help, which has community support (#999) (Thanks @pauby)
  • Finalize Release Logs and bump version to 1.17 (#1002) (by @bergmeister)
  • Docker examples: (#987, #990) (by @bergmeister)
  • Use multiple GitHub issue templates for bugs, feature requests and support questions (#986) (by @bergmeister
  • Fix table of contents (#980) (by @bergmeister)
  • Improve documentation, especially about parameter usage and the settings file (#968) (by @bergmeister)
  • Add base changelog for 1.17.0 (#967) (by @bergmeister)
  • Remove outdated about_scriptanalyzer help file (#951) (by @bergmeister)
  • Fixes a typo and enhances the documentation for the parameters required for script rules (#942) (Thanks @MWL88!)
  • Remove unused using statements and sort them (#931) (by @bergmeister)
  • Make licence headers consistent across all .cs files by using the recommended header of PsCore (#930) (by @bergmeister)
  • Update syntax in ReadMe to be the correct one from get-help (#932) by @bergmeister)
  • Remove redundant, out of date Readme of RuleDocumentation folder (#918) (by @bergmeister)
  • Shorten contribution section in ReadMe and make it more friendly (#911) (by @bergmeister)
  • Update from Pester 4.1.1 to 4.3.1 and use new -BeTrue and -BeFalse operators (#906) (by @bergmeister)
  • Fix Markdown in ScriptRuleDocumentation.md so it renders correctly on GitHub web site (#898) (Thanks @MWL88!)
  • Fix typo in .Description for Measure-RequiresModules (#888) (Thanks @TimCurwick!)
  • Use https links where possible (#873) (by @bergmeister)
  • Make documentation of AvoidUsingPositionalParameters match the implementation (#867) (by @bergmeister)
  • Fix PSAvoidUsingCmdletAliases warnings of internal build/release scripts in root and Utils folder (#872) (by @bergmeister)
  • Add simple GitHub Pull Request template based off the one for PowerShell Core (#866) (by @bergmeister)
  • Add a simple GitHub issue template based on the one of PowerShell Core. (#865, #884) (by @bergmeister)
  • Fix Example 7 in Invoke-ScriptAnalyzer.md (#862) (Thanks @sethvs!)
  • Use the typewriter apostrophe instead the typographic apostrophe (#855) (Thanks @alexandear!)
  • Add justification to ReadMe (#848) (Thanks @KevinMarquette!)
  • Fix typo in README (#845) (Thanks @misterGF!)

Please see the CHANGELOG for the latest information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.16.1

07 Sep 23:47
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.16.0

16 Aug 19:06
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.15.0

21 Jun 17:45
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.14.1

12 Jun 23:01
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.14.0

09 Jun 18:26
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.13.0

18 May 22:34
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in the release.

You can download this version from PowerShellGallery.

PSScriptAnalyzer v1.12.0

09 May 22:05
Compare
Choose a tag to compare

Please see the CHANGELOG for information about the changes in this release.

You can download this version from PowerShellGallery.