Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@malaDev
Copy link

@malaDev malaDev commented Oct 23, 2020

fixes #1818

Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

This change looks good to me.

cc @ampinsk just to take a look at the error message, and verify it is appropriate.

wantOut string
nontty bool
wantErr bool
throw bool
Copy link
Contributor

@samcoe samcoe Oct 26, 2020

Choose a reason for hiding this comment

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

I think we could rename wantErr to unsuccessfulChecks and throw to wantErr to make the purpose of them more clear.

Copy link
Author

Choose a reason for hiding this comment

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

that make sense

Comment on lines 210 to 214
if err != nil && tt.throw {
assert.Equal(t, tt.wantOut, err.Error())
return
}

Copy link
Contributor

@samcoe samcoe Oct 26, 2020

Choose a reason for hiding this comment

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

If we make the naming change above this could be changed to

if tt.wantErr {
  assert.Equal(t, tt.wantOut, err.Error())
} else if tt.unsuccessfulChecks {
  assert.Equal(t, "SilentError", err.Error())
} else {
  assert.NoError(t, err)
} 

This seems a bit more clear to me.

@ampinsk
Copy link
Contributor

ampinsk commented Oct 26, 2020

would no checks set up in this repository still work? Or is CI key to mention here?

Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

Thanks for making the requested changes, this looks great!

rollup := pr.Commits.Nodes[0].Commit.StatusCheckRollup.Contexts.Nodes
if len(rollup) == 0 {
return nil
return fmt.Errorf("no checks are set up for this repository")
Copy link
Contributor

@mislav mislav Oct 28, 2020

Choose a reason for hiding this comment

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

I like that the command is exiting with a nonzero status now! However, I do not think that this error message will always be accurate:

  1. The branch for the PR might not report any checks if the branch was just created, so before any Checks nor Statuses got registered by external services yet. Re-running the command a few seconds later could show that there are now checks registered as “pending”.

  2. The branch for the PR might not have associated checks because the base branch for the PR is not configured to run checks. However, a PR based on a different branch might have checks. So checks are often dependent on the particular branch settings, not just per-repo settings.

So, I think a better error message should be something more vague, like no checks reported on the 'foo' branch. I'd also like to hear if there are better ideas? 🙏

Should we also exit with nonzero status in the above len(pr.Commits.Nodes) condition where the PR does not appear to have any commits?

Copy link
Author

Choose a reason for hiding this comment

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

I agree with you about changing the message according to the branch, that make more sense.
And for the empty commits case, maybe no commit found on the pull request would just be ok

@malaDev malaDev requested a review from mislav October 29, 2020 06:02
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thank you!

I've pushed a commit that simplifies the test re: wantErr handling. 🙇

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.

Update messaging when gh pr check run on repo w/o CI

5 participants