forked from Archives/searxng
Merge pull request #105 from return42/yaml
[enh] add test.yamllint - lint yaml files
This commit is contained in:
commit
5f76238d5c
@ -50,37 +50,41 @@
|
|||||||
((nil
|
((nil
|
||||||
. ((fill-column . 80)
|
. ((fill-column . 80)
|
||||||
(indent-tabs-mode . nil)
|
(indent-tabs-mode . nil)
|
||||||
))
|
|
||||||
(makefile-gmake-mode
|
|
||||||
. ((indent-tabs-mode . t)
|
|
||||||
))
|
|
||||||
(python-mode
|
|
||||||
. ((indent-tabs-mode . nil)
|
|
||||||
|
|
||||||
;; project root folder is where the `.dir-locals.el' is located
|
;; project root folder is where the `.dir-locals.el' is located
|
||||||
(eval . (setq-local
|
(eval . (setq-local
|
||||||
prj-root (locate-dominating-file default-directory ".dir-locals.el")))
|
prj-root (locate-dominating-file default-directory ".dir-locals.el")))
|
||||||
|
|
||||||
(eval . (setq-local
|
(eval . (setq-local
|
||||||
python-environment-directory (expand-file-name "./local" prj-root)))
|
python-environment-directory (expand-file-name "./local" prj-root)))
|
||||||
|
|
||||||
;; use 'py3' enviroment as default
|
;; use 'py3' enviroment as default
|
||||||
(eval . (setq-local
|
(eval . (setq-local
|
||||||
python-environment-default-root-name "py3"))
|
python-environment-default-root-name "py3"))
|
||||||
|
|
||||||
(eval . (setq-local
|
(eval . (setq-local
|
||||||
python-shell-virtualenv-root
|
python-shell-virtualenv-root
|
||||||
(concat python-environment-directory
|
(expand-file-name python-environment-default-root-name python-environment-directory)
|
||||||
"/"
|
))
|
||||||
python-environment-default-root-name)))
|
|
||||||
|
|
||||||
;; python-shell-virtualenv-path is obsolete, use python-shell-virtualenv-root!
|
|
||||||
;; (eval . (setq-local
|
|
||||||
;; python-shell-virtualenv-path python-shell-virtualenv-root))
|
|
||||||
|
|
||||||
(eval . (setq-local
|
(eval . (setq-local
|
||||||
python-shell-interpreter
|
python-shell-interpreter
|
||||||
(expand-file-name "bin/python" python-shell-virtualenv-root)))
|
(expand-file-name "bin/python" python-shell-virtualenv-root)))
|
||||||
|
))
|
||||||
|
|
||||||
|
(makefile-gmake-mode
|
||||||
|
. ((indent-tabs-mode . t)
|
||||||
|
))
|
||||||
|
|
||||||
|
(yaml-mode
|
||||||
|
. (
|
||||||
|
;; flycheck should use the local py3 environment
|
||||||
|
(eval . (setq-local
|
||||||
|
flycheck-yaml-yamllint-executable
|
||||||
|
(expand-file-name "bin/yamllint" python-shell-virtualenv-root)))
|
||||||
|
(eval . (setq-local
|
||||||
|
flycheck-yamllintrc
|
||||||
|
(expand-file-name ".yamllint.yml" prj-root)))
|
||||||
|
(flycheck-checker . yaml-yamllint)
|
||||||
|
))
|
||||||
|
|
||||||
|
(python-mode
|
||||||
|
. ((indent-tabs-mode . nil)
|
||||||
|
|
||||||
(eval . (setq-local
|
(eval . (setq-local
|
||||||
python-environment-virtualenv
|
python-environment-virtualenv
|
||||||
|
16
.yamllint.yml
Normal file
16
.yamllint.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
|
||||||
|
indentation:
|
||||||
|
spaces: 2
|
||||||
|
|
||||||
|
# 120 chars should be enough, but don't fail if a line is longer
|
||||||
|
line-length:
|
||||||
|
max: 120
|
||||||
|
level: warning
|
||||||
|
allow-non-breakable-words: true
|
||||||
|
|
||||||
|
# we don't have multiple document per file
|
||||||
|
document-start: disable
|
||||||
|
document-end: disable
|
6
Makefile
6
Makefile
@ -51,8 +51,8 @@ search.checker.%: install
|
|||||||
$(Q)./manage pyenv.cmd searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
|
$(Q)./manage pyenv.cmd searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
|
||||||
|
|
||||||
PHONY += test ci.test test.shell
|
PHONY += test ci.test test.shell
|
||||||
ci.test: test.pep8 test.pylint test.unit test.robot
|
ci.test: test.yamllint test.pep8 test.pylint test.unit test.robot
|
||||||
test: test.pep8 test.pylint test.unit test.robot test.shell
|
test: test.yamllint test.pep8 test.pylint test.unit test.robot test.shell
|
||||||
test.shell:
|
test.shell:
|
||||||
$(Q)shellcheck -x -s dash \
|
$(Q)shellcheck -x -s dash \
|
||||||
dockerfiles/docker-entrypoint.sh
|
dockerfiles/docker-entrypoint.sh
|
||||||
@ -81,7 +81,7 @@ MANAGE += node.env node.clean
|
|||||||
MANAGE += py.build py.clean
|
MANAGE += py.build py.clean
|
||||||
MANAGE += pyenv pyenv.install pyenv.uninstall
|
MANAGE += pyenv pyenv.install pyenv.uninstall
|
||||||
MANAGE += pypi.upload pypi.upload.test
|
MANAGE += pypi.upload pypi.upload.test
|
||||||
MANAGE += test.pylint test.pep8 test.unit test.coverage test.robot test.clean
|
MANAGE += test.yamllint test.pylint test.pep8 test.unit test.coverage test.robot test.clean
|
||||||
MANAGE += themes.all themes.oscar themes.simple themes.bootstrap
|
MANAGE += themes.all themes.oscar themes.simple themes.bootstrap
|
||||||
|
|
||||||
PHONY += $(MANAGE)
|
PHONY += $(MANAGE)
|
||||||
|
10
manage
10
manage
@ -29,6 +29,11 @@ pylint.FILES() {
|
|||||||
grep -l -r --include \*.py '^#[[:blank:]]*lint:[[:blank:]]*pylint' searx searx_extra tests
|
grep -l -r --include \*.py '^#[[:blank:]]*lint:[[:blank:]]*pylint' searx searx_extra tests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
YAMLLINT_FILES=()
|
||||||
|
while IFS= read -r line; do
|
||||||
|
YAMLLINT_FILES+=("$line")
|
||||||
|
done <<< "$(git ls-files './tests/*.yml' './searx/*.yml')"
|
||||||
|
|
||||||
PYLINT_SEARX_DISABLE_OPTION="\
|
PYLINT_SEARX_DISABLE_OPTION="\
|
||||||
I,C,R,\
|
I,C,R,\
|
||||||
W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,\
|
W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,\
|
||||||
@ -391,6 +396,11 @@ pypi.upload.test() {
|
|||||||
pyenv.cmd twine upload -r testpypi "${PYDIST}"/*
|
pyenv.cmd twine upload -r testpypi "${PYDIST}"/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test.yamllint() {
|
||||||
|
build_msg TEST "[pylint] \$PYLINT_FILES"
|
||||||
|
pyenv.cmd yamllint --format parsable "${YAMLLINT_FILES[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
test.pylint() {
|
test.pylint() {
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
( set -e
|
( set -e
|
||||||
|
@ -16,3 +16,4 @@ sphinxcontrib-programoutput==0.17
|
|||||||
sphinx-autobuild==2021.3.14
|
sphinx-autobuild==2021.3.14
|
||||||
linuxdoc==20210324
|
linuxdoc==20210324
|
||||||
aiounittest==1.4.0
|
aiounittest==1.4.0
|
||||||
|
yamllint==1.26.1
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
general:
|
general:
|
||||||
debug : False
|
debug: false
|
||||||
instance_name: "searx_test"
|
instance_name: "searx_test"
|
||||||
|
|
||||||
search:
|
search:
|
||||||
@ -9,7 +9,7 @@ server:
|
|||||||
port: 11111
|
port: 11111
|
||||||
bind_address: 127.0.0.1
|
bind_address: 127.0.0.1
|
||||||
secret_key: "changedultrasecretkey"
|
secret_key: "changedultrasecretkey"
|
||||||
base_url : False
|
base_url: false
|
||||||
http_protocol_version: "1.0"
|
http_protocol_version: "1.0"
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Test:
|
Test:
|
||||||
**********
|
"**********"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
general:
|
general:
|
||||||
debug : False
|
debug: false
|
||||||
instance_name: "searx"
|
instance_name: "searx"
|
||||||
|
|
||||||
search:
|
search:
|
||||||
@ -13,8 +13,8 @@ server:
|
|||||||
port: 9000
|
port: 9000
|
||||||
bind_address: "0.0.0.0"
|
bind_address: "0.0.0.0"
|
||||||
secret_key: "user_settings_secret"
|
secret_key: "user_settings_secret"
|
||||||
base_url : False
|
base_url: false
|
||||||
image_proxy : False
|
image_proxy: false
|
||||||
http_protocol_version: "1.0"
|
http_protocol_version: "1.0"
|
||||||
method: "POST"
|
method: "POST"
|
||||||
default_http_headers:
|
default_http_headers:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use_default_settings: True
|
use_default_settings: true
|
||||||
server:
|
server:
|
||||||
secret_key: "user_secret_key"
|
secret_key: "user_secret_key"
|
||||||
bind_address: "0.0.0.0"
|
bind_address: "0.0.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user