Skip to content

Commit

Permalink
Merge branch 'distinguished_use_of_pre_commit_for_committing_and_lint…
Browse files Browse the repository at this point in the history
…ing_#419'

Closes #418
  • Loading branch information
nicolaiarocci committed Jul 6, 2018
2 parents f4b78f8 + 8f5556f commit 316cf57
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 50 deletions.
19 changes: 19 additions & 0 deletions .linting-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# mind that a similar file exists for pre-commit usage
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
args: [--check, --safe, --skip-string-normalization, cerberus, setup.py]
python_version: python3.6
types:
- python
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: check-yaml
types:
- yaml
- id: debug-statements
types:
- python
27 changes: 15 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# mind that a similar file exists for linting usage
repos:
- repo: https://github.com/ambv/black
# TODO switch to 'stable' once --skip-string-normalization lands on it
rev: master
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
args: [--quiet, --safe, --skip-string-normalization]
python_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
- id: black
args: [--quiet, --safe, --skip-string-normalization, cerberus, setup.py]
python_version: python3.6
types:
- python
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: flake8
- id: check-yaml
types:
- yaml
- id: debug-statements
types:
- python
16 changes: 0 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
sudo: false
language: python
stages:
- linting
- test
cache: pip
python:
- 2.7
Expand All @@ -13,16 +10,3 @@ python:
- pypy3
install: travis_retry pip install tox-travis
script: tox --recreate

jobs:
include:
- stage: linting
python: '3.6'
env:
install:
- pip install pre-commit
- pre-commit install-hooks
before_script:
services:
script:
- pre-commit run --all-files
2 changes: 0 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Improved
~~~~~~~~
- Reformat code to match Black code-style (`#402`_)
- Perform lint checks and fixes on staged files, as a pre-commit hook (`#402`_)
- Performm linting checks as CI first stage. On failure, do not run the test
suite (`#402`_).
- Change ``allowed`` rule to use containers instead of lists (`#384`_)
- Remove ``Registry`` from top level namespace (`#354`_)
- Remove ``utils.is_class``
Expand Down
17 changes: 10 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Cerberus |latest-version|
=========================
|build-status| |python-support|
|build-status| |python-support| |black|

Cerberus is a lightweight and extensible data validation library for Python.

Expand Down Expand Up @@ -110,15 +110,18 @@ for more information.
.. _PyPI: https://pypi.python.org/
.. _semantical versioning: https://semver.org/

.. |latest-version| image:: https://img.shields.io/pypi/v/cerberus.svg
:alt: Latest version on PyPI
:target: https://pypi.org/project/cerberus
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:alt: Black code style
:target: https://black.readthedocs.io/
.. |build-status| image:: https://travis-ci.org/pyeve/cerberus.svg?branch=master
:alt: Build status
:target: https://travis-ci.org/pyeve/cerberus
.. |python-support| image:: https://img.shields.io/pypi/pyversions/cerberus.svg
:target: https://pypi.python.org/pypi/cerberus
:alt: Python versions
.. |latest-version| image:: https://img.shields.io/pypi/v/cerberus.svg
:alt: Latest version on PyPI
:target: https://pypi.org/project/cerberus
.. |license| image:: https://img.shields.io/pypi/l/cerberus.svg
:alt: Software license
:target: https://github.com/pyeve/cerberus/blob/master/LICENSE
.. |python-support| image:: https://img.shields.io/pypi/pyversions/cerberus.svg
:target: https://pypi.python.org/pypi/cerberus
:alt: Python versions
17 changes: 4 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
[tox]
envlist=py27,py34,py35,py36,pypy,pypy3,flake8,doclinks,doctest,linting
envlist=py27,py34,py35,py36,pypy,pypy3,doclinks,doctest,linting

[testenv]
deps=pytest
commands=pytest cerberus/tests

[testenv:flake8]
deps=flake8
commands=flake8 cerberus

[testenv:doclinks]
deps=-rrequirements-docs.txt
whitelist_externals=make
Expand All @@ -23,20 +19,15 @@ changedir=docs
commands=make doctest

[testenv:linting]
skiptdist=True
usedevelop=True
skipsdist=True
basepython=python3.6
deps=pre-commit
commands=pre-commit run --all-files

[flake8]
max-line-length=88
ignore=E731,W503,E501,E203
commands=pre-commit run --config .linting-config.yaml --all-files

[tox:travis]
2.7 = py27
3.4 = py34
3.5 = py35
3.6 = py36,doclinks,doctest
3.6 = py36,doclinks,doctest,linting
pypy = pypy
pypy3 = pypy3

0 comments on commit 316cf57

Please sign in to comment.