-
Notifications
You must be signed in to change notification settings - Fork 751
Complete checks api #723
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
Complete checks api #723
Conversation
@XiongKezhi |
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.
Just so I understand it: the reason why there aren't more tests in here is because, for general reading of check runs (outside of events) we need to have a GHCheckSuite
for them right?
private String startedAt; | ||
private String completedAt; |
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.
These can be Date
instances I think and Jackson will handle the conversion.
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 just saw the GHObject
uses String
for such timestamps at first and convert them into Date
in getters. And I think if we want to get rid of setters, we may have to do it in this way, or we will get error messages from spot-bugs like may expose internal representation.
private String externalId; | ||
private String startedAt; | ||
private String completedAt; | ||
private URL htmlUrl; |
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 think the htmlUrl
and getHtmlUrl()
can be inherited from GHObject
. Please confirm.
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.
We can inherit the url
and getUrl
, but the getHtmlUrl()
is abstract in GHObject
, so I have to overwrite it.
return app; | ||
} | ||
|
||
public Output getOutput() { |
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.
Need the javadoc for this.
private String summary; | ||
private String text; | ||
private int annotationsCount; | ||
private URL annotationsUrl; |
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.
Do we have a CheckRunAnnotations
yet? If not we'll need that added eventually as well.
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.
That's where I'm confused. The response (or event payload) from GitHub does not include annotation
objects, but they are needed when users are making requests. So does our implementation have to make sure it supports both usages?
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.
Most probably it should support. Would be beneficial for users in the longer term
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.
It isn't required for this PR, I'm just noting it for later.
By the way, you have this marked as draft but this seems like a perfectly reasonable PR to submit and complete on its own if you choose to do so. |
It's because I'm still implementing the |
I'm not sure which kinds of tests our project requires, and I normally do not test the getters and setters, but I assume we have to test them here because the values are bound by Jackson? Also, I'm not sure how complete our tests have to be, for example, there is a |
private String summary; | ||
private String text; | ||
private int annotationsCount; | ||
private URL annotationsUrl; |
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.
Most probably it should support. Would be beneficial for users in the longer term
GHCheckRun checkRun = event.getCheckRun(); | ||
assertThat(checkRun.getName(), is("Octocoders-linter")); | ||
assertThat(checkRun.getHeadSha(), is("ec26c3e57ca3a959ca5aad62de7213c562f8c821")); | ||
assertThat(checkRun.getStatus(), is("completed")); |
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.
@XiongKezhi I guess there are multiple states of the check run that need to be tested for, Is this the only one?
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.
Yeah, that's one thing we can do. Before, I just changed the original JSON in order to cover more methods for convenience, but later I found more sample responses here, they are much better and maybe we can use them later.
I'm going to give you vague-ish answer. We require test coverage for any new code/features added to the project, but that is a recent decision, so there are lots of gaps in test coverage for the project overall. You do not need to do recursive tests, but we do need tests that show the objects are behaving correctly overall. You can save yourself some testing by not having public setters - then you only need to touch each of the getters at least once. Write a set of tests that your feel are reasonable and we can iterate to add more if they seem needed. |
* | ||
* @return timestamp of the commit | ||
*/ | ||
public Date getTimestamp() { |
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 don't see it on this page: https://developer.github.com/v3/repos/commits/#get-a-single-commit
I see this:
https://developer.github.com/v3/activity/events/types/#webhook-payload-example-1
It possible the "issue" in GHCheckSuite
is not a GHCommit
? But instead something else?
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.
sry, didn't notice that commit page and pay much attention to the structure. I'll add it inside GHCheckSuite
.
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.
Looks good. Thanks!
Nice one! |
Description
Adding more properties to GHCheckRun (in progress) and implementing GHCheckSuite (in progress).
Before submitting a PR:
We love getting PRs, but we hate asking people for the same basic changes every time.
master
. Create your PR from that branch.mvn -D enable-ci clean install site
locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.