-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[WIP] adding pre-commit CI and JuliaFormatter #47094
Conversation
d3d91d9
to
8117657
Compare
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Instead of splitting our CI between Buildkite and GitHub Actions, I'd like us to keep everything on Buildkite, which will make things easier to maintain.
- This workflow will not work on PRs from forks.
Also see my inline comments.
well, this would make this automation doing the opposite of what it should be doing then, the point of auto-formattingios is so that people making PR don't have to worry about being format-perfect and maintainer don't have to do bunch of style correct and trigger a bunch of useless CIs. If our formatting CI merely shows what's the problem and failing, you essentially give PR author more burden:
|
I think the opposite, the Github CI are natural if you're dealing with source file that requires github mechanics to modify anyway, BuildKite is a heavy cannon, and I'm not sure setting up "write access" from a Builkite hook or something is exactly secure and easy to maintain But if you can point me to how buildkite pre-commit CI works (or whatever they call it), I'd happy to take a look, but a quick google didn't yield anything that's ready-made |
I think the right approach here is to have a Makefile target of the form |
ok, new plan after talking to @DilumAluthge on Slack, the motivation for this design is to reduce potential security risk:
|
Cross-linking the discussion available on FluxML's PR here for help - FluxML/Flux.jl#2074 |
Pkg.add(PackageSpec(name="JuliaFormatter", version="1.0.10")) | ||
using JuliaFormatter | ||
format(".", MinimalStyle(); normalize_line_endings = "unix") | ||
- uses: reviewdog/action-suggester@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the annotations left by reviewdog/action-suggester
really helpful ? IMO, they just pollute the Files changed
view by adding tons of annotations. I know they can be disabled (manual intervention needed - cumbersome), but they tend to distract attention. I think that the failing JuliaFormatter
check is enough (we don't want contributors to fix this by hand as reviewdog
suggests (wrong signal), but run the formatter in the repo instead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't pollute file changes more than the original PR, in the ideal case it pushes to the PR branch
Failing a formatting test is a step in wrong direction, now you have something that PR author needs to download and setup in order to make PR, super annoying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRs with many comments, like for example #43990, would become even more unwieldy though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which is why I always wanted it to be directly pushing to fork branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean idk, it seems people think nothing is better than anything so maybe I will just drop this
Is the goal to format the entire codebase, or parts of the codebase, in their entirety? I always liked how |
@maleadt for PR yes; but that's also a pre-condition for the entire code base to have one formatting style (if we can agree on a minimal set of formatting rules). Even if we format the entire codebase at some point, if individual PRs, later on, don't enforce the same formatting rule, it's useless as it will just break the codebase piece by piece. idk about formatting the entire codebase, but at least we should format future PRs in someway as a starter |
I prefer a bot automatically making inline suggestions over automatically pushing to a branch because automatic pushes can cause unexpected merge conflicts when a PR author makes the reasonable assumption that they are the only one pushing to the PR branch. I think that automatic inline suggestions for some small subset of formatting decisions is strictly better than the status quo because it reduces the burden on reviewers to make those suggestions and gives authors prompt suggestions for how to improve formatting that are acceptable via GUI, and, if need be, the suggestions can simply be marked as resolved ad ignored in which case they don't take up much space. |
What about an action that runs every night on master and creates a PR for review & tests. The first one might be a little painful for open PRs but after that it should be manageable. |
yeah that's what we're moving towards and the problem now is we can't white-list what rules we want, there's a set of rules can't be disabled in JuliaFormatter.jl right now
adding burden rather than reducing, I don't like this idea. |
fix #47052
waiting admin of this repo:
enable pre-commit ci for this repo: https://pre-commit.ci/check what other hooks we may want before JuliaFormatter can replace them: https://pre-commit.com/hooks.htmlWaiting for upstream:
stdlib
of Julia domluna/JuliaFormatter.jl#644Test drive: