mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
c9d4268c34
19
.pre-commit-config.yaml
Normal file
19
.pre-commit-config.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
# 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
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: '4.0.1'
|
||||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: '5.10.1'
|
||||
hooks:
|
||||
- id: isort
|
@ -1,5 +1,9 @@
|
||||
Please read the contribution guidelines below, before submitting your first pull request to the InvenTree codebase.
|
||||
|
||||
## Setup
|
||||
|
||||
Please run `invoke setup_dev` in the root directory of your InvenTree code base to set up your development setup before starting to contribute. This will install and set up pre-commit to run some checks before each commit and help reduce the style errors.
|
||||
|
||||
## Branches and Versioning
|
||||
|
||||
InvenTree roughly follow the [GitLab flow](https://docs.gitlab.com/ee/topics/gitlab_flow.html) branching style, to allow simple management of multiple tagged releases, short-lived branches, and development on the main branch.
|
||||
@ -90,7 +94,8 @@ The various github actions can be found in the `./github/workflows` directory
|
||||
|
||||
## Code Style
|
||||
|
||||
Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR.
|
||||
Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR.
|
||||
Please write docstrings for each function and class - we follow the [google doc-style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) for python. Docstrings for general javascript code is encouraged! Docstyles are checked by `invoke style`.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
@ -33,12 +33,14 @@ django-weasyprint==1.0.1 # django weasyprint integration
|
||||
djangorestframework==3.12.4 # DRF framework
|
||||
django-xforwardedfor-middleware==2.0 # IP forwarding metadata
|
||||
flake8==3.8.3 # PEP checking
|
||||
flake8-docstrings==1.6.0 # docstring format testing
|
||||
gunicorn>=20.1.0 # Gunicorn web server
|
||||
importlib_metadata # Backport for importlib.metadata
|
||||
inventree # Install the latest version of the InvenTree API python library
|
||||
isort==5.10.1 # DEV: python import sorting
|
||||
markdown==3.3.4 # Force particular version of markdown
|
||||
pep8-naming==0.11.1 # PEP naming convention extension
|
||||
pre-commit==2.19.0 # Git pre-commit
|
||||
pillow==9.1.0 # Image manipulation
|
||||
py-moneyed==0.8.0 # Specific version requirement for py-moneyed
|
||||
pygments==2.7.4 # Syntax highlighting
|
||||
|
@ -15,8 +15,11 @@ ignore =
|
||||
N806,
|
||||
# - N812 - lowercase imported as non-lowercase
|
||||
N812,
|
||||
# - D415 - First line should end with a period, question mark, or exclamation point
|
||||
D415,
|
||||
exclude = .git,__pycache__,*/migrations/*,*/lib/*,*/bin/*,*/media/*,*/static/*,InvenTree/plugins/*
|
||||
max-complexity = 20
|
||||
docstring-convention=google
|
||||
|
||||
[coverage:run]
|
||||
source = ./InvenTree
|
||||
|
19
tasks.py
19
tasks.py
@ -94,6 +94,23 @@ def install(c):
|
||||
# Install required Python packages with PIP
|
||||
c.run('pip3 install -U -r requirements.txt')
|
||||
|
||||
@task
|
||||
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')
|
||||
|
||||
# Update all the hooks
|
||||
c.run('pre-commit autoupdate')
|
||||
|
||||
@task
|
||||
def shell(c):
|
||||
"""
|
||||
@ -249,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)
|
||||
|
Loading…
Reference in New Issue
Block a user