add pre-commit

This commit is contained in:
Matthias 2022-05-16 00:15:25 +02:00
parent 432fd9b8e6
commit f1553337f7
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093
3 changed files with 26 additions and 1 deletions

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

@ -0,0 +1,11 @@
# 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.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: mixed-line-ending

View File

@ -39,6 +39,7 @@ inventree # Install the latest version of the Inve
markdown==3.3.4 # Force particular version of markdown
pep8-naming==0.11.1 # PEP naming convention extension
pillow==9.0.1 # Image manipulation
pre-commit==2.19.0 # Git pre-commit
py-moneyed==0.8.0 # Specific version requirement for py-moneyed
pygments==2.7.4 # Syntax highlighting
python-barcode[images]==0.13.1 # Barcode generator

View File

@ -98,6 +98,19 @@ def install(c):
# Install required Python packages with PIP
c.run('pip3 install -U -r requirements.txt')
def setup_dev(c):
"""
Sets up everything needed for the dev enviroment
"""
print("Installing required python packages from 'requirements.txt'")
# Install required Python packages with PIP
c.run('pip3 install -U -r requirements.txt')
# Install pre-commit hook
c.run('pre-commit install')
@task
def shell(c):
"""
@ -253,7 +266,7 @@ def update(c):
- static
- clean_settings
"""
# Recompile the translation files (.mo)
# We do not run 'invoke translate' here, as that will touch the source (.po) files too!
manage(c, 'compilemessages', pty=True)