From 99b4ba55c5f73231a85f073c769093f6ca9d0405 Mon Sep 17 00:00:00 2001 From: chang-ning Date: Sun, 20 Aug 2017 22:02:46 +0800 Subject: [PATCH] Add lint test :octocat: --- .travis.yml | 1 + Makefile | 5 ++++- app.py | 6 ++++-- requirements.txt | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 366c274d..9f2fe9c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ install: - pip install -r requirements.txt script: + - make test - make clean && make sudo: false diff --git a/Makefile b/Makefile index 3745d40c..688ae699 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ REQUIREMENT = requirements.txt -.PHONY: build +.PHONY: build test build: html %: cd docs && make $@ + +test: + flake8 app.py diff --git a/app.py b/app.py index 8437a40d..3e62b123 100644 --- a/app.py +++ b/app.py @@ -3,12 +3,13 @@ """ import os -from flask import Flask, send_from_directory +from flask import Flask, abort, send_from_directory from flask_sslify import SSLify DIR = os.path.dirname(os.path.realpath(__file__)) ROOT = os.path.join(DIR, 'docs', '_build', 'html') + def find_key(token): if token == os.environ.get("ACME_TOKEN"): return os.environ.get("ACME_KEY") @@ -39,7 +40,8 @@ def index_redirection(): @app.route("/.well-known/acme-challenge/") def acme(token): key = find_key(token) - if key is None: abort(404) + if key is None: + abort(404) return key diff --git a/requirements.txt b/requirements.txt index 68e0ac18..cfa9eca3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,3 +17,4 @@ snowballstemmer==1.2.1 Sphinx==1.6.3 sphinx-rtd-theme==0.2.4 Werkzeug==0.12.2 +flake8==3.4.1