From 1516a20a7324813460567ba6b805381731abe2e0 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:34:56 +0200 Subject: [PATCH 1/5] feat: adding pre-commit.ci config --- doc/source/coding-style/formatting-tools.rst | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/doc/source/coding-style/formatting-tools.rst b/doc/source/coding-style/formatting-tools.rst index e9012b957..b30fedf8a 100644 --- a/doc/source/coding-style/formatting-tools.rst +++ b/doc/source/coding-style/formatting-tools.rst @@ -265,3 +265,51 @@ It is possible to run multiple environments by separating them with commas: ``tox -e ,,...`` To run all available environments, simply type ``tox``. + + +The ``pre-commit.ci`` tool +-------------------------- + +The goal of the `pre-commit.ci `_ tool is to run the same hooks as the +``pre-commit`` tool, but in a CI environment. This tool is useful for +checking the code style of your project in a CI environment. + +Although the PyAnsys ecosystem also has its own ``code-style`` action (see +`Code style action `_), +the `pre-commit.ci`_ tool provides some additional features: + +- It is free for public projects. +- It is compatible with any CI provider. +- It ensures that the hooks versions are up to date. +- Any changes performed by the hooks are committed back to the repository. +- Reduces the time spent on CI by means of a caching capability on the hooks used. + +To use the `pre-commit.ci`_ tool, you must have a ``.pre-commit-config.yaml`` for your repository. Next, +you should request the `PyAnsys Core team `_ to enable the `pre-commit.ci`_ tool for your +repository. + +.. note:: + + The `pre-commit.ci`_ tool is not available for private repositories. + +From the PyAnsys ecosystem, we strongly recommend using the `pre-commit.ci`_ tool in your project. It is a +great way to ensure that your code is compliant with the code style guidelines of the PyAnsys ecosystem. + +Using ``pre-commit.ci`` with conventional commits +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you are using `conventional commits `_ in your project, +via the `check PR title `_, +it is important to ensure that the commit messages are compliant with the conventional commits standard. + +We recommend using the following configuration in your ``.pre-commit-config.yaml`` file: + +.. code-block:: yaml + + ci: + autofix_commit_msg: 'chore: auto fixes from pre-commit hooks' + autoupdate_commit_msg: 'chore: pre-commit automatic update' + autoupdate_schedule: weekly + + repos: + ... From 6b09ca9b584634cf079d56f8de8d24aa288bada5 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:48:09 +0200 Subject: [PATCH 2/5] fix: docstyle issues --- doc/source/coding-style/formatting-tools.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/coding-style/formatting-tools.rst b/doc/source/coding-style/formatting-tools.rst index b30fedf8a..88e34c510 100644 --- a/doc/source/coding-style/formatting-tools.rst +++ b/doc/source/coding-style/formatting-tools.rst @@ -292,7 +292,7 @@ repository. The `pre-commit.ci`_ tool is not available for private repositories. -From the PyAnsys ecosystem, we strongly recommend using the `pre-commit.ci`_ tool in your project. It is a +From the PyAnsys ecosystem, it is strongly recommended to use the `pre-commit.ci`_ tool in your project. It is a great way to ensure that your code is compliant with the code style guidelines of the PyAnsys ecosystem. Using ``pre-commit.ci`` with conventional commits @@ -302,7 +302,7 @@ If you are using `conventional commits `_, it is important to ensure that the commit messages are compliant with the conventional commits standard. -We recommend using the following configuration in your ``.pre-commit-config.yaml`` file: +Use the following configuration in your ``.pre-commit-config.yaml`` file to be compliant: .. code-block:: yaml From 2ee767413645c2722ddab9ae0d042b4cc2d534bf Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:12:13 +0200 Subject: [PATCH 3/5] Update doc/source/coding-style/formatting-tools.rst Co-authored-by: German <28149841+germa89@users.noreply.github.com> --- doc/source/coding-style/formatting-tools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/coding-style/formatting-tools.rst b/doc/source/coding-style/formatting-tools.rst index 88e34c510..323cf2838 100644 --- a/doc/source/coding-style/formatting-tools.rst +++ b/doc/source/coding-style/formatting-tools.rst @@ -282,7 +282,7 @@ the `pre-commit.ci`_ tool provides some additional features: - It is compatible with any CI provider. - It ensures that the hooks versions are up to date. - Any changes performed by the hooks are committed back to the repository. -- Reduces the time spent on CI by means of a caching capability on the hooks used. +- Reduces the time spent running CI by caching the hooks used. To use the `pre-commit.ci`_ tool, you must have a ``.pre-commit-config.yaml`` for your repository. Next, you should request the `PyAnsys Core team `_ to enable the `pre-commit.ci`_ tool for your From 71f690215f38682b29c61acaa9f2693edf546137 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:06:07 +0200 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> --- doc/source/coding-style/formatting-tools.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/coding-style/formatting-tools.rst b/doc/source/coding-style/formatting-tools.rst index 323cf2838..c498d94d1 100644 --- a/doc/source/coding-style/formatting-tools.rst +++ b/doc/source/coding-style/formatting-tools.rst @@ -280,11 +280,11 @@ the `pre-commit.ci`_ tool provides some additional features: - It is free for public projects. - It is compatible with any CI provider. -- It ensures that the hooks versions are up to date. +- It ensures that hook versions are up to date. - Any changes performed by the hooks are committed back to the repository. -- Reduces the time spent running CI by caching the hooks used. +- It reduces CI run times by caching the hooks used. -To use the `pre-commit.ci`_ tool, you must have a ``.pre-commit-config.yaml`` for your repository. Next, +To use the `pre-commit.ci`_ tool, you must have a ``.pre-commit-config.yaml`` file for your repository. Next, you should request the `PyAnsys Core team `_ to enable the `pre-commit.ci`_ tool for your repository. @@ -292,8 +292,8 @@ repository. The `pre-commit.ci`_ tool is not available for private repositories. -From the PyAnsys ecosystem, it is strongly recommended to use the `pre-commit.ci`_ tool in your project. It is a -great way to ensure that your code is compliant with the code style guidelines of the PyAnsys ecosystem. +The PyAnsys ecosystem strongly recommends using the `pre-commit.ci`_ tool in your project. It is a +great way to ensure that your code is compliant with the code style guidelines set by the PyAnsys ecosystem. Using ``pre-commit.ci`` with conventional commits ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 494f3a08f7e9f50ff175a9bbedbb3960707b6601 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:06:13 +0200 Subject: [PATCH 5/5] Update doc/source/coding-style/formatting-tools.rst Co-authored-by: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> --- doc/source/coding-style/formatting-tools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/coding-style/formatting-tools.rst b/doc/source/coding-style/formatting-tools.rst index c498d94d1..d8b565d1a 100644 --- a/doc/source/coding-style/formatting-tools.rst +++ b/doc/source/coding-style/formatting-tools.rst @@ -312,4 +312,4 @@ Use the following configuration in your ``.pre-commit-config.yaml`` file to be c autoupdate_schedule: weekly repos: - ... + # Your repository-specific configurations here