Warning, /acts/CONTRIBUTING.rst is written in an unsupported language. File is not indexed.
0001 Contribution guidelines
0002 =======================
0003
0004 Contributions to the Acts project are very welcome and feedback on the
0005 documentation is greatly appreciated.
0006
0007 Mailing lists
0008 -------------
0009
0010 - `acts-users@cern.ch <https://e-groups.cern.ch/e-groups/Egroup.do?egroupName=acts-users>`_:
0011 Users of the Acts project should subscribe to this list as it provides
0012
0013 - regular updates on the software,
0014 - a common place for asking any kind of questions.
0015
0016 - `acts-developers@cern.ch <https://e-groups.cern.ch/e-groups/Egroup.do?egroupName=acts-developers>`_:
0017 For discussions about
0018
0019 - information about developer meetings,
0020 - a common place for technical discussions.
0021
0022 Bug reports and feature requests
0023 --------------------------------
0024
0025 To report an issue and before starting work, please create an issue in the
0026 `GitHub issue tracker <https://github.com/acts-project/acts/issues>`_. A
0027 comprehensive explanation will help the development team to respond in a timely
0028 manner. Verbalising the issue before starting work allows the other contributors
0029 to chime in and avoids disagreements how to progress.
0030
0031 - The title should summarise the issue
0032 - Describe the issue in as much detail as possible in the comment
0033
0034 GitHub does not allow editing labels, assignees or setting milestone to
0035 non-members of a project with at least "Triage" permission. These will have to
0036 be set by members with Triage permission after an issue/PR is created.
0037 Guidelines regarding labels, assignees and milestone therefore only concern
0038 members of acts-project with the necessary rights and can be ignored by others.
0039
0040 - Assign to yourself or leave empty
0041 - Choose labels as appropriate
0042
0043 - Type of issue
0044 - Which component is affected
0045 - Urgency
0046 - Fix versions
0047
0048 - Bug reports
0049
0050 - Mention affected version(s)
0051 - Issue type: ``Bug``
0052 - A detailed description of the bug including a recipe on how to
0053 reproduce it and any hints which may help diagnosing the problem
0054
0055 - Feature requests
0056
0057 - Issue type: ``Improvement`` or ``Feature``
0058 - A detailed description of the feature request including possible
0059 use cases and benefits for other users
0060
0061 Make a contribution
0062 -------------------
0063
0064 Anyone is welcome to contribute to Acts. Below is a short description how to
0065 contribute. If you have any questions, feel free to ask `acts-developers@cern
0066 <mailto:acts-developers@cern.ch>`_ for help or guidance.
0067
0068 Please always fork the Acts repository you want to work on and create branches
0069 only in your own fork. Once you want to share your work, create a Pull Request
0070 (PR) (for gitlab users: equivalent to merge request) to the main branch of the
0071 upstream acts-project repository. If it is not yet ready to be merged in, please
0072 create a draft pull request (by clicking on the small arrow on the green "create
0073 pull request" button) to mark it work in progress. Once you want your branch to
0074 be merged in, request a review from the `reviewers team
0075 <https://github.com/orgs/acts-project/teams/reviewers>`_. Once a draft merge
0076 request is reviewed, it can be merged in.
0077
0078 To get started with git, please refer to the `short introduction
0079 <https://git-scm.com/docs/gittutorial>`_ as well as the `full git documentation
0080 <https://git-scm.com/doc>`_. Tutorials as well as explanations of concepts and
0081 workflows with git can also be found on `Atlassian
0082 <https://www.atlassian.com/git/>`_.
0083
0084 Checklist for pull requests
0085 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
0086
0087 - Your branch has been rebased on the target branch and can be
0088 integrated through a fast-forward merge.
0089 - A detailed description of the pull request is provided.
0090 - The issue the PR closes is linked.
0091 - All CI jobs pass.
0092 - All newly introduced functions and classes have been documented
0093 properly with doxygen.
0094 - Unit tests are provided for new functionalities.
0095 - For bugfixes: a test case has been added to avoid the re-appearance
0096 of this bug in the future.
0097
0098 Workflow recommendations
0099 ~~~~~~~~~~~~~~~~~~~~~~~~
0100
0101 In the following a few recommendations are outlined which should help you to get
0102 familiar with development process in the Acts project.
0103
0104 #. **Each development in its own branch of your private fork!**
0105
0106 Write access for developers has been disabled for developers on
0107 acts-project. Therefore, always start by creating your own fork and
0108 creating branches there. You should start a new branch for every
0109 development and all work which is logically/conceptually linked
0110 should happen in one branch. Try to keep your branches short. This
0111 helps immensely to understand the git history if you need to look at
0112 it in the future and helps reviewers of your code. If projects are
0113 complex (e.g. large code refactoring or complex new features), you
0114 may want to use *sub*-branches from the main development branch.
0115
0116 #. **Never, ever directly work on any "official" branch!**
0117
0118 Though not strictly necessary and in the end it is up to you, it is strongly
0119 recommended that you never commit directly on a branch which tracks
0120 an "official" branch. As all branches are equal in git, the
0121 definition of "official" branch is quite subjective. In the Acts
0122 project you should not work directly on branches which are
0123 **protected** in the repository. Usually, these are the *main* and
0124 *release/X.Y.Z* branches. The benefit of this strategy is that you
0125 will never have problems to update your fork. Any git merge in your
0126 local repository on such an "official" branch will always be a
0127 fast-forward merge.
0128
0129 #. **Use atomic commits!**
0130
0131 Similarly to the concept of branches, each
0132 commit should reflect a self-contained change. Try to avoid overly
0133 large commits (bad examples are for instance mixing logical change
0134 with code cleanup and typo fixes).
0135
0136 #. **Write good commit messages!**
0137
0138 Well-written commit messages are key
0139 to understand your changes. There are many guidelines available on
0140 how to write proper commit logs (e.g.
0141 `here <https://alistapart.com/article/the-art-of-the-commit>`__,
0142 `here <https://cbea.ms/git-commit/>`__, or
0143 `here <https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages>`__).
0144 As a short summary:
0145
0146 - Structure your commit messages into short title (max 50
0147 characters) and longer description (max width 72 characters)! This
0148 is best achieved by avoiding the ``commit -m`` option. Instead
0149 write the commit message in an editor/git tool/IDE...
0150 - Describe why you did the change (git diff already tells you what
0151 has changed)!
0152 - Mention any side effects/implications/consequences!
0153
0154 #. **Prefer git pull --rebase!**
0155
0156 If you work with a colleague on a new
0157 development, you may want to include their latest changes. This is
0158 usually done by calling ``git pull`` which will synchronise your
0159 local working copy with the remote repository (which may have been
0160 updated by your colleague). By default, this action creates a merge
0161 commit if you have local commits which were not yet published to the
0162 remote repository. These merge commits are considered to contribute
0163 little information to the development process of the feature and they
0164 clutter the history (read more e.g.
0165 `here <https://www.atlassian.com/blog/it-teams/stop-foxtrots-now>`__
0166 or
0167 `here <https://fangpenlin.com/posts/2013/09/30/keep-a-readable-git-history/>`__).
0168 This problem can be avoided by using ``git pull --rebase`` which
0169 replays your local (un-pushed) commits on the tip of the remote
0170 branch. You can make this the default behaviour by running
0171 ``git config pull.rebase true``. More about merging vs rebasing can
0172 be found
0173 `here <https://www.atlassian.com/git/tutorials/merging-vs-rebasing/>`__.
0174
0175 #. **Update the documentation!**
0176
0177 Make sure that the documentation is
0178 still valid after your changes. Perform updates where needed and
0179 ensure integrity between the code and its documentation.
0180
0181 Coding style and guidelines
0182 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
0183
0184 The Acts project uses
0185 `clang-format <https://clang.llvm.org/docs/ClangFormat.html>`_ for
0186 formatting its source code. A ``.clang-format`` configuration file comes
0187 with the project and should be used to automatically format the code.
0188 Developers can use the provided Docker image to format their project or
0189 install clang-format locally. Developers should be aware that
0190 clang-format will behave differently for different versions, so
0191 installing `the same clang version as used in the
0192 CI is recommended. There are several instructions available on how to
0193 integrate clang-format with your favourite IDE (e.g. `Xcode <https://github.com/travisjeffery/ClangFormat-Xcode>`_,
0194 `emacs <https://clang.llvm.org/docs/ClangFormat.html#emacs-integration>`_).
0195 The Acts CI system will automatically check code formatting using the
0196 provided clang-format configuration and will notify incompatible formatting.
0197
0198 In addition, some conventions are used in Acts code, details can be
0199 found `here <https://acts.readthedocs.io/en/latest/codeguide.html>`_.
0200 For Doxygen documentation, please follow these recommendations:
0201
0202 - Put all documentation in the header files.
0203 - Use ``///`` as block comment (instead of ``/* ... */``).
0204 - Doxygen documentation goes in front of the documented entity (class,
0205 function, (member) variable).
0206 - Use the ``@<cmd>`` notation.
0207 - Document all (template) parameters using @(t)param and explain the
0208 return value for non-void functions. Mention important conditions
0209 which may affect the return value.
0210 - Use ``@remark`` to specify pre-conditions.
0211 - Use ``@note`` to provide additional information.
0212 - Link other related entities (e.g. functions) using ``@sa``.
0213
0214 Example: Make a bugfix while working on a feature
0215 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0216
0217 During the development of a new feature you discover a bug which needs
0218 to be fixed. In order to not mix bugfix and feature development, the
0219 bugfix should happen in a different branch. The recommended procedure
0220 for handling this situation is the following:
0221
0222 #. Get into a clean state of your working directory on your feature
0223 branch (either by committing open changes or by stashing them).
0224 #. Checkout the branch the bugfix should be merged into (either *main*
0225 or *release/X.Y.Z*) and get the most recent version.
0226 #. Create a new branch for the bugfix.
0227 #. Fix the bug, write a test, update documentation etc.
0228 #. Open a pull request for the bug fix.
0229 #. Switch back to your feature branch.
0230 #. Merge your local bugfix branch into the feature branch. Continue your
0231 feature development.
0232 #. Eventually, the bugfix will be merged into *main*. Then, you can
0233 rebase your feature branch on main which will remove all duplicate
0234 commits related to the bugfix.
0235
0236 Example: Backporting a feature or bugfix
0237 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0238
0239 Suppose you have a bugfix or feature branch that is eventually going to
0240 be merged in ``main``. You might want to have the feature/bugfix
0241 available in a patch (say ``0.25.1``) tag. To to that, find the
0242 corresponding release branch, for this example that would be
0243 ``release/v0.25.X``. You must create a dedicated branch that **only**
0244 contains the commits that relate to your feature/bugfix, otherwise the
0245 PR will contain all other commits that were merged into main since the
0246 release was branched off. With that branch, open a PR to that branch,
0247 and make it clear that it is a backport, also linking to a potential
0248 equivalent PR that targets ``main``.
0249
0250 Tips for users migrating from GitLab
0251 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0252
0253 - The most obvious difference first: What is called Merge Request
0254 in GitLab is called Pull Request (PR) in GitHub.
0255 - Once your PR is ready to be merged, request a review by the users in
0256 the `reviewers
0257 team <https://github.com/orgs/acts-project/teams/reviewers>`__
0258 - As Acts started enforcing using your own fork with the switch to
0259 GitHub, developers no longer have write access to the upstream
0260 repository.
0261 - The CI will fail if a PR does not yet have the required approvals.
0262
0263 Review other contributions
0264 --------------------------
0265
0266 Acts requires that every pull request receives at least one review by a
0267 member of the reviewers team before being merged but anyone is welcome
0268 to contribute by commenting on code changes. You can help reviewing
0269 proposed contributions by going to `the "pull requests" section of the
0270 Acts (core) GitHub
0271 repository <https://github.com/acts-project/acts/pulls>`_.
0272
0273 As some of the guidelines recommended here require rights granted to the
0274 reviewers team, this guide specifically addresses the people in this
0275 team. The present contribution guide should serve as a good indication
0276 of what we expect from code submissions.
0277
0278 Approving a pull request
0279 ~~~~~~~~~~~~~~~~~~~~~~~~
0280
0281 - Does its title and description reflect its contents?
0282 - Do the automated continuous integration tests pass without problems?
0283 - Have all the comments raised by previous reviewers been addressed?
0284
0285 If you are confident that a pull request is ready for integration,
0286 please make it known by clicking the "Approve pull request" button of
0287 the GitHub interface. This notifies other members of the Acts team of
0288 your decision, and marks the pull request as ready to be merged.
0289
0290 Merging a pull request
0291 ~~~~~~~~~~~~~~~~~~~~~~
0292
0293 If you have been granted write access on the Acts repository, you can
0294 merge a pull request into the Acts main branch after it has been
0295 approved.
0296
0297 GitHub may warn you that a "Fast-forward merge is not possible". This
0298 warning means that the pull request has fallen behind the current Acts
0299 main branch, and should be updated through a rebase. Please notify the
0300 pull request author in order to make sure that the latest main changes
0301 do not affect the pull request, and to have it updated as appropriate.
0302
0303 For a PR that is behind main, a button "Update branch" may appear.
0304 This should NOT be used as it merges instead of rebasing, which is not
0305 our workflow.