| 1 | Contributing |
| 2 | ============ |
| 3 | |
| 4 | We appreciate your contributions! Because this is an open source project, we want to keep it as easy |
| 5 | as possible to contribute changes. However, we need contributors to follow a few guidelines. |
| 6 | |
| 7 | By contributing to pyOCD you agree to the [Code of Conduct](CODE_OF_CONDUCT.md). |
| 8 | |
| 9 | |
| 10 | ## Coding style |
| 11 | |
| 12 | Contributed source code must follow [PEP8](https://www.python.org/dev/peps/pep-0008/) style |
| 13 | conventions. |
| 14 | |
| 15 | Significant new code must use type annotations. However, until the bulk of pyOCD code is converted to have type |
| 16 | annotations, static type checking isn't actual performed by CI. Also, it is perfectly ok to fix bugs without annotating |
| 17 | the errant module. |
| 18 | |
| 19 | Other formatting requirements: |
| 20 | - 4 space indents, no tabs are allowed. |
| 21 | - No trailing whitespace. |
| 22 | - All source files must end with a newline (an empty line at the end). |
| 23 | - Lines should generally not be longer than 120 characters, though this is not a hard rule. Overall readability |
| 24 | is more important. |
| 25 | |
| 26 | |
| 27 | ## Process |
| 28 | |
| 29 | Before you submit your changes, please ensure that: |
| 30 | |
| 31 | - The code meets style requirements listed above. |
| 32 | - You have added your copyright below existing copyrights in the files you modified. New files should have only |
| 33 | your copyright. See the License section below for more. |
| 34 | - Changes have been tested locally to the extent possible. (Obviously, we don't expect you to have as many |
| 35 | test boards as we do.) |
| 36 | |
| 37 | Please [create a new pull request](https://github.com/pyocd/pyOCD/pull/new/develop) on GitHub with your contribution. |
| 38 | The new pull request should target the `develop` branch. Before creating the pull request, please ensure that all tests |
| 39 | pass. We also run the tests on a wide range of boards for every pull request using our CI setup. Changes must pass all |
| 40 | required pull request checks before they can be accepted. |
| 41 | |
| 42 | The [developers' guide](docs/developers_guide.md) describes how to create your development |
| 43 | environment. The [automated tests guide](docs/automated_tests.md) provides information about the |
| 44 | available types of tests and describes how to run the tests. |
| 45 | |
| 46 | |
| 47 | ## License |
| 48 | |
| 49 | By creating a pull request on GitHub asking to merge your content into pyOCD, you agree to the [Developer Certificate of |
| 50 | Origin](https://developercertificate.org), stating that you have the right to grant license to your contribution under |
| 51 | the Apache 2.0 license. |
| 52 | |
| 53 | Copyright on contributions is retained by their author(s). Please add the author(s) copyright below existing copyrights |
| 54 | in the license header at the top of the contributed source file(s). If you are doing the work for your employer, you |
| 55 | should use your employer's copyright. If a file is newly added by you, it must contain the standard license header with |
| 56 | your copyright. Please note that we do not list changes in each source file by copyright owner, as this becomes a burden |
| 57 | to maintain. |
| 58 | |
| 59 | PyOCD follows the "inbound = outbound" licensing policy. This is [the default](https://docs.github.com/en/github/site-policy/github-terms-of-service#6-contributions-under-repository-license) for the GitHub Terms of Service. |
| 60 | |
| 61 | Contributing source code that is already licensed using a license other than Apache 2.0 is possible, but each |
| 62 | case must be considered individually. If you are the owner of the source code, then you have the right to |
| 63 | relicense to Apache 2.0. The most important thing is that the license is compatible with Apache 2.0. Examples |
| 64 | are MIT, the BSD licenses, and similar. GPL-licensed code is expressly disallowed to be contributed, as the |
| 65 | GPL is not compatible with Apache 2.0 (or any of the Apache-compatible licenses). |
| 66 | |
| 67 |