Difference between revisions of "Puppet/Coding style"
< Puppet
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
+ | |||
+ | |||
+ | == Before coding == | ||
Noteː this document is work in progress and the content with evolve. Any contribution is welcome though ;-) | Noteː this document is work in progress and the content with evolve. Any contribution is welcome though ;-) | ||
− | |||
* Read this page | * Read this page | ||
* Make sure that what you're going to code is not already work in progress | * Make sure that what you're going to code is not already work in progress |
Revision as of 20:42, 16 September 2015
Contents
Before coding
Noteː this document is work in progress and the content with evolve. Any contribution is welcome though ;-)
- Read this page
- Make sure that what you're going to code is not already work in progress
- Make sure you're familiar with Puppet Syntax, Lint, Rspec, and Beaker
- If you want to create a new module, read Puppet/New_module
Best practices
Deprecation
Any patch must be backward compatible.
It meansː
- do not break the interface (deprecate parameters for at least one cycle, and add a warning for our users)
- do not change default parameters (except if you have a good reason but your commit message must explain it)
Commit message
Please read GitCommitMessages.
Consistency
We have a lot of modules to maintain, please keep our code consistent. Before adding new parameters or new classes, see if other modules already implement them and keep consistent.
Testing
Your code needs to be tested. Puppet OpenStack CI will verify for you, but if you want to save time, you better to run tests locally before sending a patchː
Documentation
- Validate all parameters are documented. They are required and lint will check it.
- If possible, keep examples/*.pp updated, they are very useful for our users.
- Comment your code when needed (temporary workarounds, TODO, etc).
Asking for review
Different ways to get reviewsː
- Go on IRC #puppet-openstack (freenode) and gently ask for reviews. If you need to discuss about already reviewed code, you can ping the reviewers.
- Add your patch on the Puppet OpenStack meeting Agenda (in Open Discussion section).
- Use Mailing list.