Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pre-commit #20

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
max-line-length = 120
extend-exclude =
docs/*,
setup.py
extend-ignore = E203
per-file-ignores =
*/__init__.py:F401,F403
examples/*,tests/*:E402
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
name: CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

Expand All @@ -21,6 +19,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
# requites to grab the history of the PR
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
Expand All @@ -29,12 +30,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements/ci_requirements.txt
- name: Analysing the code with pylint
run: |
pylint mindpet --rcfile=.github/pylint.conf
- name: Lint with pre-commit
uses: pre-commit/[email protected]
with:
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
- name: Test with unit test (UT) pytest
run: |
pytest test/unit_test
- name: Test with system test (ST) pytest
run: |
pytest test/developer_test
pytest test/developer_test
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
# list of supported hooks: https://pre-commit.com/hooks.html
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
args: ['--profile', 'black']

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

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8

- repo: https://github.com/pylint-dev/pylint
rev: v2.14.5
hooks:
- id: pylint
args: [ "-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I" ]
exclude: tests(/\w*)*/functional/|tests/input|tests(/\w*)*data/|doc/
Loading