diff options
Diffstat (limited to 'testenv')
-rw-r--r-- | testenv/Dockerfile | 13 | ||||
-rw-r--r-- | testenv/eslintrc.yaml | 44 | ||||
-rw-r--r-- | testenv/mypy.ini | 5 | ||||
-rw-r--r-- | testenv/pylintrc | 62 | ||||
-rw-r--r-- | testenv/requirements.txt | 1 | ||||
-rw-r--r-- | testenv/tox.ini | 48 | ||||
-rw-r--r-- | testenv/vulture-wl.py | 5 |
7 files changed, 174 insertions, 4 deletions
diff --git a/testenv/Dockerfile b/testenv/Dockerfile index 90573038..59106908 100644 --- a/testenv/Dockerfile +++ b/testenv/Dockerfile @@ -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 diff --git a/testenv/eslintrc.yaml b/testenv/eslintrc.yaml new file mode 100644 index 00000000..8c3d07f9 --- /dev/null +++ b/testenv/eslintrc.yaml @@ -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} diff --git a/testenv/mypy.ini b/testenv/mypy.ini new file mode 100644 index 00000000..df6699a4 --- /dev/null +++ b/testenv/mypy.ini @@ -0,0 +1,5 @@ +[mypy] +python_version = 3.7 +ignore_missing_imports = True +disallow_untyped_defs = True +strict_optional = True diff --git a/testenv/pylintrc b/testenv/pylintrc new file mode 100644 index 00000000..3adf052d --- /dev/null +++ b/testenv/pylintrc @@ -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}$ diff --git a/testenv/requirements.txt b/testenv/requirements.txt index 54109c60..63aa4112 100644 --- a/testenv/requirements.txt +++ b/testenv/requirements.txt @@ -6,5 +6,4 @@ pyyaml pyserial setproctitle systemd-python -bumpversion tox diff --git a/testenv/tox.ini b/testenv/tox.ini new file mode 100644 index 00000000..6d71a64c --- /dev/null +++ b/testenv/tox.ini @@ -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 diff --git a/testenv/vulture-wl.py b/testenv/vulture-wl.py new file mode 100644 index 00000000..03e19ef6 --- /dev/null +++ b/testenv/vulture-wl.py @@ -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) |