|
| 1 | +# Contributing to xml-dtd |
| 2 | + |
| 3 | + You can contribute to the xml-dtd project by raising issues and/or sending `git` |
| 4 | +pull 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/xml-dtd/issues). |
| 12 | + |
| 13 | + Note that some issues may correspond to other subprojects, for example |
| 14 | +[carte-util issues](https://github.com/css4j/carte-util/issues). |
| 15 | + |
| 16 | +<br/> |
| 17 | + |
| 18 | +## Pull requests |
| 19 | + |
| 20 | + To contribute code to this project it is recommended to open an issue first, |
| 21 | +explaining the rationale for the changes that you want to implement. Then, in |
| 22 | +the title of the pull request (PR) you can include a reference like "fixes #NN" |
| 23 | +where NN is the issue number. And it is generally a good idea to base your PR on |
| 24 | +a branch that was named after the issue; for example your branch could be named |
| 25 | +`issue-14`. |
| 26 | + |
| 27 | + A PR should only try to fix a single issue, unless it fixes two or more issues |
| 28 | +that are very related or effectively the same. And if a commit has two or more |
| 29 | +different purposes, it is often better to split it in multiple commits; tools |
| 30 | +like the _Git GUI_ are particularly useful for that. |
| 31 | + |
| 32 | +<br/> |
| 33 | + |
| 34 | +### Tests |
| 35 | + |
| 36 | + All PRs should come with one or more JUnit tests unless the change is a small, |
| 37 | +obviously correct fix. Ideally, tests should provide a full coverage of the new |
| 38 | +code, except for cases like multiple equivalent comparisons, exceptions that are |
| 39 | +very hard to trigger or never thrown (or put as a theoretical safeguard), etc. |
| 40 | +However, even one test is better than nothing. |
| 41 | + |
| 42 | +1) For consistency, the names of classes that contain tests (i.e. with `@Test` |
| 43 | +annotation(s)) must end with `Test`. This makes easier to tell the actual tests |
| 44 | +apart from their helper classes. |
| 45 | + |
| 46 | +2) It is acceptable to mix tests and main source code in the same commit, as it |
| 47 | +is immediately obvious to the reviewers which are which, and the tests offer an |
| 48 | +insight of what the commit is trying to achieve. You do not need to mention the |
| 49 | +tests in the commit message. |
| 50 | + |
| 51 | +3) Tests should not involve remote network connections, unless the subject of |
| 52 | +that test is to check the connection or its security. It should be possible to |
| 53 | +disable those tests with the `TestConfig.REMOTE_TESTS` toggle. |
| 54 | + |
| 55 | +<br/> |
| 56 | + |
| 57 | +### Code style |
| 58 | + |
| 59 | + The code style could be summarized by the following points: |
| 60 | + |
| 61 | +- Indent by tabs, not spaces. The automated formatting provided by the Eclipse |
| 62 | +IDE is often used. |
| 63 | + |
| 64 | +- `if`-`else` blocks should always use curly braces, even if a single line of |
| 65 | +code is involved. |
| 66 | + |
| 67 | +- Long, descriptive variable names are preferred. |
| 68 | + |
| 69 | +- Add comments to explain what the code is trying to do, but avoiding useless |
| 70 | +prose that just mimics the code, like _"check if foo is larger than 1"_ as a |
| 71 | +comment to `if (foo > 1)`. |
| 72 | + |
| 73 | +- Public and protected methods must have documentation comments. |
| 74 | + |
| 75 | +- Avoid trailing whitespace except for empty lines in Javadoc comments. |
| 76 | + |
| 77 | +- Classes and methods should have the minimum visibility that they require. |
| 78 | +A method should not have `protected` visibility when being package-visible could |
| 79 | +be enough, unless subclasses in other packages would naturally extend it. For |
| 80 | +complex package-level or inner classes, it is acceptable to have `protected` |
| 81 | +methods as a mean to document which ones are intended to be overridden by other |
| 82 | +classes. (In that case, protected methods do not appear in the Javadocs and |
| 83 | +therefore are not part of the API) |
| 84 | + |
| 85 | +<br/> |
| 86 | + |
| 87 | +### Copyright and attribution |
| 88 | + |
| 89 | + All contributions are submitted under a [Developer Certificate of Origin](DeveloperCertificateOfOrigin.txt). |
| 90 | +Although every author maintains their copyright, in case that code from this |
| 91 | +project —including your contribution(s)— is used in a way that is deemed as a |
| 92 | +license infringement, you are —in principle— not opposed to be represented by |
| 93 | +the maintainer of this project in any legal proceedings intended to protect the |
| 94 | +license of this project. |
| 95 | + |
| 96 | + If you modify a source file that happens to have an `@author` tag with the |
| 97 | +author name, feel free to remove that field and let `git blame` handle the |
| 98 | +attribution. |
| 99 | + |
| 100 | + It is assumed that if you put an `@author` field with your name in a new file, |
| 101 | +the same criteria would apply. |
| 102 | + |
| 103 | +<br/> |
| 104 | + |
| 105 | +## Licensing |
| 106 | + |
| 107 | + Your contributions are to be submitted according to the licensing of this |
| 108 | +project, see the `LICENSE.txt` and `NOTICE.txt` files for more information. |
| 109 | + |
| 110 | +<br/> |
| 111 | + |
| 112 | +## Distribution |
| 113 | + |
| 114 | + This project [is not being submitted to the Maven Central repository](https://groups.google.com/g/css4j/c/op5jIoINb3M/m/IiiN-LfkDAAJ) |
| 115 | +and this is something known to deter some contributors, thus being a relevant |
| 116 | +information to put here. |
0 commit comments