add pre-commit and enforce on travis (#37)

* add pre-commit and enforce on travis
This commit is contained in:
Dave Gallant
2019-10-14 22:18:01 -04:00
committed by GitHub
parent f72dd82771
commit 53666c643f
11 changed files with 611 additions and 584 deletions

8
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,8 @@
*Description of changes:*
*Checklist:*
- [ ] Write unit tests
- [ ] `make pr` passes
- [ ] Write documentation

2
.gitignore vendored
View File

@@ -6,4 +6,4 @@
.vscode/
build/
dist/
venv/
venv/

19
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
- id: end-of-file-fixer
- id: pretty-format-json
args: [--autofix]
- id: requirements-txt-fixer
- id: trailing-whitespace

View File

@@ -11,11 +11,10 @@ matrix:
dist: xenial
sudo: true
before_install:
- "pip install -U pip"
- "python setup.py install"
- pip install -U pip
install:
- pip install tox-travis
- pip install pytest
- pip install pylint
- python setup.py install
- pip install -r requirements_dev.txt
- git diff --name-only $TRAVIS_COMMIT_RANGE | xargs pre-commit run --files
script:
- tox

View File

@@ -1,3 +1,3 @@
include requirements.txt
include requirements_dev.txt
include rfd/__version__.py
include rfd/__version__.py

View File

@@ -1,10 +1,35 @@
build:
SRC:=rfd
.PHONY: build
build:
rm -rf dist/
python setup.py sdist
.PHONY: push_test
push_test:
twine upload -r testpypi dist/*.tar.gz
.PHONY: push_prod
push_prod:
twine upload dist/*.tar.gz
twine upload dist/*.tar.gz
.PHONY: precommit
precommit: ## Run pre-commit
pre-commit run \
--all-files \
--show-diff-on-failure
.PHONY: lint
lint:
pylint $(SRC)
.PHONY: test
test:
pytest -v
.PHONY: pr
pr: precommit lint test
.PHONY: ci
ci: lint test

View File

@@ -1,4 +1,4 @@
beautifulsoup4>=4.6.0
click>=7.0
colorama>=0.3.9
requests>=2.18.0
requests>=2.18.0

View File

@@ -1,5 +1,5 @@
black==19.3b0
pylint==2.4.2
pytest==5.2.1
pytest-sugar==0.9.2
pre-commit==1.18.3
pylint
pytest>=4.6.6
rope==0.14.0
tox-travis==0.12

View File

@@ -1,5 +1,6 @@
"""This module provides utility functions that are used within rfd"""
def is_int(number):
try:
int(number)

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,6 @@ envlist = py{27,
}
[testenv]
passenv = SSH_AUTH_SOCK
commands =
pytest
pylint rfd
make ci