haikuporter icon indicating copy to clipboard operation
haikuporter copied to clipboard

[DRAFT] Formatted files with yapf

Open jurgenwigg opened this issue 1 year ago • 7 comments

Formatted python files with yapf. Commands used:

$ yapf -r --style='{based_on_style:pep8,use_tabs:True,column_limit=88}' --in-place haikuporter.py
$ yapf -r --style='{based_on_style:pep8,use_tabs:True,column_limit=88}' --in-place HaikuPorter/

Base on PEP8. Key differences from PEP8:

  • Line length set to 88 characters instead of 79
  • Used tabs instead of 4 spaces

jurgenwigg avatar Jul 25 '23 13:07 jurgenwigg

I've noticed the same issues - changing title to draft as this is under development to address and fix all issues.

jurgenwigg avatar Jul 25 '23 16:07 jurgenwigg

But what changes does this actually produce, then? Most of the differences are due to those 3 problems I noted. Once they are corrected, what "differences" will remain?

I think the code is formatted mostly fine as-is, and we don't need to reformat it "just because".

waddlesplash avatar Jul 25 '23 16:07 waddlesplash

Main goal was to prepare codebase for linters and implementing CI for checking imports order, basic styling/formatting of the code for each new PR. I'm also trying to figure out which tool and how can be used by other users to quickly format the code before committing any changes.

jurgenwigg avatar Jul 25 '23 16:07 jurgenwigg

I don't know if we can use machine-formatted code, due to the second item listed above at least (comments on next lines should be indented.) There's probably others (e.g. I see various multiline object initializers were condensed to one line.)

waddlesplash avatar Jul 25 '23 18:07 waddlesplash

I'll try to create a draft document with coding guidelines and tools possible to use for formatting :) I'll take Haiku Coding Guidelines as a base.

jurgenwigg avatar Jul 25 '23 19:07 jurgenwigg

Do we really need a separate document, though?

An "addendum" or "supplement" document describing only the differences would likely make much more sense.

waddlesplash avatar Jul 25 '23 20:07 waddlesplash

@waddlesplash I had exactly that on my mind - some kind of appendix to existing documentation. "Documentation" sounds pretty serious but all in all every comment is in some way a kind of documentation ;)

jurgenwigg avatar Jul 25 '23 21:07 jurgenwigg

This PR is almost year old. I'm closing it since another approach was proposed in the comments.

jurgenwigg avatar Jul 01 '24 17:07 jurgenwigg