|
2 | 2 |
|
3 | 3 | Thank you for contributing to Bouncy Castle! |
4 | 4 |
|
5 | | -In this guide, you get an overview of the contribution workflow from starting a discussion or opening an issue, to creating, reviewing, and merging a pull request. |
| 5 | +In this guide, you get an overview of the contribution workflow from starting a discussion or opening an issue, to |
| 6 | +creating, reviewing, and merging a pull request. |
6 | 7 |
|
7 | | -For an overview of the project, see [README](README.md). |
| 8 | +For an overview of the project, see [README](README.md). |
8 | 9 |
|
9 | 10 | ## Start a discussion |
10 | | -If you have a question or problem, you can [search in discussions](https://github.com/bcgit/bc-rust/discussions), if someone has already found a solution to your problem. |
11 | 11 |
|
12 | | -Or you can [start a new discussion](https://github.com/bcgit/bc-rust/discussions/new/choose) and ask your question. |
| 12 | +If you have a question or problem, you can [search in discussions](https://github.com/bcgit/bc-rust/discussions), if |
| 13 | +someone has already found a solution to your problem. |
| 14 | + |
| 15 | +Or you can [start a new discussion](https://github.com/bcgit/bc-rust/discussions/new/choose) and ask your question. |
13 | 16 |
|
14 | 17 | ## Create an issue |
15 | 18 |
|
16 | 19 | If you find a problem with Bouncy Castle, [search if an issue already exists](https://github.com/bcgit/bc-rust/issues). |
17 | 20 |
|
18 | 21 | > **_NOTE:_** If the issue is a __potential security problem__, please contact us |
19 | | -before posting anything public. See [Security Policy](SECURITY.md). |
| 22 | +> before posting anything public. See [Security Policy](SECURITY.md). |
20 | 23 |
|
21 | | -If a related discussion or issue doesn't exist, and the issue is not security related, you can [open a new issue](https://github.com/bcgit/bc-java/issues/new). An issue can be converted into a discussion if regarded as one. |
| 24 | +If a related discussion or issue doesn't exist, and the issue is not security related, you |
| 25 | +can [open a new issue](https://github.com/bcgit/bc-java/issues/new). An issue can be converted into a discussion if |
| 26 | +regarded as one. |
22 | 27 |
|
23 | 28 | ## Coding philosophy |
24 | 29 |
|
25 | 30 | > Slow is smooth, smooth is fast. |
26 | 31 |
|
27 | | -There is a time and a place for "Move fast and break things", but the source code of a crypto library is not one of them. |
| 32 | +There is a time and a place for "Move fast and break things", but the source code of a crypto library is not one of |
| 33 | +them. |
28 | 34 |
|
29 | | -This project takes the philosophy that taking the time to do things right pays off in the long run, both in terms of |
30 | | -the runtime and memory footprint of the code, and it terms of the time required for a future maintainer to get up to speed with the code |
| 35 | +This project takes the philosophy that taking the time to do things right pays off in the long run, both in terms of |
| 36 | +the runtime and memory footprint of the code, and it terms of the time required for a future maintainer to get up to |
| 37 | +speed with the code |
31 | 38 | and avoid introducing bugs due to the code being hard to understand. |
32 | 39 |
|
33 | 40 | Some specifics: |
34 | 41 |
|
35 | | -* Respect that the innovative process sometimes requires exploring several dead-ends before you find the most elegant solution. |
36 | | -* Public APIs of a library should be both ergonomic and expressive. When defining a new trait or public function, ask yourself whether a programmer who is new to cryptography is likely to use this in a way that will get them into trouble. |
37 | | -* Variables should be well-named, well-structured, and well-commented (a comment-to-code ration of 1:1 is a goal to be strived for!). Think about memory footprint and, where possible, use unnamed scopes to allow the compiler to pop intermediate value variables off the stack as soon as they are no longer needed. |
38 | | -* Always run your code through `cargo mutants` and get the issue count as low as your can. As a first pass, this forces you to write thorough unit tests. As a second pass, this draws your attention to bits of your code that cannot be tested from the outside. Often this means that the code can be simplified without affecting functionality (as defined by your set of unit tests) -- "simpler code" usually means faster runtime and easier future maintenance. |
| 42 | +* Respect that the innovative process sometimes requires exploring several dead-ends before you find the most elegant |
| 43 | + solution. |
| 44 | +* Public APIs of a library should be both ergonomic and expressive. When defining a new trait or public function, ask |
| 45 | + yourself whether a programmer who is new to cryptography is likely to use this in a way that will get them into |
| 46 | + trouble. |
| 47 | +* Variables should be well-named, well-structured, and well-commented (a comment-to-code ration of 1:1 is a goal to be |
| 48 | + strived for!). Think about memory footprint and, where possible, use unnamed scopes to allow the compiler to pop |
| 49 | + intermediate value variables off the stack as soon as they are no longer needed. |
| 50 | +* Always run your code through `cargo mutants` and get the issue count as low as your can. As a first pass, this forces |
| 51 | + you to write thorough unit tests. As a second pass, this draws your attention to bits of your code that cannot be |
| 52 | + tested from the outside. Often this means that the code can be simplified without affecting functionality (as defined |
| 53 | + by your set of unit tests) -- "simpler code" usually means faster runtime and easier future maintenance. |
39 | 54 |
|
40 | 55 | ## Contribute to the code |
41 | 56 |
|
42 | | -For substantial, non-trivial contributions, you may be asked to sign a contributor assignment agreement. Optionally, you can also have your name and contact information listed in [Contributors](https://www.bouncycastle.org/contributors.html). |
| 57 | +For substantial, non-trivial contributions, you may be asked to sign a contributor assignment agreement. Optionally, you |
| 58 | +can also have your name and contact information listed |
| 59 | +in [Contributors](https://www.bouncycastle.org/contributors.html). |
43 | 60 |
|
44 | | -Please note we are unable to accept contributions which cannot be released under the [Bouncy Castle License](https://www.bouncycastle.org/licence.html). Issuing a pull request on our public github mirror is taken as agreement to issuing under the Bouncy Castle License. |
| 61 | +Please note we are unable to accept contributions which cannot be released under |
| 62 | +the [Bouncy Castle License](https://www.bouncycastle.org/licence.html). Issuing a pull request on our public github |
| 63 | +mirror is taken as agreement to issuing under the Bouncy Castle License. |
45 | 64 |
|
46 | 65 | ### Create a pull request |
47 | 66 |
|
48 | 67 | > **_NOTE:_** If the issue is a __potential security problem__, please contact us. See [Security Policy](SECURITY.md). |
49 | 68 |
|
50 | | -You are welcome to send patches, under the Bouncy Castle License, as pull requests. For more information, see [Creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). For minor updates, you can instead choose to create an issue with short snippets of code. See above. |
| 69 | +You are welcome to send patches, under the Bouncy Castle License, as pull requests. For more information, |
| 70 | +see [Creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). |
| 71 | +For minor updates, you can instead choose to create an issue with short snippets of code. See above. |
51 | 72 |
|
52 | | -* For contributions touching multiple files try and split up the pull request, smaller changes are easier to review and test, as well as being less likely to run into merge issues. |
53 | | -* Create a test cases for your change, it may be a simple addition to an existing test. If you do not know how to do this, ask us and we will help you. |
54 | | -* If you run into any merge issues, check out this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues. |
| 73 | +* For contributions touching multiple files try and split up the pull request, smaller changes are easier to review and |
| 74 | + test, as well as being less likely to run into merge issues. |
| 75 | +* Create a test cases for your change, it may be a simple addition to an existing test. If you do not know how to do |
| 76 | + this, ask us and we will help you. |
| 77 | +* If you run into any merge issues, check out this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to |
| 78 | + help you resolve merge conflicts and other issues. |
55 | 79 |
|
56 | | -For more information, refer to the Bouncy Castle documentation on [Getting Started with Bouncy Castle](https://doc.primekey.com/bouncycastle/introduction#Introduction-GettingStartedwithBouncyCastle). |
| 80 | +For more information, refer to the Bouncy Castle documentation |
| 81 | +on [Getting Started with Bouncy Castle](https://doc.primekey.com/bouncycastle/introduction#Introduction-GettingStartedwithBouncyCastle). |
57 | 82 |
|
58 | 83 | ### Quality Standards |
| 84 | + |
59 | 85 | Except where otherwise noted, all crates must have: |
60 | 86 |
|
61 | 87 | * benchmarks |
62 | 88 | * unit tests that (mostly) satisfy cargo mutants |
63 | 89 | * lib.rs needs to compile with: #![forbid(missing_docs)], #![no_std] |
64 | | -* Fallibility: as much as humanly possible, Result and unwrap() should be used for "Bad input data" type things and not "Programmer didn't read the docs" type things. Things like \[u8]'s of the wrong length, or trying to call an algorithm with a key of the wrong parameter set should be detected at compile time via the typing system and should not require a Result / unwrap() mechanism. Please run `./dev_scripts/quality_stats.sh` before and after your change to see if you have increased the fallibility of the code you changed. |
| 90 | +* Fallibility: as much as humanly possible, Result and unwrap() should be used for "Bad input data" type things and |
| 91 | + not "Programmer didn't read the docs" type things. Things like \[u8]'s of the wrong length, or trying to call an |
| 92 | + algorithm with a key of the wrong parameter set should be detected at compile time via the typing system and should |
| 93 | + not require a Result / unwrap() mechanism. Please run `./dev_scripts/quality_stats.sh` before and after your change to |
| 94 | + see if you have increased the fallibility of the code you changed. |
65 | 95 |
|
66 | | -Code submissions that do not meet these standards, or that require significant effort from the maintainers in order to meet these standards, will not be accepted. |
| 96 | +Code submissions that do not meet these standards, or that require significant effort from the maintainers in order to |
| 97 | +meet these standards, will not be accepted. |
67 | 98 |
|
68 | 99 | ### Self-review |
69 | 100 |
|
70 | 101 | Don't forget to self-review. Please follow these simple guidelines: |
71 | | -* Keep the patch limited, only change the parts related to your patch. |
72 | | -* Do not change other lines, such as whitespace, adding line breaks to Java doc, etc. It will make it very hard for us to review the patch. |
| 102 | + |
| 103 | +* Keep the patch limited, only change the parts related to your patch. |
| 104 | +* Do not change other lines, such as whitespace, adding line breaks to Java doc, etc. It will make it very hard for us |
| 105 | + to review the patch. |
73 | 106 |
|
74 | 107 | #### Your pull request is merged |
75 | 108 |
|
76 | | -Someone on the Bouncy Castle core team will review the pull request when there is time, and let you know if something is missing or suggest improvements. If it is a useful and generic feature it will be integrated in Bouncy Castle to be available in a later release. |
| 109 | +Someone on the Bouncy Castle core team will review the pull request when there is time, and let you know if something is |
| 110 | +missing or suggest improvements. If it is a useful and generic feature it will be integrated in Bouncy Castle to be |
| 111 | +available in a later release. |
| 112 | + |
| 113 | +## AI Policy |
77 | 114 |
|
| 115 | +LLM-based coding assistants are a great tool, but, especially for a cryptography library, they must be used under the |
| 116 | +strict supervision of a human who takes responsibility for the submitted code, code review process, and for asserting |
| 117 | +that the submission does not include copyrighted material and is assignable to the Legion of the Bouncy Castle. |
| 118 | +Contributions not clearly from a human will be rejected. |
0 commit comments