Add pre-commit hooks

This commit is contained in:
Valéry Febvre 2022-12-20 14:52:54 +01:00
parent 6c81f87ea4
commit 4eac098302
3 changed files with 41 additions and 0 deletions

30
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# Identify invalid files
- id: check-ast
- id: check-json
- id: check-yaml
# git checks
- id: check-merge-conflict
- id: check-added-large-files
- id: check-case-conflict
# Python checks
- id: check-docstring-first
- id: requirements-txt-fixer
- id: fix-byte-order-marker
# General quality checks
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: check-executables-have-shebangs
- id: end-of-file-fixer
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8

View File

@ -75,10 +75,16 @@ Komikku can be built in a Python virtual environment. However, some tools and de
```sh
# Create venv
python3 -m venv .venv
# Activate venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install
```
NOTE: Python package `file-magic` is an possible alternative to `python-magic`.

5
requirements-dev.txt Normal file
View File

@ -0,0 +1,5 @@
flake8
pre-commit
pycodestyle
pytest
pytest-steps