17
DEVOPS & AUTOMATION Use tools to create consistency in your scripts; an insiders’ guide Jeff Wouters | Methos

Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Use tools to create

consistency in your scripts; an insiders’ guide

Jeff Wouters | Methos

Page 2: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION

Jeff Wouters

CTO @ MethosMVP Cloud & Datacenter Management

MCT (PowerShell / DSC / Azure Automation)MSc | MBA | PhD

Page 3: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Agenda

• Plaster • VSCode• Pester• PSScriptAnalyzer• PSCodeHealth

Page 4: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Plaster

• Template-based file & project generator• Streamline module/test/dsc/… creation

• Yeoman for the PowerShell community

Page 5: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION VSCode

• PowerShell extension• Integration with PSScriptAnalyzer

Page 6: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Pester

• Unit testing• Operation Validation Framework (OVF)• Module Manifests

• …anything?

Page 7: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Pester

Synopsis = not Null or EmptyDescription = not Null or EmptyParameters descriptions = not Null or EmptyParam count in Help = count in ASTExamples count –gt 0Notes contain: Author, Company, Customer

Page 8: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION PSScriptAnalyzer

• Test for bad-practices.• Custom rules

• ...fix issues automatically?

Page 9: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION PSScriptAnalyzer

AvoidAliasAvoidUsingPlainTextForPasswordMisleadingBacktickMissingModuleManifestFieldUseToExportFieldsInManifest

Page 10: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION PSCodeHealth (Mathieu Buisson)

• Cyclomatic complexity* possible execution paths

Page 11: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION PSCodeHealth (Mathieu Buisson)

• Code length• Code complexity• Bad practices• Tests and test coverage• Comment-based help

• Code smells• Styling issues

Page 12: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION PSCodeHealth (Mathieu Buisson)

Page 13: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Metrics foreach function

• LinesOfCode• ScriptAnalyzerFindings• ContainsHelp• TestCoverage• CommandsMissed• Complexity

Page 14: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Metrics overall

Files (*.ps*1, excl tests)ComplexityAverageComplexityHighestFunctionsWithoutHelpLinesOfCode (Total/Avg.)PSSA (Total/Errors/Warnings/Info/Avg.)Tests (Failed/Passed/PassRate/Coverage

FunctionsNumberOfTestsCommandsMissedTotalNestingDepthAverageNestingDepthHighest

Page 15: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION

DEVOPS & AUTOMATION

Page 16: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION Do you want to gain more

knowledge about Microsoft technology?

The Future Ready Skills program offers online courseware, online labs, live Q&A’s and expert sessions, so you can acquire your official Microsoft Certificate in the most efficient way.

For more information:

aka.ms/frsblog

FUTURE READY SKILLS

Page 17: Use tools to create consistency in your scripts - an …...your official Microsoft Certificate in the most efficient way. For more information: aka.ms/frsblog FUTURE READY SKILLS DEVOPS

DEVOPS & AUTOMATION

No more sessions, only drinks! (and traffic...)