{"id":17901,"date":"2019-06-13T13:35:12","date_gmt":"2019-06-13T21:35:12","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17901"},"modified":"2022-05-23T09:42:39","modified_gmt":"2022-05-23T17:42:39","slug":"release-of-powershell-script-analyzer-1-18-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/release-of-powershell-script-analyzer-1-18-1\/","title":{"rendered":"Release of PowerShell Script Analyzer 1.18.1"},"content":{"rendered":"<h3 id=\"overview\" class=\"code-line\" data-line=\"2\">Overview<\/h3>\n<p class=\"code-line\" data-line=\"4\"><code>PSScriptAnalyzer<\/code>\u00a0(<code>PSSA<\/code>)\u00a0<code>1.18.1<\/code>\u00a0is now available on the\u00a0<a title=\"https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/1.18.1\" href=\"https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/1.18.1\">PSGallery<\/a>\u00a0and fixes not only a lot of the issues reported for\u00a0<code>1.18.0<\/code>\u00a0but has also been made twice as faster compared to\u00a0<code>1.18.0<\/code>. Additionally, the\u00a0<code>-SaveDscDependency<\/code>\u00a0switch on\u00a0<code>Invoke-ScriptAnalyzer<\/code>has been improved to be platform agnostic and should now also work on Linux systems if DSC has been set up. A long standing concurrency bug related to analysing module manifest has also been\u00a0<a title=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/pull\/1258\" href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/pull\/1258\">fixed<\/a>. Analysis showed that\u00a0<code>Test-ModuleManifest<\/code>\u00a0is not thread-safe due to a bug either in the cmdlet or in the PowerShell engine itself, we resolved it by having a lock around calls to this cmdlet.<\/p>\n<h3 id=\"formatter-fixes\" class=\"code-line\" data-line=\"9\">Formatter Fixes<\/h3>\n<p class=\"code-line\" data-line=\"11\">This applies especially to its usage within the VS Code PowerShell extension:<\/p>\n<ul>\n<li class=\"code-line\" data-line=\"13\">The new\u00a0<code>PSUseCorrectCasing<\/code>\u00a0formatting rule had to be adjusted to not expand\/change paths and to treat wildcard characters correctly. Under the hood the rule calls\u00a0<code>Get-Command<\/code>\u00a0and because\u00a0<code>Get-Command ?<\/code>\u00a0returns all commands that have a name of length 1, it returned\u00a0<code>ForEach-Object<\/code>\u00a0first, which made PSSA incorrectly change the\u00a0<code>?<\/code>\u00a0alias for\u00a0<code>Where-Object<\/code>\u00a0to\u00a0<code>ForEach-Object<\/code>. The PowerShell VS Code extension has the\u00a0<code>powershell.codeFormatting.useCorrectCasing<\/code>\u00a0setting that wraps around this configuration and the setting is currently defaulting to\u00a0<code>false<\/code>\u00a0due to those issues that were found. With PSSA\u00a0<code>1.18.1<\/code>, we&#8217;d encourage you to enable the setting again as we think that we have fixed all issues and pending feedback we plan to enable the setting by default. Although the VS Code extension ships a backup version of PSSA (currently\u00a0<code>1.18.0<\/code>), one can always install PSScriptAnalyzer locally and the extension will pick it up. You can install the newer PSScriptAnalyzer version and start using it without having to wait for the extension to release an update.<\/li>\n<li class=\"code-line\" data-line=\"19\">The new\u00a0<code>PipelineIndentation<\/code>\u00a0configuration setting of the\u00a0<code>PSUseConsistentIndentation<\/code>\u00a0formatting rule had a bug when it was set to\u00a0<code>IncreaseIndentationForFirstPipeline<\/code>\u00a0or\u00a0<code>IncreaseIndentationAfterEveryPipeline<\/code>\u00a0and in certain cases, indentation of code following the pipeline could be incorrectly indented. Currently the VS Code setting\u00a0<code>powershell.codeFormatting.pipelineIndentationStyle<\/code>\u00a0for it is set to\u00a0<code>NoIndentation<\/code>\u00a0to avoid this bug. We encourage you here as well to try out the options again so that we can get feedback before we set the default of the VS Code setting to\u00a0<code>IncreaseIndentationForFirstPipeline<\/code>\u00a0(which is the default when calling\u00a0<code>Invoke-Formatter<\/code>\u00a0without parameters). This desired default was voted for by the community\u00a0<a title=\"https:\/\/twitter.com\/CBergmeister\/status\/1062843776341864448\" href=\"https:\/\/twitter.com\/CBergmeister\/status\/1062843776341864448\">here<\/a>.<\/li>\n<\/ul>\n<h3 id=\"conclusion-and-future-outlook\" class=\"code-line\" data-line=\"24\">Conclusion and Future Outlook<\/h3>\n<p class=\"code-line\" data-line=\"26\">Please try out this new patch, if you install it using\u00a0<code>Install-Module<\/code>\u00a0then the VS Code extension will automatically use it after a restart of the integrated terminal session or just by re-opening VS Code. Getting feedback in this period is very important so that the PowerShell team can make a decision on when to include\u00a0<code>1.18.1<\/code>\u00a0by default in one of the next updates of the PowerShell extension. After feedback of this phased rollout, we will consider changing the default settings in the extension as mentioned above. It is hard to anticipate all the use cases, so we chose to make features configurable behind new flags and rollout the changes to a smaller user group first.<\/p>\n<p class=\"code-line\" data-line=\"31\">The\u00a0<a title=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/blob\/development\/CHANGELOG.MD\" href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/blob\/development\/CHANGELOG.MD\">Changelog<\/a>\u00a0has more details if you want to dig further.<\/p>\n<p class=\"code-line\" data-line=\"33\">On behalf of the Script Analyzer team,<\/p>\n<p class=\"code-line\" data-line=\"35\">Christoph Bergmeister, Project Maintainer from the community\nJim Truher, Senior Software Engineer, Microsoft<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview PSScriptAnalyzer\u00a0(PSSA)\u00a01.18.1\u00a0is now available on the\u00a0PSGallery\u00a0and fixes not only a lot of the issues reported for\u00a01.18.0\u00a0but has also been made twice as faster compared to\u00a01.18.0. Additionally, the\u00a0-SaveDscDependency\u00a0switch on\u00a0Invoke-ScriptAnalyzerhas been improved to be platform agnostic and should now also work on Linux systems if DSC has been set up. A long standing concurrency bug related to [&hellip;]<\/p>\n","protected":false},"author":2413,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3182],"class_list":["post-17901","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-psscriptanalyzer"],"acf":[],"blog_post_summary":"<p>Overview PSScriptAnalyzer\u00a0(PSSA)\u00a01.18.1\u00a0is now available on the\u00a0PSGallery\u00a0and fixes not only a lot of the issues reported for\u00a01.18.0\u00a0but has also been made twice as faster compared to\u00a01.18.0. Additionally, the\u00a0-SaveDscDependency\u00a0switch on\u00a0Invoke-ScriptAnalyzerhas been improved to be platform agnostic and should now also work on Linux systems if DSC has been set up. A long standing concurrency bug related to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/2413"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17901"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17901\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}