|
| 1 | +<!-- |
| 2 | + SPDX-FileCopyrightText: None |
| 3 | + SPDX-License-Identifier: CC0-1.0 |
| 4 | +--> |
| 5 | +# Contributing to Nerves |
| 6 | + |
| 7 | +We're excited that you want to contribute to the Nerves project! |
| 8 | + |
| 9 | +First, we want the Nerves community to be welcoming and helpful to everyone. |
| 10 | +We expect all community members to follow our [Code of Conduct]. |
| 11 | + |
| 12 | +## Before you start |
| 13 | + |
| 14 | +- Check existing issues and pull requests before starting work |
| 15 | +- Discuss large changes before investing significant effort |
| 16 | +- Keep pull requests focused on a single problem |
| 17 | + |
| 18 | +In general, we review shorter PRs more quickly. If you find grammar, formatting, |
| 19 | +or spelling issues, please send them in their own PRs even if they seem trivial. |
| 20 | + |
| 21 | +When in doubt, we're happy to help. We're available on the [Nerves |
| 22 | +Discord] and it's fine to create a GitHub issue. |
| 23 | + |
| 24 | +## Development workflow |
| 25 | + |
| 26 | +- Fork the repository and create a branch for your change |
| 27 | +- Squash your commits to remove intermediate work |
| 28 | +- Update the documentation |
| 29 | +- Run `mix format`, `mix test`, and `mix credo` |
| 30 | + |
| 31 | +After opening a pull request, contributors are responsible for monitoring CI |
| 32 | +results and fixing any failures introduced by their changes. |
| 33 | + |
| 34 | +## Commit messages |
| 35 | + |
| 36 | +Write commit messages yourself. |
| 37 | + |
| 38 | +We consider Git history important, and the principles behind [Common Changelog] |
| 39 | +are a good guide for writing it. Describe the impact of a change rather than its |
| 40 | +implementation, and write titles that stand on their own away from the diff. We |
| 41 | +do not follow the specification strictly and we do not use conventional commit |
| 42 | +tags. |
| 43 | + |
| 44 | +Commit message titles should describe the change in 50 characters or fewer. Use |
| 45 | +sentence case and the imperative mood, as if finishing the sentence "This commit |
| 46 | +will...". |
| 47 | + |
| 48 | +Good commit messages briefly explain: |
| 49 | + |
| 50 | +- What changed |
| 51 | +- Why it changed |
| 52 | +- Any important constraints or tradeoffs |
| 53 | + |
| 54 | +Call out breaking changes in the commit body. |
| 55 | + |
| 56 | +Avoid boilerplate or excessively verbose generated commit messages. |
| 57 | + |
| 58 | +### Licensing and copyright assignment |
| 59 | + |
| 60 | +This project follows the [REUSE Specification]. |
| 61 | + |
| 62 | +When modifying a file, add your name and the current year to the copyright |
| 63 | +notices if not already present. Contributors only need to add themselves once |
| 64 | +per file. |
| 65 | + |
| 66 | +If this step is missed, copyright attribution will be added later using |
| 67 | +information from Git history. |
| 68 | + |
| 69 | +Unless explicitly agreed otherwise by the maintainers: |
| 70 | + |
| 71 | +- Source code contributions must be licensed under Apache-2.0 |
| 72 | +- Standalone documentation must be licensed under CC-BY-4.0 |
| 73 | +- Trivial configuration files must be licensed under CC0-1.0 |
| 74 | + |
| 75 | +By submitting a contribution, you agree to license your work under the terms |
| 76 | +applicable to the files you modify. |
| 77 | + |
| 78 | +Validate licensing and copyright changes by running `reuse lint`. |
| 79 | + |
| 80 | +## Pull requests |
| 81 | + |
| 82 | +Opening a pull request is a statement that the change is finished and that you |
| 83 | +understand it. Reviewers need to understand the problem, why it matters, and why |
| 84 | +you solved it this way. They will catch mistakes, but review is not where |
| 85 | +correctness gets established for the first time. The project maintains what it |
| 86 | +merges, so submit work you could still explain a year from now. |
| 87 | + |
| 88 | +Draft pull requests and branches are encouraged for anything earlier than that. |
| 89 | +Some ideas are easier to see in code than to describe, and a draft gives |
| 90 | +everyone something concrete to work from while the discussion continues in |
| 91 | +review comments or on Discord. |
| 92 | + |
| 93 | +Try to keep pull requests to one commit by squashing intermediate commits |
| 94 | +together. If you find that multiple commits are better, this is likely a sign |
| 95 | +that two pull requests should be made. We are happy to receive stacked PRs if |
| 96 | +the commits depend on each other. |
| 97 | + |
| 98 | +Use the commit title and content for the pull request. Add notes for reviewers |
| 99 | +to the pull request description, such as when a unit test was already failing |
| 100 | +before your change. |
| 101 | + |
| 102 | +Concise explanations are preferred over exhaustive summaries. |
| 103 | + |
| 104 | +## AI-assisted contributions |
| 105 | + |
| 106 | +Contributions are made by people, not tools. |
| 107 | + |
| 108 | +AI tools may be used to assist with development. Contributors are responsible |
| 109 | +for everything they submit and should be able to explain their changes during |
| 110 | +review. Review AI-generated code as carefully as you would review a stranger's, |
| 111 | +and confirm that it compiles, runs, and is tested before sending it. |
| 112 | + |
| 113 | +Pull request titles, descriptions, issue reports, commit messages, and review |
| 114 | +discussions should be written by the contributor. Using AI to translate or |
| 115 | +tighten your own writing is fine. Using it to write in your place is not. |
| 116 | +Follow the [Commit messages](#commit-messages) guidance as well, since Git |
| 117 | +history is what explains a change long after review ends. |
| 118 | + |
| 119 | +Do not submit lengthy AI-generated summaries, explanations, or code |
| 120 | +walkthroughs. Reviewers can chat with an LLM on their own time about your |
| 121 | +contributions, if they desire - it is more important that the submitter convey |
| 122 | +their own understanding in their own words. |
| 123 | + |
| 124 | +A few things that come up repeatedly in review: |
| 125 | + |
| 126 | +- Comment on an open issue before pointing a coding agent at it. |
| 127 | +- Keep the change focused. Delete unrelated refactoring, speculative |
| 128 | + abstractions, defensive error handling, and comments that restate the code. |
| 129 | +- Verify claims before making them. Unconfirmed bug reports, and especially |
| 130 | + unconfirmed security reports, cost maintainers a lot of time. |
| 131 | +- Don't reference functions, options, or behavior without checking that they |
| 132 | + exist. |
| 133 | +- Don't add AI tool configuration such as `AGENTS.md` or `CLAUDE.md` without |
| 134 | + asking first. |
| 135 | +- The licensing terms above apply to AI-assisted contributions. Only submit |
| 136 | + work that you have the right to license. |
| 137 | + |
| 138 | +Credit tools with an `Assisted-by` trailer: |
| 139 | + |
| 140 | +```text |
| 141 | +Assisted-by: AGENT_NAME:MODEL_VERSION |
| 142 | +``` |
| 143 | + |
| 144 | +For example: |
| 145 | + |
| 146 | +```text |
| 147 | +Assisted-by: Claude Code:claude-opus-5 |
| 148 | +``` |
| 149 | + |
| 150 | +Do not add `Signed-off-by` tags. Nerves does not use them. |
| 151 | + |
| 152 | +## Reporting bugs |
| 153 | + |
| 154 | +**Please do not report security vulnerabilities through public GitHub issues, pull requests, or discussions. See [SECURITY.md]** |
| 155 | + |
| 156 | +When reporting bugs, include: |
| 157 | + |
| 158 | +- Steps to reproduce |
| 159 | +- Expected behavior |
| 160 | +- Actual behavior |
| 161 | +- Library version numbers |
| 162 | + |
| 163 | +Minimal reproducible examples are always appreciated. |
| 164 | + |
| 165 | +## Become a backer or sponsor through OpenCollective |
| 166 | + |
| 167 | +The Nerves project has set up an [OpenCollective site] that allows individuals |
| 168 | +and companies to make one-time or recurring financial contributions to cover the |
| 169 | +cost of maintaining the project. |
| 170 | + |
| 171 | +<!-- Links --> |
| 172 | + |
| 173 | +[Code of Conduct]: CODE_OF_CONDUCT.md |
| 174 | +[Common Changelog]: https://common-changelog.org/ |
| 175 | +[Nerves Discord]: https://discord.gg/7TqSpepHw7 |
| 176 | +[nerves repository]: https://github.com/nerves-project/nerves |
| 177 | +[OpenCollective site]: https://opencollective.com/nerves-project |
| 178 | +[REUSE Specification]: https://reuse.software/ |
| 179 | +[SECURITY.md]: SECURITY.md |
0 commit comments