Skip to content

Commit

Permalink
change: Add conventional precommit linter
Browse files Browse the repository at this point in the history
  • Loading branch information
radimkarnis committed Jun 28, 2023
1 parent f542148 commit cc58f69
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ repos:
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/espressif/conventional-precommit-linter
rev: v1.1.0
hooks:
- id: conventional-precommit-linter
stages: [commit-msg]
default_install_hook_types: [pre-commit, commit-msg]
11 changes: 8 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,20 @@ Pre-commit checks

`pre-commit <https://pre-commit.com/>`_ is a framework for managing pre-commit hooks. These hooks help to identify simple issues before committing code for review.

To use the tool, first install ``pre-commit`` and then the git hooks:
To use the tool, first install ``pre-commit``. Then enable the ``pre-commit`` and ``commit-msg`` git hooks:

::

$ python -m pip install pre-commit
$ pre-commit install
$ pre-commit install -t pre-commit -t commit-msg

On the first commit ``pre-commit`` will install the hooks, subsequent checks will be significantly faster. If an error is found an appropriate error message will be displayed. If the error was with ``black`` then the tool will fix them for you automatically. Review the changes and re-stage for commit if you are happy with them.

Conventional Commits
""""""""""""""""""""

``esptool.py`` complies with the `Conventional Commits standard <https://www.conventionalcommits.org/en/v1.0.0/#specification>`_. Every commit message is checked with `Conventional Precommit Linter <https://github.com/espressif/conventional-precommit-linter>`_, ensuring it adheres to the standard.

Flake8
""""""

Expand All @@ -97,7 +102,7 @@ Black

All files should be formatted using the `Black <https://black.readthedocs.io/en/stable/index.html>`_ auto-formatter.

``Black`` and ``flake8`` tools will be automatically run by ``pre-commit`` if that is configured. To check your code manually before submitting, run ``python -m flake8`` and ``black .`` (the tools are installed as part of the development requirements shown at the beginning of this document).
``Black``, ``flake8``, and ``Conventional Precommit Linter`` tools will be automatically run by ``pre-commit`` if that is configured. To check your code manually before submitting, run ``python -m flake8`` and ``black .`` (the tools are installed as part of the development requirements shown at the beginning of this document).

When you submit a Pull Request, the GitHub Actions automated build system will run automated checks using these tools.

Expand Down

0 comments on commit cc58f69

Please sign in to comment.