|
| 1 | +# Contributing to rawtoaces |
| 2 | + |
| 3 | +Thank you for your interest in contributing to rawtoaces. This document |
| 4 | +explains our contribution process and procedures: |
| 5 | + |
| 6 | +* [Getting Information](#Getting-Information) |
| 7 | +* [Legal Requirements](#Legal-Requirements) |
| 8 | +* [Development Workflow](#Development-Workflow) |
| 9 | +* [Coding Style](#Coding-Style) |
| 10 | +* [Versioning Policy](#Versioning-Policy) |
| 11 | + |
| 12 | +For a description of the roles and responsibilities of the various |
| 13 | +members of the rawtoaces community, see the rawtoaces project's [Technical |
| 14 | +Charter](https://github.com/AcademySoftwareFoundation/foundation/blob/main/project_charters/rawtoaces_charter.pdf). Briefly, |
| 15 | +a "contributor" is anyone who submits content to the project, a |
| 16 | +"committer" reviews and approves such submissions, and the "Technical |
| 17 | +Steering Committee" provides general project oversight and governance. |
| 18 | + |
| 19 | +## Getting Information |
| 20 | + |
| 21 | +The primary ways to connect with the rawtoaces project are: |
| 22 | + |
| 23 | +* [GitHub Issues](https://github.com/AcademySoftwareFoundation/rawtoaces/issues): GitHub Issues are used both to track bugs and to discuss feature requests. |
| 24 | + |
| 25 | +* The [ASWF Slack](https://slack.aswf.io/) has a `rawtoaces` channel. Sign up |
| 26 | +for the Slack on your own, then under "channels", select "browse channels" and |
| 27 | +you should see the rawtoaces channel (among those of the other projects and |
| 28 | +working groups). |
| 29 | + |
| 30 | +* The [rawtoaces-discussion](https://lists.aswf.io/g/rawtoaces-discussion) mail list: |
| 31 | + You can sign up for the mail list on your own using the link above. |
| 32 | + |
| 33 | +### How to Ask for Help |
| 34 | + |
| 35 | +If you have trouble installing, building, or using rawtoaces, but |
| 36 | +there's not yet reason to suspect you've encountered a genuine bug, |
| 37 | +start by posting a question to the slack channel or the mail list. |
| 38 | + |
| 39 | +### How to Report a Bug |
| 40 | + |
| 41 | +rawtoaces use GitHub's issue tracking system for bugs and enhancements: |
| 42 | +https://github.com/AcademySoftwareFoundation/rawtoaces/issues |
| 43 | + |
| 44 | +If you are submitting a bug report, please be sure to note which |
| 45 | +version of rawtoaces you are using, on what platform (OS/version, which |
| 46 | +compiler you used, and any special build flags or other unusual |
| 47 | +environmental issues). Please give a specific account of |
| 48 | + |
| 49 | +* what you tried |
| 50 | +* what happened |
| 51 | +* what you expected to happen instead |
| 52 | + |
| 53 | +with enough detail that others can reproduce the problem. |
| 54 | + |
| 55 | +### How to Request a Change |
| 56 | + |
| 57 | +Open a GitHub issue: https://github.com/AcademySoftwareFoundation/rawtoaces/issues. |
| 58 | + |
| 59 | +Describe the situation and the objective in as much detail as |
| 60 | +possible. Feature requests will almost certainly spawn a discussion |
| 61 | +among the project community. |
| 62 | + |
| 63 | +### How to Report a Security Vulnerability |
| 64 | + |
| 65 | +If you think you've found a potential vulnerability in rawtoaces, please |
| 66 | +refer to [SECURITY.md](SECURITY.md) to responsibly disclose it. |
| 67 | + |
| 68 | +### How to Contribute a Bug Fix or Change |
| 69 | + |
| 70 | +To contribute code to the project, you will need: |
| 71 | + |
| 72 | +* A good knowledge of git. |
| 73 | + |
| 74 | +* A fork of the GitHub repo. |
| 75 | + |
| 76 | +* An understanding of the project's development workflow. |
| 77 | + |
| 78 | +* Legal authorization, that is, you need to have signed a contributor |
| 79 | + License Agreement. See below for details. |
| 80 | + |
| 81 | +## Legal Requirements |
| 82 | + |
| 83 | +rawtoaces is a project of the Academy Software Foundation and follows the |
| 84 | +open source software best practice policies of the Linux Foundation. |
| 85 | + |
| 86 | +### License |
| 87 | + |
| 88 | +rawtoaces is licensed under the [Apache-2.0](LICENSE.md) |
| 89 | +license. Contributions to the library should abide by that standard |
| 90 | +license. |
| 91 | + |
| 92 | +### Contributor License Agreements |
| 93 | + |
| 94 | +To protect the project -- and the contributors! -- we do require a Contributor |
| 95 | +License Agreement (CLA) for anybody submitting changes. This is for your own |
| 96 | +safety, as it prevents any possible future disputes between code authors and |
| 97 | +their employers or anyone else who might think they might own the IP output of |
| 98 | +the author. |
| 99 | + |
| 100 | +The easiest way to sign CLAs is digitally [using |
| 101 | +EasyCLA](https://corporate.v1.easycla.lfx.linuxfoundation.org). There are |
| 102 | +detailed step-by-step instructions about using the EasyCLA system for |
| 103 | +[corporate CLAs](https://docs.linuxfoundation.org/lfx/easycla/v2-current/contributors/corporate-contributor) |
| 104 | +and [individual CLAs](https://docs.linuxfoundation.org/lfx/easycla/v2-current/contributors/individual-contributor#github). |
| 105 | + |
| 106 | +* If you are an individual writing the code on your own time and |
| 107 | + you're **sure** you are the sole owner of any intellectual property you |
| 108 | + contribute, you can sign the CLA as an **Individual Contributor**. |
| 109 | + |
| 110 | +* If you are writing the code as part of your job, or if your employer |
| 111 | + retains ownership to intellectual property you create, no matter how |
| 112 | + small, then your company's legal affairs representatives should sign |
| 113 | + a **Corporate Contributor Licence Agreement**. If your company already |
| 114 | + has a signed CCLA on file, ask your local CLA manager to add you |
| 115 | + (via your GitHub account name/email address) to your company's |
| 116 | + "approved" list. |
| 117 | + |
| 118 | +### Commit Sign-Off |
| 119 | + |
| 120 | +Every commit must be signed off. That is, every commit log message |
| 121 | +must include a “`Signed-off-by`” line (generated, for example, with |
| 122 | +“`git commit --signoff`”), indicating that the committer wrote the |
| 123 | +code and has the right to release it under the [Apache-2.0](LICENSE.md) |
| 124 | +license. See https://github.com/AcademySoftwareFoundation/tac/blob/main/process/contributing.md#contribution-sign-off for more information on this requirement. |
| 125 | + |
| 126 | +## Development Workflow |
| 127 | + |
| 128 | +### Git Basics |
| 129 | + |
| 130 | +Working with rawtoaces requires understanding a significant amount of |
| 131 | +Git and GitHub based terminology. If you’re unfamiliar with these |
| 132 | +tools or their lingo, please look at the [GitHub |
| 133 | +Glossary](https://help.github.com/articles/github-glossary/) or browse |
| 134 | +[GitHub Help](https://help.github.com/). |
| 135 | + |
| 136 | +To contribute, you need a GitHub account. This is needed in order to |
| 137 | +push changes to the upstream repository, via a pull request. |
| 138 | + |
| 139 | +You will also need Git installed on your local development machine. If |
| 140 | +you need setup assistance, please see the official [Git |
| 141 | +Documentation](https://git-scm.com/doc). |
| 142 | + |
| 143 | +### Repository Structure and Commit Policy |
| 144 | + |
| 145 | +The rawtoaces repository uses a simple branching and merging strategy. |
| 146 | + |
| 147 | +All development work is done directly on the ``main`` branch. The ``main`` |
| 148 | +branch represents the bleeding-edge of the project and most |
| 149 | +contributions should be done on top of it. |
| 150 | + |
| 151 | +After sufficient work is done on the ``main`` branch and the rawtoaces |
| 152 | +leadership determines that a release is due, we will bump the relevant |
| 153 | +internal versioning and tag a commit with the corresponding version |
| 154 | +number, e.g. v2.0.1. Each minor version also has its own “Release |
| 155 | +Branch”, e.g. dev-1.1. This marks a branch of code dedicated to that |
| 156 | +``major.minor`` version, which allows upstream bug fixes to be |
| 157 | +cherry-picked to a given version while still allowing the ``main`` |
| 158 | +branch to continue forward onto higher versions. This basic repository |
| 159 | +structure keeps maintenance low, while remaining simple to understand. |
| 160 | + |
| 161 | +To reiterate, the ``main`` branch represents the latest development |
| 162 | +version, so beware that it may include untested features and is not |
| 163 | +generally stable enough for release. To retrieve a stable version of |
| 164 | +the source code, use one of the release branches. |
| 165 | + |
| 166 | +### The Git Workflow |
| 167 | + |
| 168 | +This development workflow is sometimes referred to as |
| 169 | +[OneFlow](https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow). It |
| 170 | +leads to a simple, clean, linear edit history in the repo. |
| 171 | + |
| 172 | +The rawtoaces GitHub repo allows rebase merging and disallows merge |
| 173 | +commits and squash merging. This ensures that the repo edit history |
| 174 | +remains linear, avoiding the "bubbles" characteristic of the |
| 175 | +[GitFlow](https://www.endoflineblog.com/gitflow-considered-harmful) |
| 176 | +workflow. |
| 177 | + |
| 178 | +### Forks |
| 179 | + |
| 180 | +In a typical workflow, you should **fork** the rawtoaces repository to |
| 181 | +your account. This creates a copy of the repository under your user |
| 182 | +namespace and serves as the “home base” for your development branches, |
| 183 | +from which you will submit **pull requests** to the upstream |
| 184 | +repository to be merged. |
| 185 | + |
| 186 | +Once your Git environment is operational, the next step is to locally |
| 187 | +**clone** your forked rawtoaces repository, and add a **remote** |
| 188 | +pointing to the upstream rawtoaces repository. These topics are |
| 189 | +covered in the GitHub documentation [Cloning a |
| 190 | +repository](https://help.github.com/articles/cloning-a-repository/) |
| 191 | +and [Configuring a remote for a |
| 192 | +fork](https://help.github.com/articles/configuring-a-remote-for-a-fork/). |
| 193 | + |
| 194 | +### Pull Requests |
| 195 | + |
| 196 | +Contributions should be submitted as Github pull requests. See |
| 197 | +[Creating a pull request](https://help.github.com/articles/creating-a-pull-request/) |
| 198 | +if you're unfamiliar with this concept. |
| 199 | + |
| 200 | +The development cycle for a code change should follow this protocol: |
| 201 | + |
| 202 | +1. Create a topic branch in your local repository. |
| 203 | + |
| 204 | +2. Make changes, compile, and test thoroughly. Code style should match existing |
| 205 | +style and conventions, and changes should be focused on the topic the pull |
| 206 | +request will be addressing. Make unrelated changes in a separate topic branch |
| 207 | +with a separate pull request. |
| 208 | + |
| 209 | +3. Push commits to your fork. |
| 210 | + |
| 211 | +4. Create a Github pull request from your topic branch. |
| 212 | + |
| 213 | +5. Pull requests will be reviewed by project committers and contributors, |
| 214 | +who may discuss, offer constructive feedback, request changes, or approve |
| 215 | +the work. |
| 216 | + |
| 217 | +6. Upon receiving the required number of committer approvals (as |
| 218 | +outlined in [Required Approvals](#required-approvals)), a committer |
| 219 | +other than the PR contributor may merge changes into the ``main`` |
| 220 | +branch. |
| 221 | + |
| 222 | +### Code Review and Required Approvals |
| 223 | + |
| 224 | +Modifications of the contents of the rawtoaces repository are made on a |
| 225 | +collaborative basis. Anyone with a GitHub account may propose a |
| 226 | +modification via pull request and it will be considered by the project |
| 227 | +committers. |
| 228 | + |
| 229 | +Code review is a process where someone other than the author of a patch |
| 230 | +examines the proposed changes and approves or critiques them. The main |
| 231 | +benefits are to: |
| 232 | + |
| 233 | +- Encourage submitters to ensure that their changes are well thought out, |
| 234 | + tested, and documented so that their intent and wisdom will be clear to |
| 235 | + others. |
| 236 | +- Directly find shortcomings in or suggest improvements to the proposed |
| 237 | + changes, and ensure that the changes are consistent with the project's best |
| 238 | + practices. |
| 239 | +- Minimize the amount of the code base that has only been seen or is only |
| 240 | + understood by one person. |
| 241 | +- Improve security and robustness of the code base by assuring that at least |
| 242 | + two people (submitter and reviewer) agree that every patch is reasonable and |
| 243 | + safe. |
| 244 | + |
| 245 | +### Test Policy |
| 246 | + |
| 247 | +All functionality in the library must be covered by an automated |
| 248 | +test. |
| 249 | + |
| 250 | +* All new functionality should be accompanied by a test that validates |
| 251 | + its behavior. |
| 252 | + |
| 253 | +* Any change to existing functionality should have tests added if they |
| 254 | + don't already exist. |
| 255 | + |
| 256 | +The tests can be run locally via: |
| 257 | + |
| 258 | + cmake -S . -B build_test |
| 259 | + cmake --build build_test |
| 260 | + ctest --test-dir build_test |
| 261 | + |
| 262 | +The tests also run on the CI on every push to a pull request, and every change |
| 263 | +to main. |
| 264 | + |
| 265 | +## Coding Style |
| 266 | + |
| 267 | +### File conventions |
| 268 | + |
| 269 | +C++ implementation should be named `*.cpp`. Headers should be named `.h`. |
| 270 | + |
| 271 | +All headers should contain: |
| 272 | + |
| 273 | + #pragma once |
| 274 | + |
| 275 | +All new source files should begin with a copyright and license stating: |
| 276 | + |
| 277 | + // SPDX-License-Identifier: Apache-2.0 |
| 278 | + // Copyright Contributors to the rawtoaces Project. |
| 279 | + |
| 280 | +### Formatting |
| 281 | + |
| 282 | +The coding style of the library source code is enforced via Clang format, with |
| 283 | +the configuration defined in [.clang-format](../.github/.clang-format). |
| 284 | + |
| 285 | +One of the CI test matrix entries runs clang-format and fails if any |
| 286 | +diffs were generated (that is, if any of your code did not 100% conform to |
| 287 | +the `.clang-format` formatting configuration). If it fails, clicking on that |
| 288 | +test log will show you the diffs generated, so that you can easily correct |
| 289 | +it on your end and update the PR with the formatting fixes. |
| 290 | + |
| 291 | +Because the basic formatting is automated by clang-format, we won't |
| 292 | +enumerate the rules here. |
| 293 | + |
| 294 | +### Naming Conventions |
| 295 | + |
| 296 | +* In general, classes and template type names should start with upper |
| 297 | + case and capitalize new words: `class CustomerList;` |
| 298 | + |
| 299 | +* In general, local variables should use camelCase. Macros and |
| 300 | + constants should use `ALL_CAPS`. |
| 301 | + |
| 302 | +If your class is extremely similar to, or modeled after, something in the |
| 303 | +standard library, or something else we interoperate with, it's ok to |
| 304 | +use their naming conventions. For example, very general utility classes and |
| 305 | +templates (the kind of thing you would normally find in std) should |
| 306 | +be lower case with underscores separating words, as they would be if they |
| 307 | +were standards. |
| 308 | + |
| 309 | + template <class T> shared_ptr; |
| 310 | + class scoped_mutex; |
| 311 | + |
| 312 | +### Third-party libraries |
| 313 | + |
| 314 | +Prefer C++11 `std` over other libraries where possible. Check with the project |
| 315 | +leadership before adding new dependencies. |
| 316 | + |
| 317 | +### Comments and Doxygen |
| 318 | + |
| 319 | +Comment philosophy: try to be clear, try to help teach the reader |
| 320 | +what's going on in your code. |
| 321 | + |
| 322 | +Prefer C++ comments (starting line with `//`) rather than C comments |
| 323 | +(`/* ... */`). |
| 324 | + |
| 325 | +For public APIs, use Doxygen-style comments (start with `///`), such as: |
| 326 | + |
| 327 | + /// Explanation of a class. Note THREE slashes! |
| 328 | + /// Also, you need at least two lines like this. If you don't have enough |
| 329 | + /// for two lines, make one line blank like this: |
| 330 | + /// |
| 331 | + class myclass { |
| 332 | + .... |
| 333 | + float foo; ///< Doxygen comments on same line look like this |
| 334 | + } |
| 335 | + |
| 336 | +## Versioning Policy |
| 337 | + |
| 338 | +rawtoaces uses [semantic versioning](https://semver.org), which labels |
| 339 | +each version with three numbers: ``major.minor.patch``, where: |
| 340 | + |
| 341 | +* ``major`` - indicates incompatible API changes |
| 342 | +* ``minor`` - indicates functionality added in a backwards-compatible manner |
| 343 | +* ``patch`` - indicates backwards-compatible bug fixes |
0 commit comments