PSScriptAnalyzer - Built in functions

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
bmclain
Posts: 39
Joined: Mon Oct 22, 2007 1:47 am

PSScriptAnalyzer - Built in functions

Post by bmclain » Mon Jul 25, 2016 7:23 am

Product, version and build: Powershell Studio 2016 - Version: 5.2.124
32 or 64 bit version of product: 64
Operating system: Windows 10
32 or 64 bit OS: 64
PowerShell Version: 5.1 Build 14393

We are using PSScriptAnalyzer on all our scripts and are working to get them error and warning free. We have noticed there are numerous warnings (PSUseApprovedVerbs, PSAvoidUsingEmptyCatchBlock) that get generated from the integrated code. Looks like you ignore those with your builtin integration, but we are getting our scripts scanned during check-in by our Jenkins server. Is there a plan to get these corrected?

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: PSScriptAnalyzer - Built in functions

Post by davidc » Mon Jul 25, 2016 8:33 am

Yes, we are aware the PSScriptAnalyzer warnings and are reviewing if they warrant any changes. The pre-generated code predates PSScriptAnalyzer and we are careful about making any major changes because of compatibility issues that may occur.

Something to keep in mind: Just because you get a PSScriptAnaylzer warning, it doesn't necessarily mean your script is incorrect. The warnings are often suggestions that are applied generally, but there are exceptions where the use is warranted. You will have to decide on a case by case basis.
David
SAPIEN Technologies, Inc.

User avatar
bmclain
Posts: 39
Joined: Mon Oct 22, 2007 1:47 am

Re: PSScriptAnalyzer - Built in functions

Post by bmclain » Mon Jul 25, 2016 11:41 am

I know it's not incorrect code, it's just not following best practice. We have some pretty stringent requirements around our scripts and don't want to have to keep manually updating the exported script each time. We can get around most of it, but the calls to the forms are something we haven't been able to address any other way.