{"id":18515,"date":"2020-07-28T09:52:37","date_gmt":"2020-07-28T17:52:37","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=18515"},"modified":"2020-07-28T12:02:07","modified_gmt":"2020-07-28T20:02:07","slug":"psscriptanalyzer-1-19-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/psscriptanalyzer-1-19-1\/","title":{"rendered":"PSScriptAnalyzer 1.19.1"},"content":{"rendered":"<p><a href=\"https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/1.19.1\" rel=\"nofollow\">PSScriptAnalyzer 1.19.1<\/a>\u00a0is now available on the PowerShell Gallery. This minor update fixes a few user-reported bugs and introduces a new rule (which is disabled by default) for avoiding using double quotes for constant strings. To install this version of the module, open any PowerShell console and run:\u00a0<code>Install-Module PSScriptAnalyzer -Force -Repository PSGallery<\/code><\/p>\n<h2><a id=\"user-content-new-rule\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#new-rule\" aria-hidden=\"true\"><\/a>New Rule<\/h2>\n<p>AvoidUsingDoubleQuotesForConstantString (disabled by default)<\/p>\n<p><strong>Severity Level: Information<\/strong><\/p>\n<h3><a id=\"user-content-rule-description\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#rule-description\" aria-hidden=\"true\"><\/a>Rule Description<\/h3>\n<p>When the value of a string is constant (i.e. not being interpolated by injecting variables or expression into such as e.g.\u00a0<code>\"$PID-$(hostname)\"<\/code>), then single quotes should be used to express the constant nature of the string. This is not only to make the intent clearer that the string is a constant and makes it easier to use some special characters such as e.g.\u00a0<code>$<\/code>\u00a0within that string expression without the need to escape them. There are exceptions to that when double quoted strings are more readable though, e.g. when the string value itself has to contain a single quote (which would require a double single quotes to escape the character itself) or certain very special characters such as e.g.\u00a0<code>\"\\n\"<\/code>\u00a0are already being escaped, the rule would not warn in this case as it is up to the author to decide on what is more readable in those cases.<\/p>\n<h3><a id=\"user-content-rule-example\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#rule-example\" aria-hidden=\"true\"><\/a>Rule Example<\/h3>\n<h4><a id=\"user-content-incorrect\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#incorrect\" aria-hidden=\"true\"><\/a>Incorrect<\/h4>\n<div class=\"highlight highlight-source-powershell\">\n<pre><span class=\"pl-smi\">$constantValue<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>I Love PowerShell<span class=\"pl-pds\">\"<\/span><\/span><\/pre>\n<\/div>\n<h4><a id=\"user-content-correct\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#correct\" aria-hidden=\"true\"><\/a>Correct<\/h4>\n<div class=\"highlight highlight-source-powershell\">\n<pre><span class=\"pl-smi\">$constantValue<\/span> <span class=\"pl-k\">=<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>I Love PowerShell<span class=\"pl-pds\">'<\/span><\/span><\/pre>\n<\/div>\n<h2><a id=\"user-content-bug-fixes\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#bug-fixes\" aria-hidden=\"true\"><\/a>Bug Fixes<\/h2>\n<ul>\n<li>Fix bug that caused incorrect formatting in hashtables in the non-default setting PipelineIndentationStyle.None\u00a0 (if you do use this setting we ask that users to try it out again\u00a0 as the long term idea is to make it the default setting)<\/li>\n<li>Fix ArgumentException when the same variable name is used in 2 different sessions<\/li>\n<li>Fixed bugs with\u00a0<code>UseConsistentWhitespace<\/code><\/li>\n<li>Fixes issue when\u00a0<code>CommandInfoParameters<\/code>\u00a0property throws due to runspace affinity problem of PowerShell engine<\/li>\n<li>Fix token check with new lines<\/li>\n<li>Fix\u00a0<code>CheckParameter<\/code>\u00a0bug when using interpolated string<\/li>\n<\/ul>\n<p>For the full list of changes please refer to the\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/blob\/master\/CHANGELOG.MD#1191\">change log<\/a>.<\/p>\n<h2><a id=\"user-content-whats-next-for-psscriptanalyzer\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#whats-next-for-psscriptanalyzer\" aria-hidden=\"true\"><\/a>What&#8217;s next for PSScriptAnalyzer<\/h2>\n<p>We are currently working on a major rearchitecture of PSScriptAnalyzer, we are calling this project PSScriptAnalyzer 2.0, and hope to have previews available fall 2020.<\/p>\n<p>To understand the goals of the project and track our progress please refer to\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/issues\/1528\">this roadmap<\/a>. Within our GitHub repository we are using the issue tag &#8220;Consider-2.0&#8221; to track bugs and features that we are hoping to resolve in the release. As we get closer to releasing versions of this rearchitecture we will shift to a &#8220;Resolved-2.0&#8221; tag to mark issues that are expected to be resolved by the time PSScriptAnalyzer 2.0 becomes generally available.<\/p>\n<p>Now is a great time to give us feedback around the priorities for improvements and features\/use cases of the module as we are still in the early stages of development. If you use PSScriptAnalyzer to build PowerShell tools, we would especially love your feedback on our\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\/labels\/API%20Proposal\">API design<\/a>.<\/p>\n<h2><a id=\"user-content-feedback-and-support\" class=\"anchor\" href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog\/blob\/master\/Posts\/2020-07-23-PSScriptAnalyzer1-19-1.md#feedback-and-support\" aria-hidden=\"true\"><\/a>Feedback and Support<\/h2>\n<p>The best place to get support on issues you may encounter or to give feedback\/feature requests is through our\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\">GitHub Repository<\/a>.<\/p>\n<p>Sydney Smith\nPowerShell Team<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PSScriptAnalyzer 1.19.1\u00a0is now available on the PowerShell Gallery. This minor update fixes a few user-reported bugs and introduces a new rule (which is disabled by default) for avoiding using double quotes for constant strings. To install this version of the module, open any PowerShell console and run:\u00a0Install-Module PSScriptAnalyzer -Force -Repository PSGallery New Rule AvoidUsingDoubleQuotesForConstantString (disabled [&hellip;]<\/p>\n","protected":false},"author":2299,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-18515","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>PSScriptAnalyzer 1.19.1\u00a0is now available on the PowerShell Gallery. This minor update fixes a few user-reported bugs and introduces a new rule (which is disabled by default) for avoiding using double quotes for constant strings. To install this version of the module, open any PowerShell console and run:\u00a0Install-Module PSScriptAnalyzer -Force -Repository PSGallery New Rule AvoidUsingDoubleQuotesForConstantString (disabled [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/18515","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\/2299"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=18515"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/18515\/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=18515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=18515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=18515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}