wwwsqldesigner icon indicating copy to clipboard operation
wwwsqldesigner copied to clipboard

Switch to auto formatted code

Open bilogic opened this issue 3 years ago • 6 comments

Hi,

Can I suggest we use VSCode to auto format the codes? There are many benefits to this, namely:

  1. Easier for anyone to file clean PRs
  2. Higher readability, less work

I'm happy to file a PR.

bilogic avatar Apr 12 '22 06:04 bilogic

VSCode? Did you mean ESLint / Prettier / PHPStan / PHPCS?

nelson6e65 avatar Apr 14 '22 00:04 nelson6e65

@nelson6e65 My bad, I looked. I'm using esbenp.prettier-vscode. I guess we should just pick one and make it known so that it is easier to make small changes in PRs.

@ondras what do you think?

bilogic avatar Apr 15 '22 01:04 bilogic

I am not sure this is going to solve a problem I am having. To address your arguments:

  1. Easier for anyone to file clean PRs

In what sense? I do not recall dismissing a PR due to it being "unclean".

2. Higher readability, less work

There is no work being mandated with respect to formatting. Obviously becoming consistent with the "code style status quo" is useful.

I am okay with a PR that somewhat normalizes whitespace (as long as it does not introduce style changes incompatible with my own coding style). But I do not plan on applying that manually and/or automatically to my further code base adjustments.

ondras avatar Apr 28 '22 07:04 ondras

@ondras

Ok, when I used the word clean, what I meant was small or much smaller See here https://github.com/ondras/wwwsqldesigner/pull/254, this was indicated as too big, I had a quick look and also felt it was beyond what I can afford, largely due to it being hard to read.

Reading to understand by itself is work :)

And the latest commit was only removing 5 lines, but there was another extra 16 additions and deletions (probably due to some auto formating of tabs to spaces etc) https://github.com/ondras/wwwsqldesigner/commit/4c2b6f5d537abda62a9d1cc80a08576579e5188d

It's just a suggestion, but would require core collaborators to stick to using the auto formatter, otherwise it would not bring any benefits. Thank you.

bilogic avatar Apr 28 '22 08:04 bilogic

See here #254, this was indicated as too big, I had a quick look and also felt it was beyond what I can afford, largely due to it being hard to read.

Right, but the related functionality has been implemented and merged separately. Also, in https://github.com/ondras/wwwsqldesigner/pull/254#issuecomment-325629982, I mentioned that I would welcome a separate white-space normalizing commit. This still holds.

And the latest commit was only removing 5 lines, but there was another extra 16 additions and deletions (probably due to some auto formating of tabs to spaces etc)

Yep. Is this is problem?

ondras avatar Apr 28 '22 08:04 ondras

Ok, let me file a PR using the auto formatter esbenp.prettier-vscode, we see if it is suitable. Basically, whitespace additions and deletions require additional effort to parse (read and understand) and ignore, yet it is something that can be eliminated.

Thanks!

bilogic avatar Apr 28 '22 08:04 bilogic

Ok, I have done it, removes all white-spaces + auto format, the tools used are also listed. All I basically did was open, save, close and commit all changes.

bilogic avatar Sep 11 '22 07:09 bilogic

Sorry for not replying earlier. I just accepted the PR. Thanks!

ondras avatar Sep 15 '22 15:09 ondras

No worries, thanks! Now I can based my other PRs off this :)

bilogic avatar Sep 15 '22 15:09 bilogic