Skip to content

Commit e389a88

Browse files
Add pre-commit install as a step in developer docs (#610)
* test * Revert "test" This reverts commit 5beb3c2. * add pre-commit install as a step in developer docs * Update developer.contributing.rst * Clarify instructions for committing changes in developer documentation * install * revise text on what pre-commit does to indicate it auto-fixes some issues --------- Co-authored-by: Ted Turocy <[email protected]>
1 parent 67cb1f5 commit e389a88

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

doc/developer.contributing.rst

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This section provides guidelines for contributing to Gambit, including how to re
55
It includes information relevant to both core developers and external contributors.
66

77
GitHub issues
8-
----------------
8+
-------------
99

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

2727
Contributing code
28-
----------------
28+
-----------------
2929

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

4848
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`.
4949

50-
4. Create a new branch for your changes ::
50+
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 ::
51+
52+
pip install pre-commit
53+
54+
Alternatively, `pre-commit` is also available via various packaging systems. For example, you can install via `Homebrew <https://brew.sh>`__ ::
55+
56+
brew install pre-commit
57+
58+
If you install via a package manager (instead of into the virtual environment), `pre-commit` will be available for use with other projects.
59+
60+
Then, set it up in the Gambit repository ::
61+
62+
pre-commit install
63+
64+
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.
65+
66+
5. Create a new branch for your changes ::
5167

5268
git checkout -b feature/your-feature-name
5369

54-
5. Make your changes. Commit each change with a clear commit message ::
70+
6. Make your changes. ::
71+
72+
git add <files>
73+
git commit -m "Clear and descriptive commit message"
5574

56-
git add .
57-
git commit -m "Add feature X or fix bug Y"
75+
Provide a clear commit message. Gambit does not have its own set of guidelines for commit messages.
76+
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
77+
commits as appropriate). See for example `this page <https://wiki.openstack.org/wiki/GitCommitMessages>`__.
5878

59-
6. Push your changes to your fork or branch ::
79+
7. Push your changes to your fork or branch ::
6080

6181
git push origin feature/your-feature-name
6282

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

6686
Testing your changes
6787
--------------------

0 commit comments

Comments
 (0)