1 | # Contributor Guidelines |
---|
2 | |
---|
3 | Implementation-wise, the following things should be avoided as much as possible: |
---|
4 | |
---|
5 | * public mutable state |
---|
6 | * global state |
---|
7 | * implicit conversions |
---|
8 | * threadLocal |
---|
9 | * locks |
---|
10 | * casting |
---|
11 | * introducing new, heavy external dependencies |
---|
12 | |
---|
13 | ## API design |
---|
14 | |
---|
15 | * Play is a Java and Scala framework, make sure your changes are working for both API-s |
---|
16 | * Java APIs should go to ```framework/play/src/main/java```, package structure is ```play.myapipackage.xxxx``` |
---|
17 | * Scala APIs should go to ```framework/play/src/main/scala```, where the package structure is ```play.api.myapipackage``` |
---|
18 | * Java and Scala APIs should be implemented the following way: |
---|
19 | * implement the core API in scala (```play.api.xxx```) |
---|
20 | * if your component requires life cycle management or needs to be swappable, create a plugin, otherwise skip this step |
---|
21 | * 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)) |
---|
22 | * wrap scala API for java users ([example](https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/java/play/cache/Cache.java)) |
---|
23 | * features are forever, always think about whether a new feature really belongs to the core framework or it should be implemented as a plugin |
---|
24 | * if you are in doubt, ask on the mailing list |
---|
25 | |
---|
26 | |
---|
27 | ## Testing and documentation |
---|
28 | |
---|
29 | * each and every public facing method and class need to have a corresponding scaladoc or javadoc with examples, description etc. |
---|
30 | * each feature and bug fix requires either a functional test (```framework/integrationtest```) or a spec (```/play/src/test```) |
---|
31 | * run Play's integration test suite ```framework/runtests``` before pushing. If a test fails, fix it, do not ignore it. |
---|
32 | |
---|
33 | ## source format |
---|
34 | |
---|
35 | * run scalariform-format before commit |
---|
36 | |
---|
37 | ## git commits |
---|
38 | |
---|
39 | * prefer rebase |
---|
40 | * bigger changesets |
---|