Skip to content

Commit b9d0d17

Browse files
RobPasMuegerma89Revathyvenugopal162
authored
feat: adding pre-commit.ci config (#506)
* feat: adding pre-commit.ci config * fix: docstyle issues * Update doc/source/coding-style/formatting-tools.rst Co-authored-by: German <[email protected]> * Apply suggestions from code review Co-authored-by: Revathy Venugopal <[email protected]> * Update doc/source/coding-style/formatting-tools.rst Co-authored-by: Revathy Venugopal <[email protected]> --------- Co-authored-by: German <[email protected]> Co-authored-by: Revathy Venugopal <[email protected]>
1 parent dc29def commit b9d0d17

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

doc/source/coding-style/formatting-tools.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,51 @@ It is possible to run multiple environments by separating them with commas:
265265
``tox -e <env-name0>,<env-name1>,...``
266266

267267
To run all available environments, simply type ``tox``.
268+
269+
270+
The ``pre-commit.ci`` tool
271+
--------------------------
272+
273+
The goal of the `pre-commit.ci <https://pre-commit.ci/>`_ tool is to run the same hooks as the
274+
``pre-commit`` tool, but in a CI environment. This tool is useful for
275+
checking the code style of your project in a CI environment.
276+
277+
Although the PyAnsys ecosystem also has its own ``code-style`` action (see
278+
`Code style action <https://actions.docs.ansys.com/version/stable/style-actions/index.html#code-style-action>`_),
279+
the `pre-commit.ci`_ tool provides some additional features:
280+
281+
- It is free for public projects.
282+
- It is compatible with any CI provider.
283+
- It ensures that hook versions are up to date.
284+
- Any changes performed by the hooks are committed back to the repository.
285+
- It reduces CI run times by caching the hooks used.
286+
287+
To use the `pre-commit.ci`_ tool, you must have a ``.pre-commit-config.yaml`` file for your repository. Next,
288+
you should request the `PyAnsys Core team <pyansys_core_email_>`_ to enable the `pre-commit.ci`_ tool for your
289+
repository.
290+
291+
.. note::
292+
293+
The `pre-commit.ci`_ tool is not available for private repositories.
294+
295+
The PyAnsys ecosystem strongly recommends using the `pre-commit.ci`_ tool in your project. It is a
296+
great way to ensure that your code is compliant with the code style guidelines set by the PyAnsys ecosystem.
297+
298+
Using ``pre-commit.ci`` with conventional commits
299+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300+
301+
If you are using `conventional commits <https://www.conventionalcommits.org/en/v1.0.0/>`_ in your project,
302+
via the `check PR title <https://actions.docs.ansys.com/version/stable/style-actions/index.html#pull-request-title-action>`_,
303+
it is important to ensure that the commit messages are compliant with the conventional commits standard.
304+
305+
Use the following configuration in your ``.pre-commit-config.yaml`` file to be compliant:
306+
307+
.. code-block:: yaml
308+
309+
ci:
310+
autofix_commit_msg: 'chore: auto fixes from pre-commit hooks'
311+
autoupdate_commit_msg: 'chore: pre-commit automatic update'
312+
autoupdate_schedule: weekly
313+
314+
repos:
315+
# Your repository-specific configurations here

0 commit comments

Comments
 (0)