Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .hooks4git.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
STAGED_FILES_IF_ANY = h4g/get_staged_files --format csv --prefix "--filename=" --suffix ""

[scripts]
flake8 = flake8 --max-line-length=119 --exclude .git,build,dist ${STAGED_FILES_IF_ANY}
pytest = python -m pytest --cov=hooks4git tests/
flake8 = pipenv run flake8 --max-line-length=119 --exclude .git,build,dist ${STAGED_FILES_IF_ANY}
pytest = pipenv run python -m pytest --cov=hooks4git tests/
travis_linter = ./node_modules/.bin/travis-lint .travis.yml
md_linter = ./node_modules/.bin/markdownlint README.md
bandit = bandit -r hooks4git
bandit = pipenv run bandit -r hooks4git
checkbranch = h4g/check_branch_name "^(feature|bugfix|hotfix|fix)\/.+"
black = black . --line-length=119 --check -t py36
black = pipenv run black . --line-length=119 --check -t py36
make_reqs = pipenv run pipenv_to_requirements -f
pipenv = pipenv install --dev

Expand Down
57 changes: 43 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
language: python
os:
- linux
# - osx
python:
# - '2.7' due to configparser problem
- '3.5'
- '3.6'
# - '3.7'
cache:
- pip
- npm
Expand All @@ -20,15 +12,52 @@ addons:
update: true
packages:
- node
before_install:
- pip install pipenv
- python3
# - gnu-sed
matrix:
include:
- name: "Python 3.5.6 on Linux"
python: 3.5 # this works for Linux but is ignored on macOS or Windows
before_install:
- sed -i 's/black = "\*"//g' Pipfile
- pip3 install -U pip pipenv
- pip3 install .
- name: "Python 3.6.3 on Linux"
python: 3.6 # this works for Linux but is ignored on macOS or Windows
before_install:
- pip3 install -U pip pipenv
- pip3 install .
- name: "Python 3.7.1 on Linux"
python: 3.7 # this works for Linux but is ignored on macOS or Windows
dist: xenial # required for Python >= 3.7
before_install:
- pip3 install -U pip pipenv
- pip3 install .
- name: "Python 3.7.3 on macOS"
os: osx
osx_image: xcode10.2 # Python 3.7.2 running on macOS 10.14.3
before_install:
- pip3 install -U pip pipenv
- pip3 install .
language: shell # 'language: python' is an error on Travis CI macOS
# - name: "Python 3.7.3 on Windows"
# os: windows # Windows 10.0.17134 N/A Build 17134
# language: shell # 'language: python' is an error on Travis CI Windows
# env: "PATH=/c:/c/Python37:/c/Python37/Scripts:/c/Users/travis/AppData/Roaming/Python/Python37/Scripts:/c/Progra~1/nodejs:$PATH"
# before_install:
# - choco install python nodejs
# - cp $(which python) /c/python3
# - pip3 install -U pip pipenv --user
# - pip3 install . --user
install:
- sed -i 's/black = "\*"//g' Pipfile
- npm install
before_script:
- pip install .
script:
- hooks4git -t ci
- python --version || true
- python2 --version || true
- python3 --version || true
- which hooks4git
- hooks4git -h
- hooks4git -t ci --ci
after_success:
- coveralls
deploy:
Expand Down
3 changes: 0 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ pipenv-to-requirements = "*"
[packages]
colorama = "*"

[requires]
python_version = "3.6"

[pipenv]
allow_prereleases = true
2 changes: 2 additions & 0 deletions hooks4git/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def run_hook_cmd(command, files):

def main(cmd):
git_root = os_call("git rev-parse --show-toplevel")[1].replace("\n", "")
if len(git_root) == 0:
git_root = "."
configfile = "%s/.hooks4git.ini" % git_root
config = configparser.ConfigParser()
cfg = {}
Expand Down