moved tox to testenv

This commit is contained in:
Devaev Maxim
2018-11-16 09:25:39 +03:00
parent 17c6b9e31f
commit cd6e490d0f
9 changed files with 41 additions and 27 deletions

View File

@@ -1,5 +1,7 @@
FROM base/archlinux
RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576
RUN pacman -Syu --noconfirm \
&& pacman -S --noconfirm \
git \
@@ -10,6 +12,8 @@ RUN pacman -Syu --noconfirm \
expac \
jshon \
sudo \
systemd \
pkgconf \
&& pacman -Sc --noconfirm
RUN useradd -r -d / packer \
@@ -33,20 +37,23 @@ COPY testenv/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
RUN pacman -Syy \
&& user-packer -S --noconfirm \
customizepkg \
&& mkdir /.npm \
&& chmod 777 /.npm \
&& user-packer -S --noconfirm \
python \
python-pip \
python-systemd \
nginx-mainline \
lua51-cjson \
ustreamer \
socat \
lua51-cjson \
htmlhint \
eslint \
&& rm -rf /.npm \
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
&& pacman -Sc --noconfirm
COPY testenv/requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576
CMD /bin/bash

44
testenv/eslintrc.yaml Normal file
View File

@@ -0,0 +1,44 @@
globals:
Atx: true
Hid: true
Keyboard: true
Mouse: true
Msd: true
Session: true
Streamer: true
Ui: true
ui: true
tools: true
check_browser: true
"$": true
"$$": true
env:
browser: true
es6: true
extends: "eslint:recommended"
parserOptions:
ecmaVersion: 6
rules:
indent:
- error
- tab
- SwitchCase: 1
linebreak-style:
- error
- unix
quotes:
- error
- double
semi:
- error
- always
comma-dangle:
- error
- always-multiline
no-unused-vars:
- error
- {vars: local, args: after-used}

5
testenv/mypy.ini Normal file
View File

@@ -0,0 +1,5 @@
[mypy]
python_version = 3.7
ignore_missing_imports = True
disallow_untyped_defs = True
strict_optional = True

62
testenv/pylintrc Normal file
View File

@@ -0,0 +1,62 @@
[MASTER]
ignore=.git
extension-pkg-whitelist=
setproctitle,
[DESIGN]
min-public-methods=0
max-args=10
[TYPECHECK]
ignored-classes=
AioQueue,
[MESSAGES CONTROL]
disable =
file-ignored,
locally-disabled,
fixme,
missing-docstring,
no-init,
no-self-use,
superfluous-parens,
abstract-class-not-used,
abstract-class-little-used,
duplicate-code,
bad-continuation,
bad-whitespace,
star-args,
broad-except,
redundant-keyword-arg,
wrong-import-order,
too-many-ancestors,
no-else-return,
len-as-condition,
[REPORTS]
msg-template={symbol} -- {path}:{line}({obj}): {msg}
[FORMAT]
max-line-length=160
[BASIC]
# List of builtins function names that should not be used, separated by a comma
bad-functions=
# Regular expression matching correct method names
method-rgx=[a-z_][a-z0-9_]{2,50}$
# Regular expression matching correct function names
function-rgx=[a-z_][a-z0-9_]{2,50}$
# Regular expression which should only match correct module level names
const-rgx=([a-zA-Z_][a-zA-Z0-9_]*)$
# Regular expression which should only match correct argument names
argument-rgx=[a-z_][a-z0-9_]{1,30}$
# Regular expression which should only match correct variable names
variable-rgx=[a-z_][a-z0-9_]{1,30}$
# Regular expression which should only match correct instance attribute names
attr-rgx=[a-z_][a-z0-9_]{1,30}$

View File

@@ -6,5 +6,4 @@ pyyaml
pyserial
setproctitle
systemd-python
bumpversion
tox

48
testenv/tox.ini Normal file
View File

@@ -0,0 +1,48 @@
[tox]
envlist = flake8, pylint, mypy, vulture, eslint, htmlhint
skipsdist = True
[testenv]
basepython = python3.7
changedir = /kvmd
[testenv:flake8]
commands = flake8 --config=testenv/tox.ini kvmd genmap.py
deps =
flake8
flake8-double-quotes
-rrequirements.txt
[testenv:pylint]
commands = pylint --rcfile=testenv/pylintrc --output-format=colorized --reports=no kvmd genmap.py
deps =
pylint
-rrequirements.txt
[testenv:mypy]
commands = mypy --config-file=testenv/mypy.ini --cache-dir=testenv/.mypy_cache kvmd genmap.py
deps =
mypy
-rrequirements.txt
[testenv:vulture]
commands = vulture kvmd genmap.py testenv/vulture-wl.py
deps =
vulture
-rrequirements.txt
[testenv:eslint]
whitelist_externals = eslint
commands = eslint --config=testenv/eslintrc.yaml --color --ext .js web/js
[testenv:htmlhint]
whitelist_externals = htmlhint
commands = htmlhint web/*.html
[flake8]
max-line-length = 160
# W503 line break before binary operator
# E227 missing whitespace around bitwise or shift operator
# E241 multiple spaces after
# E252 missing whitespace around parameter equals
ignore=W503,E227,E241,E252

5
testenv/vulture-wl.py Normal file
View File

@@ -0,0 +1,5 @@
manufacturer # unused variable (kvmd/msd.py:58)
product # unused variable (kvmd/msd.py:59)
real # unused variable (kvmd/msd.py:71)
hw # unused variable (kvmd/msd.py:73)
image # unused variable (kvmd/msd.py:74)