Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate PR feedback for link icon change #309

Merged
merged 1 commit into from
Mar 26, 2022

Conversation

malxau
Copy link
Contributor

@malxau malxau commented Mar 5, 2022

This is addressing the feedback in #304 :

  1. Use ATTR_SYMBOLIC | ATTR_JUNCTION to test whether something is a link, since a reparse point is not always a link; it could be a virtual git file, store app, onedrive placeholder, all kinds of things;
  2. Use braces around if conditions. There was a commit for this in the original PR but it wasn't included in the merge.

@schinagl
Copy link
Contributor

schinagl commented Mar 6, 2022

The braces which I added were merged.
The questions is where braces should be put.
From trying to understand the coding conventions and mimic the current situation in this project, there should be braces when there is more than one statement after an if/else/for/while/...
E.g

if (5 == 4) {
  x = 2;
  y = 3;
} else
  x = 42;

But I could be wrong, and basically I am fine with any convention.

@malxau
Copy link
Contributor Author

malxau commented Mar 6, 2022

Right, the convention of a lot of this code is inconsistent - not just about brace location, but tabs/spaces and indent depth. There's some conversation about it in #88 . Reading it now, I overlooked this comment from Craig:

+1 on the "keeping with the spirit of the codebase". That said, we should probably go with one spacing/bracing style. If we can agree on one, I would be fine with one big PR to fix it all one way.

Unfortunately I'm not sure how to get to one PR for this without relying on a tool of some kind - the way some code indents with three spaces vs four for example is really hard to address manually. Braces are at least more visually obvious. I know some teams at Microsoft use clang-format now, although I've never found a set of options that really conform to the principles that humans find natural.

@schinagl
Copy link
Contributor

schinagl commented Mar 7, 2022

But I doubt, that reformatting the whole source has an extra value at this stage of the project.
So my plan is to smell the very local coding convention, and mimic it as best as possible for my changes, so that my diffs are small and esay to review.

src/treectl.c Outdated
@@ -1692,15 +1692,19 @@ TCWP_DrawItem(

} else if (!(view & VIEW_PLUSES) || !(pNode->wFlags & TF_HASCHILDREN)) {
if (bDrawSelected) {
if (pNode->dwAttribs & ATTR_REPARSE_POINT)
if (pNode->dwAttribs & (ATTR_SYMBOLIC | ATTR_JUNCTION))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Allman style.

src/treectl.c Outdated
iBitmap = BM_IND_OPENREPARSE;
else
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is K&R style.

@craigwi
Copy link
Contributor

craigwi commented Mar 11, 2022

So my plan is to smell the very local coding convention, and mimic it as best as possible for my changes, so that my diffs are small and esay to review.

Agreed. This PR actually has two styles mixed together. I made comments on one case. Can we do one or the other?

@malxau malxau force-pushed the link_icon_feedback branch from 6cfdc71 to d991b78 Compare March 13, 2022 06:29
@malxau
Copy link
Contributor Author

malxau commented Mar 13, 2022

I think the challenge we have is trying to conform to neighboring code when the neighboring code is so inconsistent. Each function has examples of each style. Since this PR was already changing coding style of existing code, I tried to make the entire functions consistent.

This commit attempts to use Allman, since that's what you'd expressed a preference for in #88 . It also uses spaces for indentation, using a shift width of 4. I think this is the style we're moving towards (right?)

When reviewing the changes in Github, under the "files changed" tab there's a gear icon, and that allows the change to be viewed with or without whitespace. The whitespace changes are about using a shift width of 4; hiding these shows the bracing style changes.

@schinagl
Copy link
Contributor

schinagl commented Mar 13, 2022

This project was written in K&R/3 spaces indent. Some changes are in Allman, but 90% are still in K&R now.

With reformatting even partially to Allman/4 spaces you cause conflicts with all private builds, and open PRs.
And it does not stay with a few methods, this spreads.

I personally favour Allman, and all my other stuff is Allman, but for this project I switched to K&R/3 spaces, and my 2 cents is, that it should stay as close to the original stuff. This simply is the spirit of Winfile, written some time in 198x.

Changing the source formatting to Allman/4 spaces in my opinion has no benefit, and only introduces risk and problems.

@craigwi
Copy link
Contributor

craigwi commented Mar 14, 2022

Short of a massive reformatting, staying with K&R/3 makes sense. Thanks!

@schinagl
Copy link
Contributor

schinagl commented Mar 26, 2022

It seems we are stuck here a little bit.
To get us out of this I made a proposal branch, which has @malxau changes in, but has very little reformatting in, so that it would fill in smoothly (at least I guess:-))

See schinagl:link_icon_feedback_proposal

If this is fine four you @malxau, take it, push it and I guess @craig will sign it?

@malxau malxau force-pushed the link_icon_feedback branch from d991b78 to 4710d52 Compare March 26, 2022 17:54
@malxau
Copy link
Contributor Author

malxau commented Mar 26, 2022

Thanks @schinagl and sorry for going quiet. I looked at your change, and it doesn't include the addition of braces which I thought was something that needed doing. If we're not doing that, we also don't need to go over code formatting at all. So here's a brutally minimal change instead...

@craigwi craigwi merged commit 3489982 into microsoft:master Mar 26, 2022
@malxau malxau deleted the link_icon_feedback branch February 5, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants