PSScriptAnalyzer - Built in functions

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
This topic is 7 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
bmclain
Posts: 39
Last visit: Fri Dec 03, 2021 7:36 am

PSScriptAnalyzer - Built in functions

Post by bmclain »

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
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: PSScriptAnalyzer - Built in functions

Post by davidc »

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
Last visit: Fri Dec 03, 2021 7:36 am

Re: PSScriptAnalyzer - Built in functions

Post by bmclain »

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.
This topic is 7 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.