Pasando a utilizar flake8, es mas rapido y confiable

This commit is contained in:
Daniel Cortes
2020-06-11 04:59:06 -04:00
parent 1d4c5f28ac
commit 83c095e4ec
8 changed files with 17 additions and 28 deletions

3
.flake8 Normal file
View File

@@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
exclude = __pycache__,.git,.idea,static,venv,users/migrations/

View File

@@ -1,20 +1,20 @@
image: python:latest
stages:
- test
- deploy
- Analisis Estatico
- Deploy
before_script:
- apt-get update -y && apt-get upgrade -y
test:
stage: test
stage: Analisis Estatico
script:
- pip install -r requirements.txt -r requirements-dev.txt
- ./lint.sh
- flake8 .
deploy:
stage: deploy
stage: Deploy
script:
## Install ssh-agent if not already installed
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
@@ -37,4 +37,3 @@ deploy:
- apt-get install rsync -y
- 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'

View File

@@ -6,7 +6,8 @@ musicbrainz entrega exceptuando los errores.
from urllib.parse import quote, urlencode
import logging
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)'}
MB_HOST = 'https://musicbrainz.org/ws/2'

View File

@@ -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 $?

View File

@@ -1,8 +1,8 @@
"""
Configuración para servidor de producción
"""
# pylint: disable=wildcard-import disable=unused-wildcard-import
from musiclist.settings import *
import os
from musiclist.settings import * # noqa: F403, F401
DEBUG = False
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')

View File

@@ -1,10 +1,6 @@
#!/bin/sh
set -eu
[ -d venv/ ] || python -m venv venv
. venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
./lint.sh
LINT_RESULT=$?
exit $LINT_RESULT
flake8 .
exit $?

View File

@@ -1,3 +1 @@
pylint # Linting
pylint-exit # Maps pylint exit codes to something sane for linux
pylint-django # Plugin for pylint that helps with django projects
flake8 # Obligar a usar pep8

View File

@@ -9,10 +9,8 @@ from django.conf import settings
import redis
from pygments import highlight
from pygments.lexers import JsonLexer # pylint: disable=no-name-in-module
from pygments.formatters import TerminalTrueColorFormatter # pylint: disable=no-name-in-module
from utils.ratelimit import ratelimit
from pygments.lexers import JsonLexer
from pygments.formatters import TerminalTrueColorFormatter
_log = logging.getLogger('utils')
_log.addHandler(logging.NullHandler())