My team wants to leverage this utility to ensure consistent coding practices for all of our custom commandlets. I was hoping to have a discussion and get some insight into how other teams and developers use PSScriptAnalyzer as part of their dev process.
Some questions to get this going:
I realize all teams and organizations are different, and one team's process isn't necessarily going to work for everyone, but I am interested in recommendations for what processes you find work well for yourself and your team.
This is a great question, one I am interested in following. As a newcomer to continuous delivery I have adopted PSScriptAnalyzer as part of my post build process. If warnings / errors are encountered it prevents the powershell module from being sent into its final destination (repository).
I add in ScriptAnalyzer into my Pester Tests - that way I know whether they are passing or not - throughout my test cycles and I can see where I have to spend time working on. I'm just about to publish a blog post on this with some sample code that can be run as well and will pop a link back in here as another response
@albvar How is your environment/project set up? Currently, our modules are built into various solutions based on their product type and functionality. I'm currently modifying the build process so that the script analyzer runs post-build, and the results are output to the console for the developer to see. This is just phase one to get something going.
Next up will be to process these results and do something with the output (fail the build, inform the dev, etc). Pester Tests seem like they might be the next logical place to go with this, so I would be really interested in reading @kilasuit's blog post as well.
As promised - blog post is here http://blog.kilasuit.org/2016/03/29/invoking-psscriptanalyzer-in-pester-tests-for-each-rule/
Most helpful comment
As promised - blog post is here http://blog.kilasuit.org/2016/03/29/invoking-psscriptanalyzer-in-pester-tests-for-each-rule/