X Tutup
Skip to content

pr status: avoid printing a lonely "1" when there is only one Check#81

Merged
mislav merged 4 commits intomasterfrom
pr-status-single-check
Nov 21, 2019
Merged

pr status: avoid printing a lonely "1" when there is only one Check#81
mislav merged 4 commits intomasterfrom
pr-status-single-check

Conversation

@mislav
Copy link
Copy Markdown
Contributor

@mislav mislav commented Nov 15, 2019

In a repository that only has a single Check configured (e.g. this repo), we would print "checks: 1" for PRs where the CI is passing. This looks akward when repeated for each PR and provides little useful information.

This avoids ever printing "1" and instead prints "failing", "pending", or "success", respectively. We now only show numbers for PRs that have more than one Check run.

Screen Shot 2019-11-15 at 12 46 52 PM

In a repository that only has a single Check configured (e.g. this
repo), we would print "checks: 1" for PRs where the CI is passing. This
looks akward when repeated for each PR and provides little useful
information.

This avoids ever printing "1" and instead prints "failing", "pending",
or "success", respectively. We now only show numbers for repositories
that have more than one Check runs.
@vilmibm
Copy link
Copy Markdown
Contributor

vilmibm commented Nov 15, 2019

I'm curious what @ampinsk thinks, but this makes me think we could show success, pending, or $count failed?

I find the floating 2 just as confusing as the floating 1; and subjectively I like knowing that either everything passed (and i don't care how many checks there are) or what number of them failed (preferably out of a total).

@mislav
Copy link
Copy Markdown
Contributor Author

mislav commented Nov 15, 2019

I find the floating 2 just as confusing as the floating 1; and subjectively I like knowing that either everything passed (and i don't care how many checks there are) or what number of them failed (preferably out of a total).

That makes sense, let's get input from design and keep this conversation going.

I would prefer to mimic the web UI and just show "success" or "failing" (or an icon, no numbers), but unlike in the web UI where you can click on that, the CLI right now wouldn't offer you any extra information about the failures.

@ampinsk
Copy link
Copy Markdown

ampinsk commented Nov 15, 2019

Hmm in my head, the states are:

  • All checks passing (seems like the # here is less helpful)
  • Checks pending (not sure how much detail here is helpful)
  • X/XX checks failing

Any thoughts on that?

Now the possible outputs are:

- "checks: pending" (yellow)
- "checks: success" (green)
- "checks: failing" (red) - 1 out of 1 check failed
- "checks: 3/5 failing" (red) - 3 out of 5 checks failed
@mislav
Copy link
Copy Markdown
Contributor Author

mislav commented Nov 19, 2019

Thank you for the ideas! I've updated the behavior; the possible outputs are now:

  • "checks: pending" (yellow)
  • "checks: success" (green)
  • "checks: failing" (red) - 1 out of 1 check failed
  • "checks: 3/5 failing" (red) - 3 out of 5 checks failed

I wanted to avoid showing "1/1" on repos that only have one check configured; let me know what you think about that please

@ampinsk
Copy link
Copy Markdown

ampinsk commented Nov 19, 2019

Thank you Mislav! Any thoughts on making them:

  • “Checks pending” (yellow)
  • “Checks passing” (green)
  • “All checks failing” (red) For all states when every check is failing, including 1/1
  • “X/XX checks failing” (red)

I also included some formatting tweaking here to align a little more with the designs and dotcom. Let me know what you think!

@mislav
Copy link
Copy Markdown
Contributor Author

mislav commented Nov 20, 2019

@ampinsk done!

Screen Shot 2019-11-20 at 11 59 33 AM

@ampinsk
Copy link
Copy Markdown

ampinsk commented Nov 20, 2019

Yay looks great! Thanks Mislav! 🎉

Copy link
Copy Markdown
Contributor

@probablycorey probablycorey left a comment

Choose a reason for hiding this comment

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

I've got one concern, but I don't want it to block shipping this.

ratio = fmt.Sprintf("%d", checks.Total)
ratio = utils.Green(ratio)
summary = utils.Green("Checks passing")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a little worried about this if block. It's hard to tell just from reading it if the summary will always be set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's an interesting and valid point. I think that, for now, we can trust that the ChecksStatus object will either satisfy checks.Passing == checks.Total, or that either Failing or Pending will be non-zero. These are the only 3 possible scenarios and they're all covered. Of course, it might be possible that ChecksStatus() has a bug in it and return some inconsistent state, but if we discover that, we can fix it in CheckStatus and add more tests there. 👍

@mislav mislav merged commit ce4fae3 into master Nov 21, 2019
@mislav mislav deleted the pr-status-single-check branch November 21, 2019 14:27
por1981

This comment was marked as spam.

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.

5 participants

X Tutup