{"id":1201,"date":"2015-04-29T14:34:00","date_gmt":"2015-04-29T22:34:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2015\/04\/29\/scriptanalyzer-in-github-and-availability-on-powershell-gallery\/"},"modified":"2022-05-23T09:46:16","modified_gmt":"2022-05-23T17:46:16","slug":"scriptanalyzer-in-github-and-availability-on-powershell-gallery","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/scriptanalyzer-in-github-and-availability-on-powershell-gallery\/","title":{"rendered":"ScriptAnalyzer in GitHub and availability on PowerShell Gallery"},"content":{"rendered":"<p><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">With the release of <a href=\"http:\/\/blogs.msdn.com\/b\/powershell\/archive\/2015\/04\/29\/windows-management-framework-5-0-preview-april-2015-is-now-available.aspx\">Windows Management Framework 5.0 April Preview<\/a>, we are excited to announce that PowerShell ScriptAnalyzer development has moved to GitHub for greater collaboration &amp; community involvement.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\"><a href=\"https:\/\/github.com\/PowerShell\/PSScriptAnalyzer\">https:\/\/github.com\/PowerShell\/PSScriptAnalyzer<\/a><\/span>&nbsp;<\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Also, we have published v1.0 of ScriptAnalyzer to PSGallery.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\"><a href=\"https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/\">https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/<\/a><\/span>&nbsp;<\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Here are the significant changes in this release:<\/span><br \/>&nbsp;<\/p>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\"><strong>Features:<\/strong><\/span><\/pre>\n<ul>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">&#8220;Recursive&#8221; switch to analyze a folderpath in Invoke-ScriptAnalyzer<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Three levels of Severity &#8211; Error\/Warning\/Informational<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Robust Engine that does emits non-terminating errors (Ex: for failed ast parse) and continues rule application when running on multiple scripts<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Add wild card supports for rules in Invoke-ScriptAnalyzer and Get-ScriptAnalyzerRule. Eg. Invoke-ScriptAnalyzer -IncludeRule PSAvoid* will apply all rules starting with PSAvoid* in built in rule assemblies.<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Add -Severity to Get-ScriptAnalyzerRules. Get-ScriptAnalyzer -Severity will filter rules based on the severity given.<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Suppression functionality. Users are now able to specify suppression on certain parts of the scripts by specifying &#8220;SupressMessageAttribute&#8221;. Also comes with this feature is the ability for users to display a list of suppressed messages.<\/span>&nbsp;<\/li>\n<\/ul>\n<pre><br \/><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\"><strong>Rules:<\/strong><\/span><\/pre>\n<ul>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">DSC Rules for resources &#8211; Parameter validation, Usage of standard DSC functions, return type validation, support for DSC classes<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Detecting the usage of positional parameters as opposed to using named parameters<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Detect DSC configuration\/resource files and disable default rule checkings on DSC configuration and resource files.<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">UseShouldProcessForStateChangingFunctions &#8211; If an advanced function has Verbs like New\/Start\/Stop\/Restart\/Reset\/Set- that will change system state, it should support ShouldProcess attribute.<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">AvoidUsingWMIObjectCmdlet &#8211; For PowerShell 3.0 and above, usage of WMIObject is not recommended. This rule is to detect WMIObject usage in scripts that are written for PS 3.0 and above.<\/span>&nbsp;<\/li>\n<\/ul>\n<pre><br \/><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\"><strong>Fixes:<\/strong><\/span><\/pre>\n<ul>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Better heuristics to detect usage of Username and Password instead of PSCredential type<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Better accuracy in the detection of uninitialized variables<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Better error messages, added error line numbers and file names<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Identifying usage of PSBound parameters and PowerShell supplied variables such as $MyInvocation<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Fixed terminating errors including &#8220;Illegal characters in Path&#8221;<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Display properties in output are now consistent with the object properties so it would be easy to do property accessing<\/span>&nbsp;<\/li>\n<\/ul>\n<pre>&nbsp;<\/pre>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Thanks,<\/span><\/pre>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">Raghu Shantha<\/span><\/pre>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;font-size: small\">PowerShell ScriptAnalyzer Team<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With the release of Windows Management Framework 5.0 April Preview, we are excited to announce that PowerShell ScriptAnalyzer development has moved to GitHub for greater collaboration &amp; community involvement. https:\/\/github.com\/PowerShell\/PSScriptAnalyzer&nbsp; Also, we have published v1.0 of ScriptAnalyzer to PSGallery. https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/&nbsp; Here are the significant changes in this release:&nbsp; Features: &#8220;Recursive&#8221; switch to analyze a folderpath [&hellip;]<\/p>\n","protected":false},"author":600,"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-1201","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-psscriptanalyzer"],"acf":[],"blog_post_summary":"<p>With the release of Windows Management Framework 5.0 April Preview, we are excited to announce that PowerShell ScriptAnalyzer development has moved to GitHub for greater collaboration &amp; community involvement. https:\/\/github.com\/PowerShell\/PSScriptAnalyzer&nbsp; Also, we have published v1.0 of ScriptAnalyzer to PSGallery. https:\/\/www.powershellgallery.com\/packages\/PSScriptAnalyzer\/&nbsp; Here are the significant changes in this release:&nbsp; Features: &#8220;Recursive&#8221; switch to analyze a folderpath [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1201","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\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=1201"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1201\/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=1201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=1201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=1201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}