|
| 1 | +# Contributing to Web-APIs |
| 2 | + |
| 3 | + You can contribute to this project by raising issues and/or sending `git` pull |
| 4 | +requests. |
| 5 | + |
| 6 | +<br/> |
| 7 | + |
| 8 | +## Report issues |
| 9 | + |
| 10 | + If you find any issue with the software or want to ask for an enhancement, use |
| 11 | +the Github's [issue tracker](https://github.com/css4j/web-apis/issues). |
| 12 | + |
| 13 | +<br/> |
| 14 | + |
| 15 | +## Pull requests |
| 16 | + |
| 17 | + To contribute code to this project it is recommended to open an issue first, |
| 18 | +explaining the rationale for the changes that you want to implement. Then, in |
| 19 | +the title of the pull request (PR) you can include a reference like "fixes #NN" |
| 20 | +where NN is the issue number. And it is generally a good idea to base your PR on |
| 21 | +a branch that was named after the issue; for example your branch could be named |
| 22 | +`issue-14`. |
| 23 | + |
| 24 | + A PR should only try to fix a single issue, unless it fixes two or more issues |
| 25 | +that are very related or effectively the same. And if a commit has two or more |
| 26 | +different purposes, it is often better to split it in multiple commits; tools |
| 27 | +like the _Git GUI_ are particularly useful for that. |
| 28 | + |
| 29 | +<br/> |
| 30 | + |
| 31 | +### Commit messages |
| 32 | + |
| 33 | + It is recommended that commit messages (or at least the message for the main |
| 34 | +commit) start with a prefix related to the API being affected. For example: |
| 35 | +``` |
| 36 | +smil: change return type of function. Fixes #2. |
| 37 | +``` |
| 38 | +If the commit has a wider scope than a single area, you do not need to include |
| 39 | +any prefix, for example: |
| 40 | +``` |
| 41 | +Add .gitattributes file. |
| 42 | +``` |
| 43 | + The commit should focus on a specific task, and its descriptive message should |
| 44 | +tell accurately what the commit does. For example, do not mix bug fixes with |
| 45 | +arbitrary clean-ups, unless the clean-up is part of the fix. |
| 46 | + |
| 47 | + Although it is acceptable to include a small, unrelated code formatting fix |
| 48 | +inside a bug-fixing commit (like a small indentation fix in the same file), if |
| 49 | +the commit contains several formatting changes they should be split to a |
| 50 | +different commit. That eases the task of future code reviewers. |
| 51 | + |
| 52 | +<br/> |
| 53 | + |
| 54 | +### Code style |
| 55 | + |
| 56 | + The code style could be summarized by the following points: |
| 57 | + |
| 58 | +- Indent by tabs, not spaces. The automated formatting provided by the Eclipse |
| 59 | +IDE is often used. |
| 60 | +- Avoid trailing whitespace except for empty lines in Javadoc comments. |
| 61 | +- `if`-`else` blocks should always use curly braces, even if a single line of |
| 62 | +code is involved. |
| 63 | +- Long, descriptive variable names are preferred. |
| 64 | +- Add comments to explain what the code is trying to do, but avoiding useless |
| 65 | +prose that just mimics the code, like _"check if foo is larger than 1"_ as a |
| 66 | +comment to `if (foo > 1)`. |
| 67 | +- Public and protected methods must have documentation comments. |
| 68 | +- Code readability should not be sacrificed for compactness, unless there are |
| 69 | +obvious gains and the trade-off can be justified. For example, `i++; foo(i);` is |
| 70 | +preferable to `foo(++i);` except in conditional expressions. |
| 71 | +- Classes and methods should have the minimum visibility that they require. |
| 72 | +A method should not have `protected` visibility when being package-visible could |
| 73 | +be enough, unless subclasses in other packages would naturally extend it. For |
| 74 | +complex package-level or inner classes, it is acceptable to have `protected` |
| 75 | +methods as a mean to document which ones are intended to be overridden by other |
| 76 | +classes. (In that case, protected methods do not appear in the Javadocs and |
| 77 | +therefore are not part of the API) |
| 78 | + |
| 79 | +<br/> |
| 80 | + |
| 81 | +### Licensing |
| 82 | + |
| 83 | + All your contributions are submitted according to the license of this project, |
| 84 | +see the LICENSE file for more information. |
| 85 | + |
| 86 | +## Distribution |
| 87 | + |
| 88 | + This project [is not being submitted to the Maven Central repository](https://groups.google.com/g/css4j/c/op5jIoINb3M/m/IiiN-LfkDAAJ) |
| 89 | +and this is something known to deter some contributors, thus being a relevant |
| 90 | +information to cover here. |
| 91 | + |
| 92 | + However, the project distributes its artifacts through the css4j Maven |
| 93 | +repository, as explained in the [README](README.md) (see 'Usage from a Gradle |
| 94 | +project'). Please use that repository **only** for the artifact groups that it |
| 95 | +supplies. |
0 commit comments