Skip to content
38 changes: 29 additions & 9 deletions doc/developer.contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This section provides guidelines for contributing to Gambit, including how to re
It includes information relevant to both core developers and external contributors.

GitHub issues
----------------
-------------

In the first instance, bug reports, feature requests and improvements to the Gambit documentation should be
posted to the Gambit issue tracker, located at
Expand All @@ -25,7 +25,7 @@ When reporting a bug, please be sure to include the following:
.. _contributing-code:

Contributing code
----------------
-----------------

Gambit is an open-source project, and contributions are welcome from anyone.
The project is hosted on GitHub, and contributions can be made via pull requests following the standard GitHub workflow.
Expand All @@ -47,21 +47,41 @@ version.

3. Follow the instructions in the :ref:`building-from-source` page to set up your development environment and build Gambit from source. If you only plan to make changes to the PyGambit Python code, you can skip to :ref:`build-python`.

4. Create a new branch for your changes ::
4. *[Optional but recommended]* Install `pre-commit` which is used to run code formatters and linters before each commit. This helps ensure code quality and consistency. You can install it into the virtual environment where you installed PyGambit ::

pip install pre-commit

Alternatively, `pre-commit` is also available via various packaging systems. For example, you can install via `Homebrew <https://brew.sh>`__ ::

brew install pre-commit

If you install via a package manager (instead of into the virtual environment), `pre-commit` will be available for use with other projects.

Then, set it up in the Gambit repository ::

pre-commit install

Having `pre-commit` installed is recommended as it runs many of the same checks that are automatically conducted on any pull request. Every time you commit, it will automatically fix some issues and highlight others for manual adjustment.

5. Create a new branch for your changes ::

git checkout -b feature/your-feature-name

5. Make your changes. Commit each change with a clear commit message ::
6. Make your changes. ::

git add <files>
git commit -m "Clear and descriptive commit message"

git add .
git commit -m "Add feature X or fix bug Y"
Provide a clear commit message. Gambit does not have its own set of guidelines for commit messages.
However, there are a number of webpages that have suggestions for writing effective commit messages (and for deciding how to structure your contributions as one or more
commits as appropriate). See for example `this page <https://wiki.openstack.org/wiki/GitCommitMessages>`__.

6. Push your changes to your fork or branch ::
7. Push your changes to your fork or branch ::

git push origin feature/your-feature-name

7. Open a pull request on GitHub to the master branch of the upstream repository, describing your changes and linking to any relevant issues.
8. Core developers will review your changes, provide feedback, and merge them into the master branch if they meet the project's standards.
8. Open a pull request on GitHub to the master branch of the upstream repository, describing your changes and linking to any relevant issues.
9. Core developers will review your changes, provide feedback, and merge them into the master branch if they meet the project's standards.

Testing your changes
--------------------
Expand Down