|
| 1 | +<!-- SPDX-License-Identifier: GPL-2.0 --> |
| 2 | +# Contributing to `mctp` tools |
| 3 | + |
| 4 | +We have a few short guidelines for contributing to the `mctp` project, based |
| 5 | +mainly on Linux kernel and OpenBMC conventions, as we have a reasonable |
| 6 | +overlap with both. |
| 7 | + |
| 8 | +In short: |
| 9 | + - Discuss major changes first |
| 10 | + - One change per commit, in general |
| 11 | + - Send contributions as PRs to our github repo |
| 12 | + - Add a Signed-off-by to indicate certification of the DCO |
| 13 | + - Include unit tests |
| 14 | + |
| 15 | +Large or intrusive changes should be discussed first (ideally, before you have |
| 16 | +code finalised) by opening a github issue. This generally saves time in |
| 17 | +resolving design issues before implementation. |
| 18 | + |
| 19 | +Issues or queries about the Linux kernel MCTP implementation (ie., related to |
| 20 | +the MCTP stack itself, rather than the userspace tooling) should be filed |
| 21 | +against the [CodeConstruct/linux](https://github.com/CodeConstruct/linux) repo. |
| 22 | + |
| 23 | +Contributions should be submitted as pull-requests to our github repository at |
| 24 | +<https://github.com/CodeConstruct/mctp>. |
| 25 | + |
| 26 | +Contributions must be licensed under the GNU General Public License version 2, |
| 27 | +or as otherwise indicated from the original source files. Newly added files |
| 28 | +should include a SPDX-License-Identifier header, indicating `GPL-2.0` |
| 29 | + |
| 30 | +## Structuring your changes |
| 31 | + |
| 32 | +Commits should be as atomic as is sensible, by introducing one unit of change at |
| 33 | +a time. Any updates as a result of PR review should be incorporated into the |
| 34 | +original commits. |
| 35 | + |
| 36 | +Commit messages should describe the rationale for the change, and an overview of |
| 37 | +the change itself. There is no need to describe the actual code implementation, |
| 38 | +we can review that in the diff itself. If there are points that may be useful |
| 39 | +for the review process, but do not belong in permanent git history, include |
| 40 | +those in the PR description. |
| 41 | + |
| 42 | +We do not require a `Tested` section in commit messages. |
| 43 | + |
| 44 | +Each commit message must include a `Signed-off-by` line, which indicates that |
| 45 | +you (the contributor) have certified the [Developer Certificate of Origin |
| 46 | +v1.1](https://developercertificate.org/) (DCO). This line must include the full |
| 47 | +name you commonly use, often a given name and a family name or surname, and |
| 48 | +should match the author metadata on the commit (ok: Sam Samuelsson, Robert A. |
| 49 | +Heinlein; not ok: xXthorXx, Sam, RAH) |
| 50 | + |
| 51 | +## Coding style |
| 52 | + |
| 53 | +For C code, our coding style is generally that of the Linux kernel, and we |
| 54 | +have a `.clang-format` definition to automate formatting. |
| 55 | + |
| 56 | +For Python code (ie, the test framework), we use standard `ruff` formatting |
| 57 | +settings. |
| 58 | + |
| 59 | +## Tests |
| 60 | + |
| 61 | +We have an extensive unit-test framework for `mctpd`, which provides mock kernel |
| 62 | +interfaces and MCTP endpoints. We strongly encourage including tests with your |
| 63 | +changes, typically as a separate patch in a contribution series. |
| 64 | + |
| 65 | +## Coding assistants |
| 66 | + |
| 67 | +We have a policy very similar to the kernel in regards to AI use in |
| 68 | +contributions. |
| 69 | + |
| 70 | +### Licensing and Legal Requirements |
| 71 | + |
| 72 | +All contributions must comply with the project's licensing requirements, |
| 73 | +using the overall GPLv2 license. |
| 74 | + |
| 75 | +### Signed-off-by and Developer Certificate of Origin |
| 76 | + |
| 77 | +AI agents MUST NOT add Signed-off-by tags. Only humans can legally |
| 78 | +certify the Developer Certificate of Origin. The human submitter |
| 79 | +is responsible for: |
| 80 | + |
| 81 | + * Reviewing all AI-generated code |
| 82 | + * Ensuring compliance with licensing requirements |
| 83 | + * Adding their own Signed-off-by tag to certify the DCO |
| 84 | + * Taking full responsibility for the contribution |
| 85 | + |
| 86 | +### Attribution |
| 87 | + |
| 88 | +When AI tools contribute to mctp development, proper attribution |
| 89 | +helps track the evolving role of AI in the development process. |
| 90 | +Contributions should include an Assisted-by tag in the following format: |
| 91 | + |
| 92 | + Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2] |
| 93 | + |
| 94 | +Where: |
| 95 | + |
| 96 | + * `AGENT_NAME` is the name of the AI tool or framework |
| 97 | + * `MODEL_VERSION` is the specific model version used |
| 98 | + * `[TOOL1] [TOOL2]` are optional specialized analysis tools used |
| 99 | + (e.g., coccinelle, sparse, smatch, clang-tidy) |
| 100 | + |
| 101 | +Basic development tools (git, gcc, make, editors) should not be listed. |
| 102 | + |
| 103 | +Example:: |
| 104 | + |
| 105 | + Assisted-by: Claude:claude-3-opus coccinelle sparse |
0 commit comments