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

Fail Spotless formatting check before tests execute #487

Merged
merged 2 commits into from
Feb 24, 2020
Merged

Fail Spotless formatting check before tests execute #487

merged 2 commits into from
Feb 24, 2020

Conversation

ches
Copy link
Member

@ches ches commented Feb 23, 2020

What this PR does / why we need it:

Moves the spotless:check Maven goal to execute after tests compile, but before test executes the tests. This way the check will be run on CI, which runs mvn test, but it doesn't disrupt development flow by failing before compilation (like the validate phase would). This strikes a good compromise on failing fast for code standards without being too nagging.

By default, the spotless plugin binds its check goal to the verify phase (late in the lifecycle, after integration tests). Because we currently only run mvn test for CI (and package with -DskipTests for E2E), it doesn't proceed as far as verify so changes that don't comply get merged. Then, when someone cleans up at a later date by running spotless:apply on their branch, a lot of noisy, unrelated changes come into review.

Fortunately a recent PR did run spotless:apply, when I run it on this branch the changes are few so it won't create a lot of conflicts for others' outstanding work.

Does this PR introduce a user-facing change?:

NONE

By default, the spotless Maven plugin binds its check goal to the verify
phase (late in the lifecycle, after integration tests). Because we
currently only run `mvn test` for CI, it doesn't proceed as far as
verify so missed formatting is not caught by CI.

This binds the check to an earlier phase, in between test-compile and
test, so that it will fail before `mvn test` but not disrupt your dev
workflow of compiling main and test sources as you work. This strikes a
good compromise on failing fast for code standards without being _too_
nagging.

For the complete lifecycle reference, see:
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
@davidheryanto
Copy link
Collaborator

/lgtm

@ches
Copy link
Member Author

ches commented Feb 24, 2020

Not sure what assigning PRs means for the workflow with the bot. @davidheryanto are we waiting for an /approve from you now?

@davidheryanto
Copy link
Collaborator

I don't think we have any special use of the assign feature in GitHub other than for the pull request author to remind/notify the maintainers to review it.

@ches
Copy link
Member Author

ches commented Feb 24, 2020

I don't think we have any special use of the assign feature in GitHub other than for the pull request author to remind/notify the maintainers to review it.

I guess /assign does that,

To complete the pull request process, please assign woop
You can assign the PR to them by writing /assign @woop in a comment when ready.

but apparently giving a /lgtm causes the bot to assign to you? Weird. The intention of how /lgtm is meant to work vs. /approve is not clear to me…

Anyway, I'm just wanting people to understand what the next step is on PRs, what they're waiting on—myself included 😅 This PR is small and a quality-of-life thing for all, I hope—how do we land it?

(I'm trying to digest #466 because we had to make a similar hack for Spark, and the changeset is a lot larger than the necessary scope because it caught up old missed formatting. So I scratched an itch I've had since December 12th, apparently 😄).

@woop
Copy link
Member

woop commented Feb 24, 2020

I don't think we have any special use of the assign feature in GitHub other than for the pull request author to remind/notify the maintainers to review it.

I guess /assign does that,

To complete the pull request process, please assign woop
You can assign the PR to them by writing /assign @woop in a comment when ready.

but apparently giving a /lgtm causes the bot to assign to you? Weird. The intention of how /lgtm is meant to work vs. /approve is not clear to me…

Anyway, I'm just wanting people to understand what the next step is on PRs, what they're waiting on—myself included This PR is small and a quality-of-life thing for all, I hope—how do we land it?

(I'm trying to digest #466 because we had to make a similar hack for Spark, and the changeset is a lot larger than the necessary scope because it caught up old missed formatting. So I scratched an itch I've had since December 12th, apparently ).

@ches, you can have a look at the "descriptions" for these commands over here: http://prow.feast.ai/command-help

From my understanding, the /lgtm should come from a reviewer while the /approve should come from the owner that agrees to merge in the code. That being said, its very ill-defined tbh.

@woop
Copy link
Member

woop commented Feb 24, 2020

/approve

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ches, woop

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@feast-ci-bot feast-ci-bot merged commit 6363540 into feast-dev:master Feb 24, 2020
@ches ches deleted the spotless-early branch February 25, 2020 02:08
@ches
Copy link
Member Author

ches commented Feb 25, 2020

you can have a look at the "descriptions" for these commands over here: http://prow.feast.ai/command-help

From my understanding, the /lgtm should come from a reviewer while the /approve should come from the owner that agrees to merge in the code. That being said, its very ill-defined tbh.

That makes sense, thanks. The command descriptions didn't help me much, at least for /lgtm. Maybe it assigned to @davidheryanto after he gave a /lgtm because he's an owner, as if to say "okay, you reviewed, so now you're a good person to take the next step too because you have approve/merge rights".

@ches
Copy link
Member Author

ches commented Feb 25, 2020

Ah, the other doc that the bot links to covers the distinction/intent for review process better. Read that some time ago, but I guess it's sinking in now…

davidheryanto pushed a commit to davidheryanto/feast that referenced this pull request Feb 26, 2020
* Fail formatting check before tests execute

By default, the spotless Maven plugin binds its check goal to the verify
phase (late in the lifecycle, after integration tests). Because we
currently only run `mvn test` for CI, it doesn't proceed as far as
verify so missed formatting is not caught by CI.

This binds the check to an earlier phase, in between test-compile and
test, so that it will fail before `mvn test` but not disrupt your dev
workflow of compiling main and test sources as you work. This strikes a
good compromise on failing fast for code standards without being _too_
nagging.

For the complete lifecycle reference, see:
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

* Apply spotless formatting

(cherry picked from commit 6363540)
zhilingc pushed a commit that referenced this pull request Feb 26, 2020
* Fail formatting check before tests execute

By default, the spotless Maven plugin binds its check goal to the verify
phase (late in the lifecycle, after integration tests). Because we
currently only run `mvn test` for CI, it doesn't proceed as far as
verify so missed formatting is not caught by CI.

This binds the check to an earlier phase, in between test-compile and
test, so that it will fail before `mvn test` but not disrupt your dev
workflow of compiling main and test sources as you work. This strikes a
good compromise on failing fast for code standards without being _too_
nagging.

For the complete lifecycle reference, see:
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

* Apply spotless formatting

(cherry picked from commit 6363540)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants