On 2024-10-01 07:45, Richard Purdie wrote:
On Tue, 2024-09-24 at 07:55 -0400, Trevor Gamblin via lists.openembedded.org 
wrote:
Black makes things easier to read.

Signed-off-by: Trevor Gamblin <[email protected]>
---
  meta/lib/patchtest/mbox.py                    |  44 +++---
  meta/lib/patchtest/patchtest_parser.py        | 106 ++++++++-----
  meta/lib/patchtest/patchtest_patterns.py      |  84 ++++++----
  meta/lib/patchtest/repo.py                    |  32 ++--
  meta/lib/patchtest/selftest/selftest          |  92 ++++++++---
  meta/lib/patchtest/tests/base.py              |  86 ++++++-----
  meta/lib/patchtest/tests/test_mbox.py         | 144 +++++++++++++-----
  meta/lib/patchtest/tests/test_metadata.py     |  94 ++++++++----
  meta/lib/patchtest/tests/test_patch.py        |  39 +++--
  .../lib/patchtest/tests/test_python_pylint.py |  45 ++++--
  scripts/patchtest                             | 113 +++++++++-----
  scripts/patchtest-get-branch                  |  54 ++++---
  scripts/patchtest-send-results                |  66 +++++---
  13 files changed, 660 insertions(+), 339 deletions(-)
I'm a bit nervous about this change for a few reasons. Firstly, it sets
a precedent where others will want to do this on other areas of the
code and I'm not sure we really want to do that.

black is quite opinionated and I don't agree with everything it is
changing. Some of the code does look more readable before it made
changes compared to the end result, particularly around how it is
choosing to line wrap the code. Some of the changes are also just
rearranging things for little gain such as changing quoting characters.

I'm therefore in two minds of this. I do want to empower people to
maintain code but I don't want to end up forced into taking style
changes I really don't agree with :/.

I agree that it may lead to a rush of reformatting efforts that aren't desired. We certainly don't have to take this patch now if you don't want to, although the more minor changes (e.g. the quotations) were actually a bigger part of the draw for me when I ran it.

On the other hand, some experience with using checkpatch.pl in the kernel has me wondering if we should be considering standardizing our formats for Python scripts and modules (over time) anyway. I have no strong preference on which formatter would be best (to be honest, I haven't even tried the others like YAPF or Ruff). Black, however, seems to be the one recommended most, and though it's opinionated it helps keep things consistent (the example above where the string quoting was sometimes single and sometimes double drove me nuts every time I looked at it).

Is this a reasonable goal for some distant release? I've CC'd Ross and Tim since they're also doing some Python work. I might bring it up at the weekly today.

- Trevor


Cheers,

Richard






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#205161): 
https://lists.openembedded.org/g/openembedded-core/message/205161
Mute This Topic: https://lists.openembedded.org/mt/108626678/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to