Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 16 commits into from
Mar 4, 2020
Merged

Conversation

XiongKezhi
Copy link
Contributor

@XiongKezhi XiongKezhi commented Feb 29, 2020

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.

  • Push your changes to a branch other than master. Create your PR from that branch.
  • Add JavaDocs and other comments
  • Write tests that run and pass in CI. See CONTRIBUTING.md for details on how to capture snapshot data.
  • Run 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.

src/main/java/org/kohsuke/github/GHCheckRun.java Outdated Show resolved Hide resolved
@bitwiseman
Copy link
Member

@XiongKezhi
I'm about to start reviewing this but want to start by saying thank you. This is looks like a big improvement.

Copy link
Member

@bitwiseman bitwiseman left a 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?

Comment on lines +26 to +27
private String startedAt;
private String completedAt;
Copy link
Member

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.

Copy link
Contributor Author

@XiongKezhi XiongKezhi Mar 1, 2020

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;
Copy link
Member

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.

Copy link
Contributor Author

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() {
Copy link
Member

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;
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Member

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.

@bitwiseman
Copy link
Member

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.

@XiongKezhi
Copy link
Contributor Author

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 GHCheckSuite, I'll make it a normal PR after that. Appreciate your review!

@XiongKezhi
Copy link
Contributor Author

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?

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 GHRepositoryin our GHEventPayload.CheckRun, do we have to test whether each value of GHRepositoryis correct? I think such a recursive style is not necessary, so I just test some basic properties like id or name of the objects in CheckRun to make sure that Jackson reaches those.

private String summary;
private String text;
private int annotationsCount;
private URL annotationsUrl;
Copy link
Contributor

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"));
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@XiongKezhi XiongKezhi marked this pull request as ready for review March 2, 2020 06:40
@bitwiseman
Copy link
Member

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?

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 GHRepositoryin our GHEventPayload.CheckRun, do we have to test whether each value of GHRepositoryis correct? I think such a recursive style is not necessary, so I just test some basic properties like id or name of the objects in CheckRun to make sure that Jackson reaches those.

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() {
Copy link
Member

@bitwiseman bitwiseman Mar 2, 2020

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?

Copy link
Contributor Author

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.

Copy link
Member

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@bitwiseman bitwiseman merged commit c22a718 into hub4j:master Mar 4, 2020
@oleg-nenashev
Copy link
Collaborator

Nice one!

@jglick jglick mentioned this pull request Mar 25, 2020
4 tasks
@XiongKezhi XiongKezhi deleted the complete-checks-api branch March 30, 2020 16:26
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.