Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add pre commit hook for linting #217

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/black_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==19.3b pytest
pip install click==8.0.2
pip install -r app/requirements/testing.txt
pip install -r app/requirements/postgres.txt
- name: Analysing the code with pylint
run: |
Expand Down
19 changes: 19 additions & 0 deletions app/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

exclude: 'docs|node_modules|vendors|migrations|.git|.tox'
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
5 changes: 0 additions & 5 deletions app/dev_requirements.txt

This file was deleted.

12 changes: 5 additions & 7 deletions app/projects/tests.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import pytest
import json

import pytest
from django.test import TestCase
from django.urls import reverse
from django.conf import settings as django_settings
from django.test.client import RequestFactory
from projects.models import Project, Scenario, Viewer, Asset
from users.models import CustomUser
from django.core.exceptions import ValidationError

from django.urls import reverse
from projects.models import Project, Scenario, Asset
from projects.scenario_topology_helpers import (
load_scenario_from_dict,
load_project_from_dict,
)
from users.models import CustomUser


class BasicOperationsTest(TestCase):
Expand Down
8 changes: 5 additions & 3 deletions app/requirements/postgres.txt → app/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ django-extensions==3.0.9
Django==3.2.15
django-bootstrap-modal-forms==2.0.0
django-crispy-forms==1.9.2
django-compressor==4.1
django-jsonview==2.0.0
django-q==1.3.4
django-sass-processor==1.2.2
gunicorn==20.0.4
libsass==0.21.0
numpy>=1.22.4
openpyxl
openpyxl==3.0.10
httpx==0.18.1
psycopg2-binary==2.9.3
XlsxWriter==1.3.9
requests==2.24.0
exchangelib==4.4.0
jsonschema==4.4.0
plotly==5.6.0
oemof-thermal==0.0.5
oemof-thermal==0.0.5
8 changes: 8 additions & 0 deletions app/requirements/local.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-r ./base.txt

psycopg2-binary==2.9.3

black==22.10.0
click==8.0.3
pre-commit==2.20.0
pytest==7.2.0
Binary file removed app/requirements/mysql.txt
Binary file not shown.
3 changes: 3 additions & 0 deletions app/requirements/production.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r ./base.txt

psycopg2-binary==2.9.3
Binary file added app/requirements/production_mysql.txt
Binary file not shown.