diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 5a259905..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,40 +0,0 @@ -stages: - - test - -test: - stage: test - image: python:3.6 - variables: - PIP_CACHE_DIR: "pip-cache" - POSTGRES_DB: alexandria - POSTGRES_USER: alexandria - POSTGRES_PASSWORD: alexandria - DATABASE_HOST: postgres - script: - - echo "ENV=ci" > .env - - make install-dev - - make test - services: - - postgres - cache: - key: "$CI_PROJECT_NAME" - paths: - - pip-cache - - -# Pyup example: Configure USER_TOKEN as secret environment variables -# and potentially adjust gitlab.com with your custom instance -# pyup: -# stage: test -# image: python:3.6 -# variables: -# PIP_CACHE_DIR: "pip-cache" -# cache: -# key: "$CI_PROJECT_NAME" -# paths: -# - pip-cache -# script: -# - pip install -U pyupio -# - pyup --provider gitlab --repo=$CI_PROJECT_ID --user-token=$USER_TOKEN@https://gitlab.com -# only: -# - master diff --git a/.gitlint b/.gitlint new file mode 100644 index 00000000..21b2a4d7 --- /dev/null +++ b/.gitlint @@ -0,0 +1,2 @@ +[general] +ignore=body-is-missing, body-max-line-length, body-min-length diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49bbe46e..4f155f73 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,27 @@ repos: - repo: local hooks: - - id: black - name: black - language: system - entry: black - types: [python] - - id: isort - name: isort - language: system - entry: isort -y - types: [python] - - id: flake8 - name: flake8 - language: system - entry: flake8 - types: [python] + - id: black + stages: [commit] + name: black + language: system + entry: black + types: [python] + - id: isort + stages: [commit] + name: isort + language: system + entry: isort -y + types: [python] + - id: flake8 + stages: [commit] + name: flake8 + language: system + entry: flake8 + types: [python] + - id: gitlint + stages: [commit-msg] + name: gitlint + description: Validate commit lint + entry: gitlint --msg-filename + language: system diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 201db052..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python - -env: - - DOCKER_COMPOSE_VERSION=1.21.0 - -python: - - "3.6" - -services: - - docker - -before_install: - # install newer compose version - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - # Workaround for https://github.com/travis-ci/travis-ci/issues/4842 - # Let's stop postgresql - - sudo service postgresql stop - # wait for postgresql to shutdown - - while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done - - # set UID to run docker service with - - echo "UID=$(id --user)" > .env - -install: make start - -script: make test diff --git a/alexandria/conftest.py b/alexandria/conftest.py index 135b814f..d1d57211 100644 --- a/alexandria/conftest.py +++ b/alexandria/conftest.py @@ -16,11 +16,7 @@ def register_module(module): register(obj, base_name) -register_module( - importlib.import_module( - ".core.factories", "alexandria" - ) -) +register_module(importlib.import_module(".core.factories", "alexandria")) @pytest.fixture diff --git a/alexandria/settings.py b/alexandria/settings.py index b43495b4..30ff5c49 100644 --- a/alexandria/settings.py +++ b/alexandria/settings.py @@ -55,9 +55,7 @@ def default(default_dev=env.NOTSET, default_prod=env.NOTSET): ), "NAME": env.str("DATABASE_NAME", default="alexandria"), "USER": env.str("DATABASE_USER", default="alexandria"), - "PASSWORD": env.str( - "DATABASE_PASSWORD", default=default("alexandria") - ), + "PASSWORD": env.str("DATABASE_PASSWORD", default=default("alexandria")), "HOST": env.str("DATABASE_HOST", default="localhost"), "PORT": env.str("DATABASE_PORT", default=""), "OPTIONS": env.dict("DATABASE_OPTIONS", default={}), diff --git a/alexandria/urls.py b/alexandria/urls.py index 67b41833..2be7f545 100644 --- a/alexandria/urls.py +++ b/alexandria/urls.py @@ -5,8 +5,5 @@ urlpatterns = [ path("api-token-auth/", TokenObtainPairView.as_view(), name="login"), path("api-token-refresh/", TokenRefreshView.as_view(), name="refresh"), - path( - "api/v1/", - include("alexandria.core.urls"), - ), + path("api/v1/", include("alexandria.core.urls"),), ] diff --git a/alexandria/wsgi.py b/alexandria/wsgi.py index 5830a058..a580e5ff 100644 --- a/alexandria/wsgi.py +++ b/alexandria/wsgi.py @@ -11,8 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault( - "DJANGO_SETTINGS_MODULE", "alexandria.settings" -) +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alexandria.settings") application = get_wsgi_application() diff --git a/manage.py b/manage.py index d7e4e112..07d16ce2 100755 --- a/manage.py +++ b/manage.py @@ -6,9 +6,7 @@ import sys if __name__ == "__main__": - os.environ.setdefault( - "DJANGO_SETTINGS_MODULE", "alexandria.settings" - ) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alexandria.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv) diff --git a/requirements-dev.txt b/requirements-dev.txt index b1d45c95..0fdac42b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,6 +8,7 @@ flake8-docstrings==1.5.0 flake8-isort==2.9.1 flake8-string-format==0.3.0 flake8-tuple==0.4.1 +gitlint==0.13.1 isort==4.3.21 pdbpp==0.10.2 pytest==5.4.1