summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/lib_sxng_test.sh45
1 files changed, 26 insertions, 19 deletions
diff --git a/utils/lib_sxng_test.sh b/utils/lib_sxng_test.sh
index 0248c3125..22a655722 100755
--- a/utils/lib_sxng_test.sh
+++ b/utils/lib_sxng_test.sh
@@ -51,25 +51,32 @@ test.pylint() {
}
test.pyright() {
- # use this pyright test for local tests in development / it suppress
- # warnings related to intentional monkey patching but gives good hints where
- # we need to work on SearXNG's typification.
-
- build_msg TEST "[pyright/types] static type check of python sources"
- node.env.dev
-
- build_msg TEST "[pyright/types] suppress warnings related to intentional monkey patching"
- # We run Pyright in the virtual environment because pyright executes
- # "python" to determine the Python version.
- pyenv.cmd npx --no-install pyright -p pyrightconfig.json |
- grep -E '\.py:[0-9]+:[0-9]+' |
- grep -v '/engines/.*.py.* - warning: "logger" is not defined' |
- grep -v '/plugins/.*.py.* - error: "logger" is not defined' |
- grep -v '/engines/.*.py.* - warning: "supported_languages" is not defined' |
- grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined' |
- grep -v '/engines/.*.py.* - warning: "categories" is not defined'
- # ignore exit value from pyright
- # dump_return ${PIPESTATUS[0]}
+ # For integration into your IDE (editor) use the basedpyright-langserver
+ # (LSP) installed by 'pipx basedpyright' and read:
+ #
+ # - https://docs.basedpyright.com/latest/installation/ides/
+ #
+ # The $REPO_ROOT/pyrightconfig.json uses the virtualenv found in
+ # $REPO_ROOT/local/py3 and create by a 'make pyenv'
+
+ build_msg TEST "[basedpyright] static type check of python sources"
+ LANG=C pyenv.cmd basedpyright
+ # ignore exit value from basedpyright
+ # dump_return $?
+ return 0
+}
+
+test.pyright_modified() {
+ build_msg TEST "[basedpyright] static type check of local modified files"
+ local pyrigth_files=()
+ readarray -t pyrigth_files < <(git status --porcelain | awk 'match($2,".py[i]*$") {print $2}')
+ if [ ${#pyrigth_files[@]} -eq 0 ]; then
+ echo "there are no locally modified python files that could be checked"
+ else
+ pyenv.cmd basedpyright "${pyrigth_files[@]}"
+ fi
+ # ignore exit value from basedpyright
+ # dump_return $?
return 0
}