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

Autoformat more directories #10491

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Autoformat more directories #10491

wants to merge 9 commits into from

Conversation

9999years
Copy link
Collaborator

@9999years 9999years commented Oct 30, 2024

sickos yes

@ulysses4ever
Copy link
Collaborator

bold! People seem to want to scrap auto-formatting as it creates a noticeable tension with new/rare contributors.

One thing to consider is the release cycle. We're about to release cabal-install-3.14.1.0, and there will be many backports, which reformatting may complicate. A better point for it may be a little while after a release.

@geekosaur
Copy link
Collaborator

That's likely to feel like 3.10 after the initial fourmolu pass, though.

@9999years
Copy link
Collaborator Author

auto-formatting [...] creates a noticeable tension with new/rare contributors

FWIW I was very surprised to hear this -- I find an autoformatter that clearly fails in CI so much easier to work with as an infrequent contributor than a (usually vague) style guide that's variably enforced by individual reviewers...

@philderbeast
Copy link
Collaborator

I'd really like to see this go in. I don't want have to bother formatting code by hand.

@philderbeast
Copy link
Collaborator

@9999years, I can help with the CPP drudgery if that would speed things up.

@ulysses4ever
Copy link
Collaborator

bold! People seem to want to scrap auto-formatting as it creates a noticeable tension with new/rare contributors.

Since we turned 180 on scrapping the autoformatter (again!) and seem to be sticking with it, I'd be fine with this patch (once it's turned out of the draft state), in principle.

Is it intentional that it doesn't touch the CI? CI currently does its own thing with the action, and has its own list of directories, sadly. I'd be happier if CI exercised the make-targets. But I also foresee some contributors screaming at CI if it starts checking tests, for instance...

@9999years
Copy link
Collaborator Author

@ulysses4ever Definitely not intentional, good catch!

@9999years 9999years force-pushed the format-more branch 3 times, most recently from 5f18808 to f7a7a15 Compare December 21, 2024 00:10
@9999years 9999years marked this pull request as ready for review December 21, 2024 00:13
@Kleidukos Kleidukos self-requested a review January 2, 2025 18:40
Comment on lines 30 to 28
Cabal-testsuite/src/**/*.hs
Cabal-testsuite/main/**/*.hs
Cabal-testsuite/static/**/*.hs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Case seems off here (and maybe somewhere else)? I mean Cabal-testsuite not cabal-testsuite, and the latter is the correct one.

It's also strange that CI missed this issue.

@9999years
Copy link
Collaborator Author

@alt-romes @mpickering Do you have any PRs which would conflict with this? Happy to split this PR up.

@9999years
Copy link
Collaborator Author

From today's meeting: We might want to pay attention to: #9743

@ulysses4ever
Copy link
Collaborator

To expand on @9999years's comment above, we're particularly worried about #9743 But as discussed at the meeting, the PR branch could be reformatted accordingly, and then it should hopefully not require any other effort.

@philderbeast
Copy link
Collaborator

philderbeast commented Jan 2, 2025

If we're worried about conflicts, we could merge #10683 early that deals with the parsing errors fourmolu encounters, then merge other major pull requests that we don't want to reformat and then merge this pull request.

@mpickering
Copy link
Collaborator

I don't think that a autoformatter should be used at all, so splitting up the PR or anything else won't help so much. I thought the consensus was to remove the formatter and it seems that a single PR has changed the course again?

There will always be long-lived branches for large open-source projects which become hard to rebase, it's not a temporary problem.

@9999years
Copy link
Collaborator Author

  • Fixed the directory name case issues
  • Incorporated the comment changes in Add make style-todo and fourmolu on off comments #10683 (which will disappear from this PR once that is merged)
  • Split this into multiple commits -- one to add the directories to the Makefile and GitHub Actions and one to actually run the formatter

@9999years
Copy link
Collaborator Author

There will always be long-lived branches for large open-source projects which become hard to rebase, it's not a temporary problem.

@mpickering The current plan is to autoformat the LTS branches to match this PR, once this PR is merged, so that backports will remain easy. Does that help ameliorate your concerns?

@mpickering
Copy link
Collaborator

@9999years No, that does not address the concern at all. The concern is that there are long-lived contributor branches for complicated features which may exists for years outside the tree before being merged.

@ulysses4ever
Copy link
Collaborator

@mpickering you can reformat the long-lived branch any time, if the "base" branch you want to merge into was reformatted over time. And the result would be the diff we are interested in, nothing about formatting. I still don't see any problem. What am I missing?

@9999years
Copy link
Collaborator Author

... there are long-lived contributor branches for complicated features which may exists for years outside the tree before being merged ...

This seems to me to be a symptom of an issue. Big changes like that should be shipped incrementally. Large complicated features (and large complicated diffs) are essentially impossible to review and should be discouraged. Even without reformatting the codebase, regular churn means constant rewrites to adjust to the underlying architecture shifting. (See, for example, how I had to completely rewrite #9367 before it could be merged, because the way Cabal runs ghc changed between @Gabriella439's initial draft and the final approvals. And that was for a ~100-line diff!)

@mpickering
Copy link
Collaborator

Yes, I think we certainly agree that working on a long lived patch is difficult on a large codebase. Rebasing after a period is challenging due to the churn from changes. It seems like we disagree on taking measures to help that situation by removing unnecessary formatting changes from the diff.

It does seem better to be able to incrementally land patches, but my experience is that making incremental changes can be difficult in an open-source project, as there is no guarantee anyone will finish a patch. It is easily possible that things are left in an intermediate state for a long period, and maintainers don't feel like they have agency to revert partial changes.

If the maintainers of cabal are in agreement that a formatter is a good idea, then it is not the place to litigate on each PR about the usage of a formatter. It was just my understanding that they had already decided to remove the formatter requirement. I know I am not the only contributor who has found the formatter gets in the way of development, so if on balance the maintainers wish to take these complaints into account but decide on balance it is worthwhile then I will respectfully disagree and direct my energy into writing productive patches.

@9999years
Copy link
Collaborator Author

... my experience is that making incremental changes can be difficult in an open-source project, as there is no guarantee anyone will finish a patch. It is easily possible that things are left in an intermediate state for a long period, and maintainers don't feel like they have agency to revert partial changes.

Yeah, I definitely agree that this is a problem to work on — I think the maintainers should feel comfortable reverting partial changes. I also think that maintainers should have more power with reverting those changes. I think two-reviews-per-PR keeps the velocity of this project much slower than it needs to be and discourages splitting up changes into multiple PRs (because getting two reviews is, in my experience, a lot harder than getting just one).

@Gabriella439
Copy link
Contributor

In my experience, formatting changes don't make it significantly harder to rebase a PR. Like, yeah, they can't be resolved trivially, but usually it's pretty obvious how to adapt a rebased commit to accommodate a refactor-related change on master. The thing that makes a PR really hard to rebase is semantic changes or refactors on master, not formatting changes.

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.

7 participants