| 1 |
Submitting patches |
| 2 |
================== |
| 3 |
|
| 4 |
* Always make a new branch for your work. |
| 5 |
* Patches should be small to facilitate easier review. `Studies have shown`_ |
| 6 |
that review quality falls off as patch size grows. Sometimes this will result |
| 7 |
in many small PRs to land a single large feature. |
| 8 |
* Larger changes should be discussed in a ticket before submission. |
| 9 |
* New features and significant bug fixes should be documented in the |
| 10 |
:doc:`/changelog`. |
| 11 |
* You must have legal permission to distribute any code you contribute and it |
| 12 |
must be available under both the BSD and Apache Software License Version 2.0 |
| 13 |
licenses. |
| 14 |
|
| 15 |
If you believe you've identified a security issue in packaging, please |
| 16 |
follow the directions on the :doc:`security page </security>`. |
| 17 |
|
| 18 |
Code |
| 19 |
---- |
| 20 |
|
| 21 |
This project's source is auto-formatted with |black|. You can check if your |
| 22 |
code meets our requirements by running our linters against it with ``nox -s |
| 23 |
lint`` or ``pre-commit run --all-files``. |
| 24 |
|
| 25 |
`Write comments as complete sentences.`_ |
| 26 |
|
| 27 |
Every code file must start with the boilerplate licensing notice: |
| 28 |
|
| 29 |
.. code-block:: python |
| 30 |
|
| 31 |
# This file is dual licensed under the terms of the Apache License, Version |
| 32 |
# 2.0, and the BSD License. See the LICENSE file in the root of this repository |
| 33 |
# for complete details. |
| 34 |
|
| 35 |
Tests |
| 36 |
----- |
| 37 |
|
| 38 |
All code changes must be accompanied by unit tests with 100% code coverage (as |
| 39 |
measured by the combined metrics across our build matrix). |
| 40 |
|
| 41 |
|
| 42 |
Documentation |
| 43 |
------------- |
| 44 |
|
| 45 |
All features should be documented with prose in the ``docs`` section. |
| 46 |
|
| 47 |
When referring to a hypothetical individual (such as "a person receiving an |
| 48 |
encrypted message") use gender neutral pronouns (they/them/their). |
| 49 |
|
| 50 |
Docstrings are typically only used when writing abstract classes, but should |
| 51 |
be written like this if required: |
| 52 |
|
| 53 |
.. code-block:: python |
| 54 |
|
| 55 |
def some_function(some_arg): |
| 56 |
""" |
| 57 |
Does some things. |
| 58 |
|
| 59 |
:param some_arg: Some argument. |
| 60 |
""" |
| 61 |
|
| 62 |
So, specifically: |
| 63 |
|
| 64 |
* Always use three double quotes. |
| 65 |
* Put the three double quotes on their own line. |
| 66 |
* No blank line at the end. |
| 67 |
* Use Sphinx parameter/attribute documentation `syntax`_. |
| 68 |
|
| 69 |
|
| 70 |
.. |black| replace:: ``black`` |
| 71 |
.. _black: https://pypi.org/project/black/ |
| 72 |
.. _`Write comments as complete sentences.`: https://nedbatchelder.com/blog/201401/comments_should_be_sentences.html |
| 73 |
.. _`syntax`: http://sphinx-doc.org/domains.html#info-field-lists |
| 74 |
.. _`Studies have shown`: http://www.ibm.com/developerworks/rational/library/11-proven-practices-for-peer-review/ |