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-core/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 <http://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 <http://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 <http://alistapart.com/article/the-art-of-the-commit>`__,
0142 `here <http://chris.beams.io/posts/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://developer.atlassian.com/blog/2016/04/stop-foxtrots-now/>`__
0166 or
0167 `here <http://victorlin.me/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 <http://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 <https://github.com/acts-project/machines/blob/master/format10/Dockerfile>`_
0193 is recommended. There are several instructions available on how to
0194 integrate clang-format with your favourite IDE (e.g. `Xcode <https://github.com/travisjeffery/ClangFormat-Xcode>`_,
0195 `emacs <http://clang.llvm.org/docs/ClangFormat.html#emacs-integration>`_).
0196 The Acts CI system will automatically check code formatting using the
0197 provided clang-format configuration and will notify incompatible formatting.
0198
0199 In addition, some conventions are used in Acts code, details can be
0200 found `here <https://acts.readthedocs.io/en/latest/codeguide.html>`_.
0201 For Doxygen documentation, please follow these recommendations:
0202
0203 - Put all documentation in the header files.
0204 - Use ``///`` as block comment (instead of ``/* ... */``).
0205 - Doxygen documentation goes in front of the documented entity (class,
0206 function, (member) variable).
0207 - Use the ``@<cmd>`` notation.
0208 - Document all (template) parameters using @(t)param and explain the
0209 return value for non-void functions. Mention important conditions
0210 which may affect the return value.
0211 - Use ``@remark`` to specify pre-conditions.
0212 - Use ``@note`` to provide additional information.
0213 - Link other related entities (e.g. functions) using ``@sa``.
0214
0215 Example: Make a bugfix while working on a feature
0216 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0217
0218 During the development of a new feature you discover a bug which needs
0219 to be fixed. In order to not mix bugfix and feature development, the
0220 bugfix should happen in a different branch. The recommended procedure
0221 for handling this situation is the following:
0222
0223 #. Get into a clean state of your working directory on your feature
0224 branch (either by commiting open changes or by stashing them).
0225 #. Checkout the branch the bugfix should be merged into (either *main*
0226 or *release/X.Y.Z*) and get the most recent version.
0227 #. Create a new branch for the bugfix.
0228 #. Fix the bug, write a test, update documentation etc.
0229 #. Open a pull request for the bug fix.
0230 #. Switch back to your feature branch.
0231 #. Merge your local bugfix branch into the feature branch. Continue your
0232 feature development.
0233 #. Eventually, the bugfix will be merged into *main*. Then, you can
0234 rebase your feature branch on main which will remove all duplicate
0235 commits related to the bugfix.
0236
0237 Example: Backporting a feature or bugfix
0238 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0239
0240 Suppose you have a bugfix or feature branch that is eventually going to
0241 be merged in ``main``. You might want to have the feature/bugfix
0242 avilable in a patch (say ``0.25.1``) tag. To to that, find the
0243 corresponding release branch, for this example that would be
0244 ``release/v0.25.X``. You must create a dedicated branch that **only**
0245 contains the commits that relate to your feature/bugfix, otherwise the
0246 PR will contain all other commits that were merged into main since the
0247 release was branched off. With that branch, open a PR to that branch,
0248 and make it clear that it is a backport, also linking to a potential
0249 equivalent PR that targets ``main``.
0250
0251 Tips for users migrating from GitLab
0252 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0253
0254 - The most obvious difference first: What is called Merge Request
0255 in GitLab is called Pull Request (PR) in GitHub.
0256 - Once your PR is ready to be merged, request a review by the users in
0257 the `reviewers
0258 team <https://github.com/orgs/acts-project/teams/reviewers>`__
0259 - As Acts started enforcing using your own fork with the switch to
0260 GitHub, developers no longer have write access to the upstream
0261 repository.
0262 - The CI will fail if a PR does not yet have the required approvals.
0263
0264 Review other contributions
0265 --------------------------
0266
0267 Acts requires that every pull request receives at least one review by a
0268 member of the reviewers team before being merged but anyone is welcome
0269 to contribute by commenting on code changes. You can help reviewing
0270 proposed contributions by going to `the "pull requests" section of the
0271 Acts (core) GitHub
0272 repository <https://github.com/acts-project/acts-core/pulls>`_.
0273
0274 As some of the guidelines recommended here require rights granted to the
0275 reviewers team, this guide specifically addresses the people in this
0276 team. The present contribution guide should serve as a good indication
0277 of what we expect from code submissions.
0278
0279 Approving a pull request
0280 ~~~~~~~~~~~~~~~~~~~~~~~~
0281
0282 - Does its title and description reflect its contents?
0283 - Do the automated continuous integration tests pass without problems?
0284 - Have all the comments raised by previous reviewers been addressed?
0285
0286 If you are confident that a pull request is ready for integration,
0287 please make it known by clicking the "Approve pull request" button of
0288 the GitHub interface. This notifies other members of the Acts team of
0289 your decision, and marks the pull request as ready to be merged.
0290
0291 Merging a pull request
0292 ~~~~~~~~~~~~~~~~~~~~~~
0293
0294 If you have been granted write access on the Acts repository, you can
0295 merge a pull request into the Acts main branch after it has been
0296 approved.
0297
0298 GitHub may warn you that a "Fast-forward merge is not possible". This
0299 warning means that the pull request has fallen behind the current Acts
0300 main branch, and should be updated through a rebase. Please notify the
0301 pull request author in order to make sure that the latest main changes
0302 do not affect the pull request, and to have it updated as appropriate.
0303
0304 For a PR that is behind main, a button "Update branch" may appear.
0305 This should NOT be used as it merges instead of rebasing, which is not
0306 our workflow.