Pasando a utilizar flake8, es mas rapido y confiable
This commit is contained in:
3
.flake8
Normal file
3
.flake8
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[flake8]
|
||||||
|
max-line-length = 120
|
||||||
|
exclude = __pycache__,.git,.idea,static,venv,users/migrations/
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
image: python:latest
|
image: python:latest
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- Analisis Estatico
|
||||||
- deploy
|
- Deploy
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -y && apt-get upgrade -y
|
- apt-get update -y && apt-get upgrade -y
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: Analisis Estatico
|
||||||
script:
|
script:
|
||||||
- pip install -r requirements.txt -r requirements-dev.txt
|
- pip install -r requirements.txt -r requirements-dev.txt
|
||||||
- ./lint.sh
|
- flake8 .
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: Deploy
|
||||||
script:
|
script:
|
||||||
## Install ssh-agent if not already installed
|
## Install ssh-agent if not already installed
|
||||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
|
||||||
@@ -37,4 +37,3 @@ deploy:
|
|||||||
- apt-get install rsync -y
|
- apt-get install rsync -y
|
||||||
- rsync -rvz ./ deployer@142.93.158.54:/var/www/musiclist.danielcortes.xyz/server/
|
- rsync -rvz ./ deployer@142.93.158.54:/var/www/musiclist.danielcortes.xyz/server/
|
||||||
- ssh deployer@142.93.158.54 'cd /var/www/musiclist.danielcortes.xyz/server/; sh deploy.sh'
|
- ssh deployer@142.93.158.54 'cd /var/www/musiclist.danielcortes.xyz/server/; sh deploy.sh'
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ musicbrainz entrega exceptuando los errores.
|
|||||||
from urllib.parse import quote, urlencode
|
from urllib.parse import quote, urlencode
|
||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
from utils import sanitize_keys, ratelimit
|
from utils import sanitize_keys
|
||||||
|
from utils.ratelimit import ratelimit
|
||||||
|
|
||||||
HEADERS = {'accept': 'application/json', 'user-agent': 'MusicList/1.0 (danielcortes.xyz)'}
|
HEADERS = {'accept': 'application/json', 'user-agent': 'MusicList/1.0 (danielcortes.xyz)'}
|
||||||
MB_HOST = 'https://musicbrainz.org/ws/2'
|
MB_HOST = 'https://musicbrainz.org/ws/2'
|
||||||
|
|||||||
6
lint.sh
6
lint.sh
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
plugins="pylint_django"
|
|
||||||
good_names="db"
|
|
||||||
modules="fetcher lists musiclist users utils welcome"
|
|
||||||
pylint --load-plugins $plugins --good-names=$good_names $modules || pylint-exit --error-fail --warn-fail $?
|
|
||||||
exit $?
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
Configuración para servidor de producción
|
Configuración para servidor de producción
|
||||||
"""
|
"""
|
||||||
# pylint: disable=wildcard-import disable=unused-wildcard-import
|
import os
|
||||||
from musiclist.settings import *
|
from musiclist.settings import * # noqa: F403, F401
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
|
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
[ -d venv/ ] || python -m venv venv
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -r requirements.txt -r requirements-dev.txt
|
flake8 .
|
||||||
./lint.sh
|
exit $?
|
||||||
LINT_RESULT=$?
|
|
||||||
exit $LINT_RESULT
|
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
pylint # Linting
|
flake8 # Obligar a usar pep8
|
||||||
pylint-exit # Maps pylint exit codes to something sane for linux
|
|
||||||
pylint-django # Plugin for pylint that helps with django projects
|
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ from django.conf import settings
|
|||||||
|
|
||||||
import redis
|
import redis
|
||||||
from pygments import highlight
|
from pygments import highlight
|
||||||
from pygments.lexers import JsonLexer # pylint: disable=no-name-in-module
|
from pygments.lexers import JsonLexer
|
||||||
from pygments.formatters import TerminalTrueColorFormatter # pylint: disable=no-name-in-module
|
from pygments.formatters import TerminalTrueColorFormatter
|
||||||
|
|
||||||
from utils.ratelimit import ratelimit
|
|
||||||
|
|
||||||
_log = logging.getLogger('utils')
|
_log = logging.getLogger('utils')
|
||||||
_log.addHandler(logging.NullHandler())
|
_log.addHandler(logging.NullHandler())
|
||||||
|
|||||||
Reference in New Issue
Block a user