Skip to content

CI CD with pre commit hooks and pytest

Pham Truong Duy edited this page Mar 23, 2021 · 2 revisions

Hi guys,

I set up the pre-commit for stLearn then if you want to make a pull request, please follow this instruction:

Step 1:

Install the pre-commit by this https://pre-commit.com/. Please follow their Quick start tutorial but change the second step by (add .pre-commit-config.yaml file):

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.4.0
    hooks:
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
    -   id: check-added-large-files
    -   id: check-docstring-first
    -   id: check-byte-order-marker
    -   id: requirements-txt-fixer

-   repo: https://github.com/psf/black
    rev: 20.8b1
    hooks:
    -   id: black

Step 2:

You add the file to commit and do the commit. After that, it will show you some error in format and automatically fix them for you.

Step 3: You need to do the git add and git commit again for the fixed files. And you will see you pass all the tests

All now ready to push your commit.

Clone this wiki locally