This major overhaul of the Contributing to Infix document is made both for internal (scaling the core team) reasons and to make it easier for external contributors to undertand what is expected: - For bug reporting - For feature requests - When submitting a patch - When adding a complete new subsystem - Etc. Resolves: #672 [skip ci] Signed-off-by: Joachim Wiberg <troglobit@gmail.com> Co-authored-by: Tobias Waldekranz <tobias@waldekranz.com> Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
7.8 KiB
Contributing to Infix
Thank ❤️ you for taking the time to read this!
We welcome any help in the form of bug reports, fixes, or patches to add new features. We prefer GitHub pull requests, but are open to other forms of collaboration as well. Let's talk! 🤝
If you are unsure how to start implementing an idea or fix:
- 🐛 open an issue, there are human friendly templates for bugs and feature requests
- 💬 use the Q&A Forum
Talking about code and problems first is often the best way to get started before submitting a pull request. We have found it always saves time, yours and ours.
✨ General Guidelines
When submitting bug reports or patches to bugs, please state which version the change is made against, what it does, and, more importantly why -- from your perspective, why is it a bug, why does the code need changing in this way. Start with why.
- 🐛 Bug reports need metadata like Infix version or commit hash
- 🩹 Bug fixes also need version, and (preferably) a corresponding issue number for the ChangeLog
- 🆕 New features, you need to get approval of the YANG model first!
💬 Please use the Forum, e.g., category: Ideas, or open a 🙏 feature request issue - ✅ New features also need new regression tests, this can be basic tests or more complex use-case tests comprising multiple subsystems, see Testing Changes, below
Please take care to ensure you follow the project coding style and the commit message format. If you follow these recommendations you help the maintainers and make it easier for them to include your code.
👩💻 Coding Style
Before jumping into code, remember to document new features and bug
fixes. Both the manual and ChangeLog are in the doc/ sub-directory
and it is expected that you provide a human-readable summary for the
release notes (ChangeLog) and at least a configuration example in the
manual for new features.
Tip: consider "Readme driven development" for new features. It is amazing how many flaws in your own bright ideas come to bare when you suddenly have to explain them to someone else!
We expect code contributions for:
- C code in Linux Coding Style
- Python code should follow PEP-8
However, always submit code that follows the style of surrounding code! Legacy takes precedence, and remember, we read code a lot more than write it, so legibility is important.
The ChangeLog deserves a separate mention:
- Releases are listed in reverse chronological order order, so the latest/next release is at the beginning of the file
- Only user-facing bugs and features are detailed, so code refactor, new tests, etc. are not listed.
- Add your changes/features to the Changes section
- Add your Fix line in the Fixes section, in numeric order
- Changes and fixes without an issue number are listed after all numbered ones
- YANG model changes are documented in their respective model, for
standard models, e.g., for
ietf-interfaces.yang, the correspondinginfix-interfaces.yangdetail augments/deviations as revisions.
A final note, lines of code are allowed to be longer than 72 characters these days, unless you live by PEP-8 (see above). There is no enforced maximum, but the team usually keep it around 100 characters for both C and Python.
🧪 Testing Changes
Please test your changes, no matter how trivial or obviously correct they may seem. Nobody is infallible, making mistakes is only human. It is also the best insurance policy for your feature, it ensures your use-case will remain functional as the source base evolves.
For new functionality we expect new regression tests to be added in the same pull request.
For help getting started with testing, see the following resources:
📝 Commit Messages
Commit messages exist to track why a change was made. Try to be as clear and concise as possible in your commit messages, and always, be proud of your work and set up a proper GIT identity for your commits:
$ git config --global user.name "Jacky Linker"
$ git config --global user.email jacky.linker@example.com
Example commit message from one of many online guides. Use
git commit -s to automatically add a Signed-off-by for proof of
origin, see DCO for more info.
subsystem: brief, but clear and concise summary of changes
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as
the subject of an email and the rest of the text as the body. The
empty line separating summary from body is critical. Tools like
rebase can get confused if the empty line is missing.
Further paragraphs should be separated with empty lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, preceded
by a single space, with blank lines in between, but conventions
vary here
If you use an issue tracker, put references to them at the bottom,
like this:
Resolves: #123
See also: #456, #789
Signed-off-by: Jacky Linker <jacky.linker@example.com>
This is an example of how to automatically close an issue when the commit is merged to mainline. Several keywords are available.
🔀 Pull Requests
The git repository is the canonical location for information.
A pull request should preferably address a single issue or change. This may of course include multiple related changes, but what is important to remember is the bandwidth of the maintainers. A smaller well documented PR is more likely to get attention quicker in some reviewer's busy day.
Well documented here means that each commit message stands on its own, telling the complete story of the change. In fact each commit should, as much as possible, be independent of other changes. This is very important, not only when digging though logs to understand why a piece of code exists, but also when bisecting a problem -- each single commit should also compile and be possible to run.
If you've worked on projects that send patches, like the Linux kernel or Buildroot, consider the pull request message body similar to the cover letter for a series of patches -- it's a summary of changes, and it is lost when the changes are merged to the mainline branch.
⚖️ Code of Conduct
It is expected of everyone to respect the Code of Conduct. The "maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, discussion forum threads, issues, and other contributions that are not aligned to this Code of Conduct."