Skip to content

Commit 1516a20

Browse files
committed
feat: adding pre-commit.ci config
1 parent dc29def commit 1516a20

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 the hooks versions are up to date.
284+
- Any changes performed by the hooks are committed back to the repository.
285+
- Reduces the time spent on CI by means of a caching capability on the hooks used.
286+
287+
To use the `pre-commit.ci`_ tool, you must have a ``.pre-commit-config.yaml`` 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+
From the PyAnsys ecosystem, we strongly recommend 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 of 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+
We recommend using the following configuration in your ``.pre-commit-config.yaml`` file:
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+
...

0 commit comments

Comments
 (0)