Signed-off-by: John Snow <js...@redhat.com> --- scripts/qapi-lint.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 scripts/qapi-lint.sh
diff --git a/scripts/qapi-lint.sh b/scripts/qapi-lint.sh new file mode 100755 index 00000000000..5a8c798001e --- /dev/null +++ b/scripts/qapi-lint.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +set -e + +if [[ -f qapi/.flake8 ]]; then + echo "flake8 --config=qapi/.flake8 qapi/" + flake8 --config=qapi/.flake8 qapi/ +fi +if [[ -f qapi/pylintrc ]]; then + echo "pylint --rcfile=qapi/pylintrc qapi/" + pylint --rcfile=qapi/pylintrc qapi/ +fi +if [[ -f qapi/mypy.ini ]]; then + echo "mypy --config-file=qapi/mypy.ini qapi/" + mypy --config-file=qapi/mypy.ini qapi/ +fi + +if [[ -f qapi/.isort.cfg ]]; then + pushd qapi + echo "isort -c ." + isort -c . + popd +fi + +if [[ -f ../docs/sphinx/qapi-domain.py ]]; then + files="qapi-domain.py" +fi +if [[ -f ../docs/sphinx/compat.py ]]; then + files="${files} compat.py" +fi +if [[ -f ../docs/sphinx/collapse.py ]]; then + files="${files} collapse.py" +fi + +if [[ -f ../docs/sphinx/qapi-domain.py ]]; then + pushd ../docs/sphinx + + set -x + mypy --strict $files + flake8 --max-line-length=80 $files qapidoc.py + isort -c $files qapidoc.py + black --line-length 80 --check $files qapidoc.py + PYTHONPATH=../scripts/ pylint \ + --rc-file ../../scripts/qapi/pylintrc \ + qapidoc.py + set +x + + popd +fi + +pushd ../build +make -j13 +make check-qapi-schema +make docs +make sphinxdocs +popd -- 2.47.0