diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cfa95b02..6914fa00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,11 +17,39 @@ packages: - '/path/to/this/repo/yesod-auth' ``` -## Testing +## Coding Guidelines -Tests are appreciated, but not required, for changes to Yesod. +### Safety -## Documentation +Avoid partial functions. Even if you know the partial function is safe in your instance, partial functions require more reasoning from the programmer and are not resilient to refactoring. For the rare cases where a partial function is appropriate, a custom `error` should be used. + +### Style + +Keep coding style consistent with the rest of the file, but don't worry about style too much otherwise. PRs changing code style are viewed skeptically. + +### Dependencies + +Avoid adding unnecessary dependencies. If a dependency provides only a minor convenience for your implementation, it's probably better to skip it. + +If you do add a new dependency, try to support a wide range of versions of it. + +### Backwards Compatibility + +Backwards incompatible changes are viewed skeptically—best to ask in an issue to see if a particular backwards incompatible change would be approved. If possible keep backwards compatibility by adding new APIs and deprecating old ones. + +Keep backwards compatibility with old versions of dependencies when possible. + +## PR Guidelines + +### PR Scope + +As much as possible, keep separate changes in separate PRs. + +### Testing + +Tests are recommended, but not required. + +### Documentation All public APIs must be documented. Documenting private functions is optional, but may be nice depending on their complexity. Example documentation: @@ -38,21 +66,29 @@ addToken_ :: Query -- ^ CSS selector that resolves to the @