This is the process for committing code into master. There are of course exceptions to these rules, for example minor changes to comments and documentation, fixing a broken build etc.
- Make sure you have signed the Typesafe CLA, if not, sign it online.
- Before starting to work on a feature or a fix, you have to make sure that:
- There is a ticket for your work in the project's issue tracker. If not, create it first (See: https://play.lighthouseapp.com/projects/82401-play-20/overview).
- The ticket has been scheduled for the current milestone.
- The ticket is estimated by the team.
- The ticket have been discussed and prioritized by the team.
- You should always perform your work in a Git feature branch. The branch should be given a descriptive name that explains its intent.
- When the feature or fix is completed you should open a Pull Request on GitHub.
- The Pull Request should be reviewed by other maintainers (as many as feasible/practical). Note that the maintainers can consist of outside contributors, both within and outside the Play team. Outside contributors are encouraged to participate in the review process, it is not a closed process.
- After the review you should fix the issues as needed (pushing a new commit for new review etc.), iterating until the reviewers give their thumbs up.
- Once the code has passed review the Pull Request can be merged into the master branch.
To discuss features, proposal and pull-requests, use the dedicated group at https://groups.google.com/forum/#!forum/play-framework-dev.
For a Pull Request to be considered at all it has to meet these requirements:
- Live up to the current code standard:
- Not violate DRY.
- Boy Scout Rule needs to have been applied.
- Regardless if the code introduces new features or fixes bugs or regressions, it must have comprehensive tests.
- The code must be well documented in the Play standard documentation format (see the ‘Documentation’ section below). Each API change must have the corresponding documentation change.
- Implementation-wise, the following things should be avoided as much as possible:
- Global state
- Public mutable state
- Implicit conversions
- ThreadLocal
- Locks
- Casting
- Introducing new, heavy external dependencies
- The Play API design rules are the following:
- Play is a Java and Scala framework, make sure your changes are working for both API-s
- Java APIs should go to
framework/play/src/main/java
, package structure isplay.myapipackage.xxxx
- Scala APIs should go to
framework/play/src/main/scala
, where the package structure isplay.api.myapipackage
- Java and Scala APIs should be implemented the following way:
- implement the core API in scala (
play.api.xxx
) - if your component requires life cycle management or needs to be swappable, create a plugin, otherwise skip this step
- wrap core API for scala users ([example] (https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/api/cache/Cache.scala#L69))
- wrap scala API for java users (example)
- implement the core API in scala (
- Features are forever, always think about whether a new feature really belongs to the core framework or it should be implemented as a plugin
If these requirements are not met then the code should not be merged into master, or even reviewed - regardless of how good or important it is. No exceptions.
The documentation live as markdown pages into the documentation/manual
directory. Each Play branch has it own documentation version.
It is ok to work on a public feature branch in the GitHub repository. Something that can sometimes be useful for early feedback etc. If so then it is preferable to name the branch accordingly. This can be done by either prefix the name with wip-
as in ‘Work In Progress’, or use hierarchical names like wip/..
, feature/..
or topic/..
. Either way is fine as long as it is clear that it is work in progress and not ready for merge. This work can temporarily have a lower standard. However, to be merged into master it will have to go through the regular process outlined above, with Pull Request, review etc..
Also, to facilitate both well-formed commits and working together, the wip
and feature
/topic
identifiers also have special meaning. Any branch labelled with wip
is considered “git-unstable” and may be rebased and have its history rewritten. Any branch with feature
/topic
in the name is considered “stable” enough for others to depend on when a group is working on a feature.
Follow these guidelines when creating public commits and writing commit messages.
- If your work spans multiple local commits (for example; if you do safe point commits while working in a feature branch or work in a branch for long time doing merges/rebases etc.) then please do not commit it all but rewrite the history by squashing the commits into a single big commit which you write a good commit message for (like discussed in the following sections). For more info read this article: Git Workflow. Every commit should be able to be used in isolation, cherry picked etc.
- First line should be a descriptive sentence what the commit is doing. It should be possible to fully understand what the commit does by just reading this single line. It is not ok to only list the ticket number, type "minor fix" or similar. Include reference to ticket number, prefixed with #, at the end of the first line. If the commit is a small fix, then you are done. If not, go to 3.
- Following the single line description should be a blank line followed by an enumerated list with the details of the commit.
- Add keywords for your commit (depending on the degree of automation we reach, the list may change over time):
Review by @gituser
- if you want to notify someone on the team. The others can, and are encouraged to participate.Fix/Fixing/Fixes/Close/Closing/Refs #ticket
- if you want to mark the ticket as fixed in the issue tracker (Assembla understands this).backport to _branch name_
- if the fix needs to be cherry-picked to another branch (like 2.9.x, 2.10.x, etc)
Example:
Adding monadic API to Future. Fixes #2731
* Details 1
* Details 2
* Details 3