[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] qapi/parser.py: remove unused check_args_section argumen
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 1/6] qapi/parser.py: remove unused check_args_section arguments |
Date: |
Thu, 20 May 2021 16:27:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
John Snow <jsnow@redhat.com> writes:
> (Addresses a pylint warning.)
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qapi/parser.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
> index 06167ed3e0a..b3a468504fc 100644
> --- a/scripts/qapi/parser.py
> +++ b/scripts/qapi/parser.py
> @@ -753,7 +753,7 @@ def check_expr(self, expr):
>
> def check(self):
>
> - def check_args_section(args, info, what):
> + def check_args_section(args):
> bogus = [name for name, section in args.items()
> if not section.member]
> if bogus:
> @@ -764,5 +764,5 @@ def check_args_section(args, info, what):
> "', '".join(bogus),
> "do" if len(bogus) > 1 else "does"))
>
> - check_args_section(self.args, self.info, 'members')
> - check_args_section(self.features, self.info, 'features')
> + check_args_section(self.args)
> + check_args_section(self.features)
I messed this up in commit e151941d1b "qapi: Check feature documentation
against the schema".
I "obviously" meant to use @info, but used self.info instead. Dropping
@info is fine.
I "obviously" meant to use @what in the error message, but hardcoded
"member" instead, resulting in a confusing error message when it's about
features. Test case qapi-schema/doc-bad-feature.json shows it:
$ cat tests/qapi-schema/doc-bad-feature.json
# Features listed in the doc comment must exist in the actual schema
##
# @foo:
#
# Features:
# @a: a
##
{ 'command': 'foo' }
$ cat tests/qapi-schema/doc-bad-feature.err
doc-bad-feature.json:3: documented member 'a' does not exist
Instead of dropping what, let's put it to use to improve this error
message.
- [PATCH 0/6] qapi: static typing conversion, pt5b, John Snow, 2021/05/19
- [PATCH 4/6] qapi/parser.py: enable mypy checks, John Snow, 2021/05/19
- [PATCH 1/6] qapi/parser.py: remove unused check_args_section arguments, John Snow, 2021/05/19
- Re: [PATCH 1/6] qapi/parser.py: remove unused check_args_section arguments,
Markus Armbruster <=
- [PATCH 5/6] qapi/parser.py: Silence too-few-public-methods warning, John Snow, 2021/05/19
- [PATCH 6/6] qapi/parser.py: enable pylint checks, John Snow, 2021/05/19
- [PATCH 3/6] qapi/parser.py: add type hint annotations (QAPIDoc), John Snow, 2021/05/19