Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for tox with pylint, pyunit, flake8, black, shellcheck #15

Merged
merged 1 commit into from
Sep 3, 2020
Merged
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
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# SPDX-License-Identifier: MIT
---
language: shell
dist: bionic
os: linux
script:
- shellcheck *.sh
# https://docs.travis-ci.com/user/languages/python/#using-tox-as-the-build-script
language: minimal
preinstall:
- sudo apt-get update
- sudo apt-get install -y python3-pip
- pip3 install tox
script: tox
56 changes: 56 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: MIT
[tox]
envlist =
black, flake8, pylint, pytest
shellcheck
skipsdist = true

[testenv]
passenv = *
basepython = python3
setenv =
PYTHONPATH={toxinidir}
whitelist_externals =
bash
find
shellcheck
deps =
black: black
flake8: flake8
pylint: colorama
pylint: pylint>=1.8.4
pylint: pyyaml
commands_pre =
shellcheck: bash -c 'type -p shellcheck || \{ echo ERROR: shellcheck not found - try dnf -y install ShellCheck; exit 1; \}'
commands =
black: black --check --diff {posargs} .
flake8: flake8 {posargs} .
pylint: bash -c 'find \( -name .tox -prune \) -o \( -name .venv -prune \) -o -name \*.py -exec pylint --errors-only {posargs} \{\} \;'
shellcheck: bash -c 'shellcheck -e SC1090 *.sh'

[testenv:pytest]
deps =
pytest
pyyaml
commands =
bash -c 'if find tests/unit -name \*.py | grep -q . ; then pytest {posargs} tests/unit ; else echo no python files - skipping; fi'

[pytest]
addopts = -rxs -v

[flake8]
show_source = true
max-line-length = 88
ignore = E402,W503
exclude = .venv,.tox
statistics = true
#verbose = 3

[pylint]
max-line-length = 88

[pycodestyle]
max-line-length = 88

[travis]
python = black, flake8, pylint, pytest, shellcheck