One of the most common questions from the Puppet community is, "What's the best way to write a module/class/resource? What style does Puppet Labs use when they write manifests?" So internally we all got together and decided to write the definitive Puppet Style Guide
. To do this we gathered the experience from the Professional Services, Operations, and Product teams and hashed out our individual styles, preferences, and ideas into a single document. (This sounds much more professional than it actually was... in reality, we locked the teams in a conference room with spiked clubs and let them have at it, Thunderdome-style. Many styles enter. One style leaves.)
The new style guide
covers visual style and form as well as approaches for creating resources, classes and modules. It also includes advice on best practices and useful tips and tricks. The guide is primarily aimed at people using Puppet 2.6.x and later—although the guide describes some solutions and techniques that rely on new syntax introduced in the 2.6.0 release, it also has material that is relevant to people using earlier releases of Puppet.
Our Style Guide is a work in progress and we'll be updating it as new features and syntax are added or as changes are made to how Puppet operates. We'll also be using the Style Guide when updating and adding new modules to the Puppet Forge
so you'll be able to see the new styles reflected in modules we release and maintain.
If you have feedback or suggestions we'd love to hear from you about it, or you can log a ticket here