diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..05632a9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,43 @@ +name: Lint + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + type: [ "opened", "reopened", "synchronize" ] + +env: + FORCE_COLOR: 1 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cache/pip + ~/.cache/pre-commit + key: + lint-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/.pre-commit-config.yaml') }} + restore-keys: | + lint-v1- + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install pre-commit + - name: Lint + run: | + pre-commit run --all-files --show-diff-on-failure + env: + PRE_COMMIT_COLOR: always diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2c33e2b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-encoding-pragma + args: [--remove] + - id: check-yaml + - id: debug-statements + language_version: python3 + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 + language_version: python3 + additional_dependencies: [flake8-typing-imports==1.9.0] + - repo: https://github.com/pre-commit/mirrors-autopep8 + rev: v1.5.4 + hooks: + - id: autopep8 + - repo: https://github.com/timothycrosley/isort + rev: 5.7.0 + hooks: + - id: isort + args: [--filter-files] + files: \.py$ + - repo: local + hooks: + - id: rst + name: rst + entry: rst-lint --encoding utf-8 + files: .rst + language: python + additional_dependencies: [pygments, restructuredtext_lint] diff --git a/LICENSE.txt b/LICENSE.txt index e374992..af05f50 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -41,4 +41,3 @@ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/MANIFEST.in b/MANIFEST.in index 01600da..6109c8d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,4 +4,3 @@ include .coveragerc include tox.ini recursive-include src *.txt *.zcml - diff --git a/setup.cfg b/setup.cfg index 526aeb2..61144b8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,10 @@ [bdist_wheel] universal = 0 + +[isort] +lines_between_sections = 0 +lines_after_imports = 2 +no_sections = True +from_first = True +lines_between_types = 0 +force_single_line = True diff --git a/setup.py b/setup.py index 6d573c0..a2172b4 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ -from setuptools import setup, find_packages +from setuptools import find_packages +from setuptools import setup setup( diff --git a/src/gocept/httpserverlayer/wsgi/__init__.py b/src/gocept/httpserverlayer/wsgi/__init__.py index 9e810fe..befb017 100644 --- a/src/gocept/httpserverlayer/wsgi/__init__.py +++ b/src/gocept/httpserverlayer/wsgi/__init__.py @@ -1,4 +1,5 @@ -from wsgiref.simple_server import WSGIServer, WSGIRequestHandler +from wsgiref.simple_server import WSGIRequestHandler +from wsgiref.simple_server import WSGIServer import os import plone.testing import threading diff --git a/src/gocept/httpserverlayer/zopeappwsgi/testing.zcml b/src/gocept/httpserverlayer/zopeappwsgi/testing.zcml index 9eea728..8f63e6d 100644 --- a/src/gocept/httpserverlayer/zopeappwsgi/testing.zcml +++ b/src/gocept/httpserverlayer/zopeappwsgi/testing.zcml @@ -46,4 +46,3 @@ - diff --git a/src/gocept/httpserverlayer/zopeappwsgi/tests.py b/src/gocept/httpserverlayer/zopeappwsgi/tests.py index d24affb..090c806 100644 --- a/src/gocept/httpserverlayer/zopeappwsgi/tests.py +++ b/src/gocept/httpserverlayer/zopeappwsgi/tests.py @@ -1,5 +1,5 @@ -import gocept.httpserverlayer.tests.isolation from gocept.httpserverlayer.zopeappwsgi.testing import ZODB_LAYER +import gocept.httpserverlayer.tests.isolation import unittest