You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Neal Richardson <ne...@gmail.com> on 2020/02/19 17:59:04 UTC

Using GitHub Actions to automate style and other fixes

Hi all,
Having a build fail because of a lint check or similar style requirement is
frustrating. It adds time to the process of getting a patch finished and
merged because you have to check back to see the build failed, switch
contexts from whatever you'd been working on since, and go fix it. And as a
new or infrequent contributor, it's particularly challenging because you
have to figure out which additional dependencies (and specific versions, as
in the case of clang-format) to install and how to run this extra tool on
your machine.

It doesn't have to be this way. With GitHub Actions, we can run workflows
that fix style and other violations and push the fix in a commit back to
the branch. To demonstrate this, I have a PR (
https://github.com/apache/arrow/pull/6411) that updates the generated R man
pages whenever there's a change to the inline docstrings. The existing CI
for R package checks fail if there's a mismatch between code and docs, and
it's all too easy to update the inline docs and forget to regenerate the
man pages from them. I could envision doing the same kind of GHA workflow
for the C++ linting--the current CI job already prints the diff that should
be applied to fix the lint failures, so why not just fix it?--and even to
implement Python black, if we decided we wanted to do that.

On the PR discussion, it seems that there's some interest in doing this but
also some concern. Some thoughts:

* It only runs on your fork (apache/arrow is excluded) and it does not run
on master
* I've added to the commit message "[automated commit]" so that it's clear
that you personally didn't add the commit.
* If anyone were strongly opposed, we could add their fork to the list of
excluded repositories.

It was also pointed out to me that we have precommit hooks that we could
extend to do this kind of work instead of GitHub Actions. I tried them out
and found them to be largely undocumented and requiring additional
out-of-band environment setup; ultimately I disabled them because I kept
getting a popup telling me to go to some website and get another JDK, all
just when editing a .R file in the r/ directory. If I as a regular
contributor found them burdensome to set up, I'm not going to recommend
them to a new contributor.

Style guides and linting are important for large projects like Arrow, but
we don't want to add unnecessary friction to the dev process, particularly
for new contributors--it's challenging enough without it. From my
experience, the best way to enforce standards and processes is to automate
them so that contributors don't need to think about doing the right thing
because the right thing is the easy thing.

What are your thoughts? If anyone objects to using GitHub Actions in this
way, would you be satisfied with blacklisting your fork (i.e. you don't
want it running on your branches but you don't mind if others do)?

Thanks,
Neal

Re: Using GitHub Actions to automate style and other fixes

Posted by Wes McKinney <we...@gmail.com>.
I run the following bash function at pre-commit

https://github.com/wesm/dev-toolchain/blob/1bd3daee1a0b21f8484a7d957de03c640ea8c113/toolchain/arrow-toolchain.sh#L441

Such a thing could be standardized but it may need to be tailored
somewhat based on a contributor's focus areas (e.g. mine ignores Rust
/ Go / Java)

On Thu, Feb 20, 2020 at 5:57 AM Joris Van den Bossche
<jo...@gmail.com> wrote:
>
> I am personally also not in favor of automatic fixes, but a bot you can
> call would be a nice feature. It might be possible to let a workflow be
> triggered by an issue comment? (
> https://help.github.com/en/actions/reference/events-that-trigger-workflows#issue-comment-event-issue_comment
> )
>
> In addition, I think it would be nice to make the pre-commit hooks a
> smoother experience. I started using it for pandas, and I really love it
> that I don't have to worry anymore about failing CI for some style check
> (but, in pandas, the pre-commit hook is simpler of course, since it's only
> python checks).
>
> Joris
>
>
>
> On Thu, 20 Feb 2020 at 10:52, Wes McKinney <we...@gmail.com> wrote:
>
> > I'm also against _automatic_ (user-not-in-the-loop) changes. I think
> > the model used conda-forge works pretty well, where a bot lints each
> > patch and lets you know if any changes are needed
> >
> >
> > https://github.com/conda-forge/pyarrow-feedstock/pull/99#issuecomment-585264694
> >
> > However, note that bot-generated commits could risk running afoul of
> > the ASF's code provenance requirements. If a commit to a patch is
> > requested / opted-in-to by a contributor then I think there is less of
> > an issue, and during the squash everything is rolled up and attributed
> > to the contributor(s).
> >
> > On Thu, Feb 20, 2020 at 3:43 AM Jacek Pliszka <ja...@gmail.com>
> > wrote:
> > >
> > > As a beginner contributor I believe I can vote for linting as part of
> > the build.
> > >
> > > For me the best would be BEGINNER/ALL_CHECKS option in the Makefile
> > > that does all the linting and all checks done in the build.
> > >
> > > And in the instruction it would be clearly suggested to use it.
> > >
> > > BR,
> > >
> > > Jacek
> > >
> > >
> > > śr., 19 lut 2020 o 20:40 Antoine Pitrou <so...@pitrou.net>
> > napisał(a):
> > > >
> > > >
> > > > Hi,
> > > >
> > > > On Wed, 19 Feb 2020 09:59:04 -0800
> > > > >
> > > > > It doesn't have to be this way. With GitHub Actions, we can run
> > workflows
> > > > > that fix style and other violations and push the fix in a commit
> > back to
> > > > > the branch.
> > > >
> > > > I'm rather opposed to this.  Doing automated pushes behind the user's
> > > > back will feel confusing and slightly obnoxious.
> > > >
> > > > > Style guides and linting are important for large projects like
> > Arrow, but
> > > > > we don't want to add unnecessary friction to the dev process,
> > particularly
> > > > > for new contributors--it's challenging enough without it.
> > > >
> > > > Well, at worse, we can push fixes ourselves before merging a PR if the
> > > > only remaining ones are style fixes.
> > > >
> > > > > What are your thoughts? If anyone objects to using GitHub Actions in
> > this
> > > > > way, would you be satisfied with blacklisting your fork (i.e. you
> > don't
> > > > > want it running on your branches but you don't mind if others do)?
> > > >
> > > > Egoistically, that would satify me, but I'm not sure it would be less
> > > > confusing to beginner contributors.
> > > >
> > > > Regards
> > > >
> > > > Antoine.
> > > >
> > > >
> >

Re: Using GitHub Actions to automate style and other fixes

Posted by Joris Van den Bossche <jo...@gmail.com>.
I am personally also not in favor of automatic fixes, but a bot you can
call would be a nice feature. It might be possible to let a workflow be
triggered by an issue comment? (
https://help.github.com/en/actions/reference/events-that-trigger-workflows#issue-comment-event-issue_comment
)

In addition, I think it would be nice to make the pre-commit hooks a
smoother experience. I started using it for pandas, and I really love it
that I don't have to worry anymore about failing CI for some style check
(but, in pandas, the pre-commit hook is simpler of course, since it's only
python checks).

Joris



On Thu, 20 Feb 2020 at 10:52, Wes McKinney <we...@gmail.com> wrote:

> I'm also against _automatic_ (user-not-in-the-loop) changes. I think
> the model used conda-forge works pretty well, where a bot lints each
> patch and lets you know if any changes are needed
>
>
> https://github.com/conda-forge/pyarrow-feedstock/pull/99#issuecomment-585264694
>
> However, note that bot-generated commits could risk running afoul of
> the ASF's code provenance requirements. If a commit to a patch is
> requested / opted-in-to by a contributor then I think there is less of
> an issue, and during the squash everything is rolled up and attributed
> to the contributor(s).
>
> On Thu, Feb 20, 2020 at 3:43 AM Jacek Pliszka <ja...@gmail.com>
> wrote:
> >
> > As a beginner contributor I believe I can vote for linting as part of
> the build.
> >
> > For me the best would be BEGINNER/ALL_CHECKS option in the Makefile
> > that does all the linting and all checks done in the build.
> >
> > And in the instruction it would be clearly suggested to use it.
> >
> > BR,
> >
> > Jacek
> >
> >
> > śr., 19 lut 2020 o 20:40 Antoine Pitrou <so...@pitrou.net>
> napisał(a):
> > >
> > >
> > > Hi,
> > >
> > > On Wed, 19 Feb 2020 09:59:04 -0800
> > > >
> > > > It doesn't have to be this way. With GitHub Actions, we can run
> workflows
> > > > that fix style and other violations and push the fix in a commit
> back to
> > > > the branch.
> > >
> > > I'm rather opposed to this.  Doing automated pushes behind the user's
> > > back will feel confusing and slightly obnoxious.
> > >
> > > > Style guides and linting are important for large projects like
> Arrow, but
> > > > we don't want to add unnecessary friction to the dev process,
> particularly
> > > > for new contributors--it's challenging enough without it.
> > >
> > > Well, at worse, we can push fixes ourselves before merging a PR if the
> > > only remaining ones are style fixes.
> > >
> > > > What are your thoughts? If anyone objects to using GitHub Actions in
> this
> > > > way, would you be satisfied with blacklisting your fork (i.e. you
> don't
> > > > want it running on your branches but you don't mind if others do)?
> > >
> > > Egoistically, that would satify me, but I'm not sure it would be less
> > > confusing to beginner contributors.
> > >
> > > Regards
> > >
> > > Antoine.
> > >
> > >
>

Re: Using GitHub Actions to automate style and other fixes

Posted by Wes McKinney <we...@gmail.com>.
I'm also against _automatic_ (user-not-in-the-loop) changes. I think
the model used conda-forge works pretty well, where a bot lints each
patch and lets you know if any changes are needed

https://github.com/conda-forge/pyarrow-feedstock/pull/99#issuecomment-585264694

However, note that bot-generated commits could risk running afoul of
the ASF's code provenance requirements. If a commit to a patch is
requested / opted-in-to by a contributor then I think there is less of
an issue, and during the squash everything is rolled up and attributed
to the contributor(s).

On Thu, Feb 20, 2020 at 3:43 AM Jacek Pliszka <ja...@gmail.com> wrote:
>
> As a beginner contributor I believe I can vote for linting as part of the build.
>
> For me the best would be BEGINNER/ALL_CHECKS option in the Makefile
> that does all the linting and all checks done in the build.
>
> And in the instruction it would be clearly suggested to use it.
>
> BR,
>
> Jacek
>
>
> śr., 19 lut 2020 o 20:40 Antoine Pitrou <so...@pitrou.net> napisał(a):
> >
> >
> > Hi,
> >
> > On Wed, 19 Feb 2020 09:59:04 -0800
> > >
> > > It doesn't have to be this way. With GitHub Actions, we can run workflows
> > > that fix style and other violations and push the fix in a commit back to
> > > the branch.
> >
> > I'm rather opposed to this.  Doing automated pushes behind the user's
> > back will feel confusing and slightly obnoxious.
> >
> > > Style guides and linting are important for large projects like Arrow, but
> > > we don't want to add unnecessary friction to the dev process, particularly
> > > for new contributors--it's challenging enough without it.
> >
> > Well, at worse, we can push fixes ourselves before merging a PR if the
> > only remaining ones are style fixes.
> >
> > > What are your thoughts? If anyone objects to using GitHub Actions in this
> > > way, would you be satisfied with blacklisting your fork (i.e. you don't
> > > want it running on your branches but you don't mind if others do)?
> >
> > Egoistically, that would satify me, but I'm not sure it would be less
> > confusing to beginner contributors.
> >
> > Regards
> >
> > Antoine.
> >
> >

Re: Using GitHub Actions to automate style and other fixes

Posted by Jacek Pliszka <ja...@gmail.com>.
As a beginner contributor I believe I can vote for linting as part of the build.

For me the best would be BEGINNER/ALL_CHECKS option in the Makefile
that does all the linting and all checks done in the build.

And in the instruction it would be clearly suggested to use it.

BR,

Jacek


śr., 19 lut 2020 o 20:40 Antoine Pitrou <so...@pitrou.net> napisał(a):
>
>
> Hi,
>
> On Wed, 19 Feb 2020 09:59:04 -0800
> >
> > It doesn't have to be this way. With GitHub Actions, we can run workflows
> > that fix style and other violations and push the fix in a commit back to
> > the branch.
>
> I'm rather opposed to this.  Doing automated pushes behind the user's
> back will feel confusing and slightly obnoxious.
>
> > Style guides and linting are important for large projects like Arrow, but
> > we don't want to add unnecessary friction to the dev process, particularly
> > for new contributors--it's challenging enough without it.
>
> Well, at worse, we can push fixes ourselves before merging a PR if the
> only remaining ones are style fixes.
>
> > What are your thoughts? If anyone objects to using GitHub Actions in this
> > way, would you be satisfied with blacklisting your fork (i.e. you don't
> > want it running on your branches but you don't mind if others do)?
>
> Egoistically, that would satify me, but I'm not sure it would be less
> confusing to beginner contributors.
>
> Regards
>
> Antoine.
>
>

Re: Using GitHub Actions to automate style and other fixes

Posted by Micah Kornfield <em...@gmail.com>.
It might pay to open up a separate thread on the Java specifically.  I
think automatic formatting might have been discussed before but people were
afraid of the magnitude of the change.

I'm also slightly against automated pushes, having something in Ursabot or
GHA which could be easily invoked would could add value though.

Cheers,
Micah

On Wed, Feb 19, 2020 at 2:29 PM Andy Grove <an...@gmail.com> wrote:

> To backtrack slightly on my earlier email, when I said "I couldn't agree
> more" I was speaking to the frustrations around builds failing due to
> linting errors and then having to manually fix them.
>
> I think if we make as easy as possible for committers to automate the
> formatting before pushing (and document this in the README for each
> implementation) then it would be very helpful. Using Github actions to push
> is likely to cause merge conflicts which can be difficult to deal with.
>
> Thanks,
>
> Andy.
>
> On Wed, Feb 19, 2020 at 12:40 PM Antoine Pitrou <so...@pitrou.net>
> wrote:
>
> >
> > Hi,
> >
> > On Wed, 19 Feb 2020 09:59:04 -0800
> > >
> > > It doesn't have to be this way. With GitHub Actions, we can run
> workflows
> > > that fix style and other violations and push the fix in a commit back
> to
> > > the branch.
> >
> > I'm rather opposed to this.  Doing automated pushes behind the user's
> > back will feel confusing and slightly obnoxious.
> >
> > > Style guides and linting are important for large projects like Arrow,
> but
> > > we don't want to add unnecessary friction to the dev process,
> > particularly
> > > for new contributors--it's challenging enough without it.
> >
> > Well, at worse, we can push fixes ourselves before merging a PR if the
> > only remaining ones are style fixes.
> >
> > > What are your thoughts? If anyone objects to using GitHub Actions in
> this
> > > way, would you be satisfied with blacklisting your fork (i.e. you don't
> > > want it running on your branches but you don't mind if others do)?
> >
> > Egoistically, that would satify me, but I'm not sure it would be less
> > confusing to beginner contributors.
> >
> > Regards
> >
> > Antoine.
> >
> >
> >
>

Re: Using GitHub Actions to automate style and other fixes

Posted by Andy Grove <an...@gmail.com>.
To backtrack slightly on my earlier email, when I said "I couldn't agree
more" I was speaking to the frustrations around builds failing due to
linting errors and then having to manually fix them.

I think if we make as easy as possible for committers to automate the
formatting before pushing (and document this in the README for each
implementation) then it would be very helpful. Using Github actions to push
is likely to cause merge conflicts which can be difficult to deal with.

Thanks,

Andy.

On Wed, Feb 19, 2020 at 12:40 PM Antoine Pitrou <so...@pitrou.net> wrote:

>
> Hi,
>
> On Wed, 19 Feb 2020 09:59:04 -0800
> >
> > It doesn't have to be this way. With GitHub Actions, we can run workflows
> > that fix style and other violations and push the fix in a commit back to
> > the branch.
>
> I'm rather opposed to this.  Doing automated pushes behind the user's
> back will feel confusing and slightly obnoxious.
>
> > Style guides and linting are important for large projects like Arrow, but
> > we don't want to add unnecessary friction to the dev process,
> particularly
> > for new contributors--it's challenging enough without it.
>
> Well, at worse, we can push fixes ourselves before merging a PR if the
> only remaining ones are style fixes.
>
> > What are your thoughts? If anyone objects to using GitHub Actions in this
> > way, would you be satisfied with blacklisting your fork (i.e. you don't
> > want it running on your branches but you don't mind if others do)?
>
> Egoistically, that would satify me, but I'm not sure it would be less
> confusing to beginner contributors.
>
> Regards
>
> Antoine.
>
>
>

Re: Using GitHub Actions to automate style and other fixes

Posted by Antoine Pitrou <so...@pitrou.net>.
Hi,

On Wed, 19 Feb 2020 09:59:04 -0800
> 
> It doesn't have to be this way. With GitHub Actions, we can run workflows
> that fix style and other violations and push the fix in a commit back to
> the branch.

I'm rather opposed to this.  Doing automated pushes behind the user's
back will feel confusing and slightly obnoxious.

> Style guides and linting are important for large projects like Arrow, but
> we don't want to add unnecessary friction to the dev process, particularly
> for new contributors--it's challenging enough without it.

Well, at worse, we can push fixes ourselves before merging a PR if the
only remaining ones are style fixes.

> What are your thoughts? If anyone objects to using GitHub Actions in this
> way, would you be satisfied with blacklisting your fork (i.e. you don't
> want it running on your branches but you don't mind if others do)?

Egoistically, that would satify me, but I'm not sure it would be less
confusing to beginner contributors.

Regards

Antoine.



Re: Using GitHub Actions to automate style and other fixes

Posted by Andy Grove <an...@gmail.com>.
I couldn't agree more. I'm a fan of tools that check formatting style, but
only if the tools can also apply the style. Having a tool to tell humans to
manually fix style issues is annoying at best. This has been a pain point
for me as I start to work with the Java implementation.

In Rust, we just need to remember to run "cargo fmt" before pushing changes
so it isn't so bad.

In my current day job we use Spotless [1] to format Java and Scala code
automatically and I would recommend considering it for the Java
implementation of Arrow.

Thanks,

Andy.

[1] https://github.com/diffplug/spotless

On Wed, Feb 19, 2020 at 10:59 AM Neal Richardson <
neal.p.richardson@gmail.com> wrote:

> Hi all,
> Having a build fail because of a lint check or similar style requirement is
> frustrating. It adds time to the process of getting a patch finished and
> merged because you have to check back to see the build failed, switch
> contexts from whatever you'd been working on since, and go fix it. And as a
> new or infrequent contributor, it's particularly challenging because you
> have to figure out which additional dependencies (and specific versions, as
> in the case of clang-format) to install and how to run this extra tool on
> your machine.
>
> It doesn't have to be this way. With GitHub Actions, we can run workflows
> that fix style and other violations and push the fix in a commit back to
> the branch. To demonstrate this, I have a PR (
> https://github.com/apache/arrow/pull/6411) that updates the generated R
> man
> pages whenever there's a change to the inline docstrings. The existing CI
> for R package checks fail if there's a mismatch between code and docs, and
> it's all too easy to update the inline docs and forget to regenerate the
> man pages from them. I could envision doing the same kind of GHA workflow
> for the C++ linting--the current CI job already prints the diff that should
> be applied to fix the lint failures, so why not just fix it?--and even to
> implement Python black, if we decided we wanted to do that.
>
> On the PR discussion, it seems that there's some interest in doing this but
> also some concern. Some thoughts:
>
> * It only runs on your fork (apache/arrow is excluded) and it does not run
> on master
> * I've added to the commit message "[automated commit]" so that it's clear
> that you personally didn't add the commit.
> * If anyone were strongly opposed, we could add their fork to the list of
> excluded repositories.
>
> It was also pointed out to me that we have precommit hooks that we could
> extend to do this kind of work instead of GitHub Actions. I tried them out
> and found them to be largely undocumented and requiring additional
> out-of-band environment setup; ultimately I disabled them because I kept
> getting a popup telling me to go to some website and get another JDK, all
> just when editing a .R file in the r/ directory. If I as a regular
> contributor found them burdensome to set up, I'm not going to recommend
> them to a new contributor.
>
> Style guides and linting are important for large projects like Arrow, but
> we don't want to add unnecessary friction to the dev process, particularly
> for new contributors--it's challenging enough without it. From my
> experience, the best way to enforce standards and processes is to automate
> them so that contributors don't need to think about doing the right thing
> because the right thing is the easy thing.
>
> What are your thoughts? If anyone objects to using GitHub Actions in this
> way, would you be satisfied with blacklisting your fork (i.e. you don't
> want it running on your branches but you don't mind if others do)?
>
> Thanks,
> Neal
>