Skip to content

Commit

Permalink
feat($GitHooks): add more hooks for pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Sep 17, 2022
1 parent 99ca066 commit 5114647
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 51 deletions.
110 changes: 59 additions & 51 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,61 @@
# See https://pre-commit.com/ for usage and config
repos:
- repo: local
hooks:
- id: isort
name: isort
stages: [commit]
language: system
entry: pipenv run isort
types: [python]

- id: black
name: black
stages: [commit]
language: system
entry: pipenv run black
types: [python]

- id: flake8
name: flake8
stages: [commit]
language: system
entry: pipenv run flake8
types: [python]
exclude: setup.py

- id: mypy
name: mypy
stages: [commit]
language: system
entry: pipenv run mypy
types: [python]
require_serial: true

- id: pytest
name: pytest
stages: [commit]
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: pipenv run pytest --cov --cov-report html --html=./build/.pytest_report/report.html --self-contained-html --log-cli-level=DEBUG -n auto
types: [python]
pass_filenames: false

- id: pytest-cov
name: pytest
stages: [push]
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: pipenv run pytest --cov --cov-fail-under=85 --capture=no --log-cli-level=INFO -n auto
types: [python]
pass_filenames: false
# https://github.com/pre-commit/pre-commit-hooks/releases/tag/v4.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ --fix, lf ]
- id: check-yaml
- id: debug-statements
- id: name-tests-test
args: [ --pytest-test-first ]
- id: detect-private-key
- repo: local
hooks:
- id: isort
name: isort
stages: [ commit ]
language: system
entry: pipenv run isort
types: [ python ]
- id: black
name: black
stages: [ commit ]
language: system
entry: pipenv run black
types: [ python ]
- id: flake8
name: flake8
stages: [ commit ]
language: system
entry: pipenv run flake8
types: [ python ]
exclude: setup.py
- id: mypy
name: mypy
stages: [ commit ]
language: system
entry: pipenv run mypy
types: [ python ]
require_serial: true
- id: pytest
name: pytest
stages: [ commit ]
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: pipenv run pytest --cov --cov-report html --html=./build/.pytest_report/report.html --self-contained-html --log-cli-level=DEBUG -n auto
types: [ python ]
pass_filenames: false
- id: pytest-cov
name: pytest
stages: [ push ]
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: pipenv run pytest --cov --cov-fail-under=85 --capture=no --log-cli-level=INFO -n auto
types: [ python ]
pass_filenames: false
12 changes: 12 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
[metadata]
name = python_boilerplate
version = 3.0.0
description = A boilerplate project for Python.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/johnnymillergh/python_boilerplate
author = Johnny Miller
author_email = [email protected]
license = Apache License 2.0
license_file = LICENSE

[flake8]
ignore = E203, E266, E501, W503
; PEP 8 - Maximum Line Length, https://peps.python.org/pep-0008/#maximum-line-length
Expand Down

0 comments on commit 5114647

Please sign in to comment.