Hello darkness my old friend; This is part five (b), and focuses on QAPIDoc in parser.py.
GitLab: https://gitlab.com/jsnow/qemu/-/commits/python-qapi-cleanup-pt5b CI: https://gitlab.com/jsnow/qemu/-/pipelines/379678153 Note: intentional trailing whitespace in a QAPI schema test causes a warning on the `check-patch` CI test. Ignore it. Requirements: - Python 3.6+ - mypy >= 0.770 - pylint >= 2.6.0 (2.7.0+ when using Python 3.9+) Every commit should pass with: - `isort -c qapi/` - `flake8 qapi/` - `pylint --rcfile=qapi/pylintrc qapi/` - `mypy --config-file=qapi/mypy.ini qapi/` V3: 001/13:[down] 'qapi/pylintrc: ignore 'consider-using-f-string' warning' 002/13:[down] 'qapi/gen: use dict.items() to iterate over _modules' 003/13:[----] [--] 'qapi/parser: fix unused check_args_section arguments' 004/13:[down] 'qapi: Add spaces after symbol declaration for consistency' 005/13:[down] 'qapi/parser: improve detection of '@symbol:' preface' 006/13:[down] 'qapi/parser: remove FIXME comment from _append_body_line' 007/13:[down] 'qapi/parser: Simplify _end_section()' 008/13:[down] 'qapi/parser: Introduce NullSection' 009/13:[down] 'qapi/parser: add import cycle workaround' 010/13:[0028] [FC] 'qapi/parser: add type hint annotations (QAPIDoc)' 011/13:[----] [--] 'qapi/parser: enable mypy checks' 012/13:[0003] [FC] 'qapi/parser: Silence too-few-public-methods warning' 013/13:[----] [--] 'qapi/parser: enable pylint checks' - Rebased. - Add patches 1 & 2 for newer pylint versions - Add patches 4-6 because I was in the neighborhood - Patches 7 & 8 rewritten from the corpse of the prior fix/workaround - Patch 9 split out separately from what is now patch 10 - Update patch 12 to accommodate new 7/8 Notes: - Patches 4-6 aren't crucial and can be omitted from staging if it makes the difference between a respin or not. I think I will definitely want patches 5-6 eventually anyway, though. (Or something to replace 'em.) - Patch 10 and 11 can be squashed, if desired John Snow (13): qapi/pylintrc: ignore 'consider-using-f-string' warning qapi/gen: use dict.items() to iterate over _modules qapi/parser: fix unused check_args_section arguments qapi: Add spaces after symbol declaration for consistency qapi/parser: improve detection of '@symbol:' preface qapi/parser: remove FIXME comment from _append_body_line qapi/parser: Simplify _end_section() qapi/parser: Introduce NullSection qapi/parser: add import cycle workaround qapi/parser: add type hint annotations (QAPIDoc) qapi/parser: enable mypy checks qapi/parser: Silence too-few-public-methods warning qapi/parser: enable pylint checks qapi/block-core.json | 1 + qga/qapi-schema.json | 3 + scripts/qapi/gen.py | 3 +- scripts/qapi/mypy.ini | 5 - scripts/qapi/parser.py | 161 +++++++++++------- scripts/qapi/pylintrc | 4 +- tests/qapi-schema/doc-bad-feature.err | 2 +- tests/qapi-schema/doc-empty-symbol.err | 2 +- tests/qapi-schema/doc-good.json | 8 + .../doc-whitespace-leading-symbol.err | 1 + .../doc-whitespace-leading-symbol.json | 6 + .../doc-whitespace-leading-symbol.out | 0 .../doc-whitespace-trailing-symbol.err | 1 + .../doc-whitespace-trailing-symbol.json | 6 + .../doc-whitespace-trailing-symbol.out | 0 tests/qapi-schema/meson.build | 2 + 16 files changed, 134 insertions(+), 71 deletions(-) create mode 100644 tests/qapi-schema/doc-whitespace-leading-symbol.err create mode 100644 tests/qapi-schema/doc-whitespace-leading-symbol.json create mode 100644 tests/qapi-schema/doc-whitespace-leading-symbol.out create mode 100644 tests/qapi-schema/doc-whitespace-trailing-symbol.err create mode 100644 tests/qapi-schema/doc-whitespace-trailing-symbol.json create mode 100644 tests/qapi-schema/doc-whitespace-trailing-symbol.out -- 2.31.1