diff --git a/.hooks4git.ini b/.hooks4git.ini index 0279db1..b875f32 100644 --- a/.hooks4git.ini +++ b/.hooks4git.ini @@ -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 diff --git a/.travis.yml b/.travis.yml index 55d3b4e..a0ab95f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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: diff --git a/Pipfile b/Pipfile index 7479d57..e2bc53c 100644 --- a/Pipfile +++ b/Pipfile @@ -18,8 +18,5 @@ pipenv-to-requirements = "*" [packages] colorama = "*" -[requires] -python_version = "3.6" - [pipenv] allow_prereleases = true diff --git a/hooks4git/hook.py b/hooks4git/hook.py index 8077dab..66ec633 100755 --- a/hooks4git/hook.py +++ b/hooks4git/hook.py @@ -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 = {}