From 8582c62e16ba458231e1cbea75d5b3c30905016e Mon Sep 17 00:00:00 2001 From: Alexander Didyk Date: Wed, 15 Jun 2016 18:38:53 +0300 Subject: [PATCH] noqa check added --- Makefile | 7 +++++-- check_noqa.sh | 10 ++++++++++ fortytwo_test_task/settings/__init__.py | 1 + fortytwo_test_task/wsgi.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 check_noqa.sh diff --git a/Makefile b/Makefile index 24e89948c0..96ae71bb6e 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ MANAGE=django-admin.py SETTINGS=fortytwo_test_task.settings -test: +test: check_noqa PYTHONPATH=`pwd` DJANGO_SETTINGS_MODULE=$(SETTINGS) $(MANAGE) test - flake8 --exclude '*migrations*' apps fortytwo_test_task + flake8 --exclude '*migrations*,fortytwo_test_task/settings/__init__.py' apps fortytwo_test_task + +check_noqa: + bash check_noqa.sh run: PYTHONPATH=`pwd` DJANGO_SETTINGS_MODULE=$(SETTINGS) $(MANAGE) runserver diff --git a/check_noqa.sh b/check_noqa.sh new file mode 100644 index 0000000000..99f8e0245e --- /dev/null +++ b/check_noqa.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +fnd=$(grep -ri "\bnoqa\b" apps fortytwo_test_task) + +if [[ $fnd ]]; then + echo "WARNING: noqa statements were found" + exit 1 +else + exit 0 +fi \ No newline at end of file diff --git a/fortytwo_test_task/settings/__init__.py b/fortytwo_test_task/settings/__init__.py index 9013bbfd07..686c121fae 100644 --- a/fortytwo_test_task/settings/__init__.py +++ b/fortytwo_test_task/settings/__init__.py @@ -1,4 +1,5 @@ from .common import * + try: from .local import * except ImportError: diff --git a/fortytwo_test_task/wsgi.py b/fortytwo_test_task/wsgi.py index 6ba1919a2a..d9ccbd8e72 100644 --- a/fortytwo_test_task/wsgi.py +++ b/fortytwo_test_task/wsgi.py @@ -8,7 +8,7 @@ """ import os +from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fortytwo_test_task.settings") -from django.core.wsgi import get_wsgi_application application = get_wsgi_application()