qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH 1/2] pylint: fix errors and warnings from qemu-tests test 297
Date: Thu, 7 Oct 2021 18:25:36 +0200	[thread overview]
Message-ID: <YV8fgDlCuBFwlze3@redhat.com> (raw)
In-Reply-To: <6b234a38-1604-ba25-2542-a353e2150c94@redhat.com>

Am 07.10.2021 um 12:34 hat Emanuele Giuseppe Esposito geschrieben:
> 
> > > The error is "C0330: Wrong hanging indentation"
> > > so it is not about dicts. I guess we can disable the error, but the problem
> > > is that we will disable it for the whole file, which doesn't seem right.
> > 
> > Actually, I would disable it globally in pylintrc because building
> > dictionaries for JSON is something that we do a lot.
> > 
> > But then I'm surprised that this is the only instance that actually
> > fails. I wonder what the difference is.
> > 
> > For example, 129 doesn't seem to be skipped and has this code:
> 
> 
> > 
> >      result = self.vm.qmp('blockdev-add', **{
> >                               'node-name': 'overlay',
> >                               'driver': iotests.imgfmt,
> >                               'file': {
> >                                   'driver': 'file',
> >                                   'filename': self.overlay_img
> >                               }
> >                           })
> > 
> > Yet you don't report a pylint error for this file.
> 
> Well, unless I am misunderstanding something... 129 *is* the file I am
> reporting. And that is exactly the function where pylint complains.

Indeed, my bad. I got confused there.

And the other files that do something similar are all in SKIP_FILES in
297. So it looks like we don't have another case to copy.

> > 
> > Oooh... I think I do see a difference: The final line is indented by one
> > space more in the case that fails for you. It should be vertically
> > aligned with the "'" in the first line, but it is actually aligned with
> > the "b" of "blockdev-add"
> > 
> > Does removing one space of indentation in the last line fix the report?
> 
> It's not only the final line, it's from "**{" till the ending ")".
> 'node-name' is under "ock" of 'blockdev-add'. It is clearly bad indented,
> regardless of the new style and pylint new rules.
> 
> Pylint itself suggests to move it 4 spaces more than "result =", ie 21
> spaces before.
> 
> Still, applying your suggestion to all the lines and removing 1 space from
> all lines still does not make pylint happy, as it asks to remove 20 spaces.
> 
> To simplify things, this is the error I get:
> 
>  === pylint ===
> +************* Module 129
> +129:91:0: C0330: Wrong hanging indentation (remove 21 spaces).
> +                                 'node-name': 'overlay',
> +            |                    ^ (bad-continuation)
> +129:92:0: C0330: Wrong hanging indentation (remove 21 spaces).
> +                                 'driver': iotests.imgfmt,
> +            |                    ^ (bad-continuation)
> +129:93:0: C0330: Wrong hanging indentation (remove 21 spaces).
> +                                 'file': {
> +            |                    ^ (bad-continuation)
> +129:97:0: C0330: Wrong hanging indentation.
> +                             })
> +        |   |                ^ (bad-continuation)
> 
> So unless you want to disable it overall, one way of fixing 129 is to follow
> what pylint suggests, and do like I wrote in the previous email:
> 
> Either:
>         result = self.vm.qmp('blockdev-add', **{
>             'node-name': 'overlay', 		<-- 21 spaces less
>             'driver': iotests.imgfmt,		<-- 21 spaces less
>             'file': {				<-- 21 spaces less
>                 'driver': 'file',		<-- 21 spaces less
>                 'filename': self.overlay_img	<-- 21 spaces less
>             }					<-- 21 spaces less
>         })					<-- 21 spaces less

Yes, this looks reasonble enough.

Kevin



  reply	other threads:[~2021-10-07 17:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 13:00 [PATCH 0/2] pylint: fix new errors and warnings Emanuele Giuseppe Esposito
2021-10-06 13:00 ` [PATCH 1/2] pylint: fix errors and warnings from qemu-tests test 297 Emanuele Giuseppe Esposito
2021-10-06 16:46   ` Kevin Wolf
2021-10-07  7:51     ` Emanuele Giuseppe Esposito
2021-10-07  8:45       ` Kevin Wolf
2021-10-07 10:34         ` Emanuele Giuseppe Esposito
2021-10-07 16:25           ` Kevin Wolf [this message]
2021-10-06 13:01 ` [PATCH 2/2] qemu-iotests: fix image-fleecing pylint errors Emanuele Giuseppe Esposito
2021-10-06 16:51   ` Kevin Wolf
2021-10-07  7:53     ` Emanuele Giuseppe Esposito
2021-10-07  8:36       ` Kevin Wolf
2021-10-07 10:35         ` Emanuele Giuseppe Esposito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YV8fgDlCuBFwlze3@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).