Skip to content

Commit

Permalink
Add pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
pt1243 committed Oct 18, 2023
1 parent 393fa06 commit 9064ef5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ cython_debug/
.idea/

# VS Code
.vscode/
.vscode/
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
9 changes: 5 additions & 4 deletions requirements_dev.txt → requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
flake8
black
tox>=3.8
pytest
pytest-cov
coverage>=7
flake8
mypy
pre-commit
pytest
pytest-cov
tox>=3.8
24 changes: 12 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist =
envlist =
erase
py{38,39,310,311,312}
lint
Expand All @@ -12,60 +12,60 @@ skip_missing_interpreters = true

[testenv]
description = Run unit tests
setenv =
setenv =
py{38,39,310,311,312}: COVERAGE_FILE = .coverage.{envname}
deps =
deps =
pytest
pytest-cov
commands =
commands =
pytest
depends =
depends =
py{38,39,310,311,312}: erase
report: py{38,39,310,311,312}

[testenv:lint]
description = Lint with flake8
skip_install = true
deps =
deps =
flake8
commands = flake8 .

[testenv:type_check]
description = Type check with mypy
skip_install = true
deps =
deps =
mypy
-r requirements.txt
commands = mypy .

[testenv:format]
description = Format with black
skip_install = true
deps =
deps =
black
commands = black . --check

[testenv:erase]
description = Erase previous coverage
skip_install = true
deps =
deps =
coverage
commands = coverage erase

[testenv:report]
description = Generate coverage report
skip_install = true
deps = coverage
commands =
commands =
coverage combine
coverage html
coverage report

[flake8]
per-file-ignores =
per-file-ignores =
__init__.py:F401,F403
max-line-length = 120
exclude =
exclude =
.git
.tox
__pycache__
Expand Down

0 comments on commit 9064ef5

Please sign in to comment.