-
Notifications
You must be signed in to change notification settings - Fork 737
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
Add Support for Retrieving Template Repository Information for a Repo… #1817
Conversation
…sitory Spotless apply Applied spotless
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.
Thanks for the PR!
I added some feeback and questions.
* @return the repository template | ||
*/ | ||
public GHRepository getTemplateRepository() throws CloneNotSupportedException { | ||
return (GHRepository) template_repository.clone(); |
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.
Why do you clone()
the repo? This looks odd to me (and I usually refrain from using clone()
).
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.
Also I suspect you will have to inject the root in the repository, unless it's done automatically by Jackson.
In any case, adding a test to test that you can actually execute an operation on the repository after getting it would be better.
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.
The clone method was because I've found an spotbug error "EI_EXPOSE_REP: May expose internal representation by returning reference to mutable object", it's for that reason I implements Clonable in this object, and return an object copy.
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 you need to add the following annotation to the method instead:
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected")
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.
Ok, It's another posibility, but I unknow the project security rules.
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.
Also I suspect you will have to inject the root in the repository, unless it's done automatically by Jackson.
In any case, adding a test to test that you can actually execute an operation on the repository after getting it would be better.
Sorry, my English is terrible, and I'm not sure about that comment.
Is the provided test sufficient?
/**
* Test get repository created from a template repository
*
* @throws Exception
* the exception
*/
@Test
public void testGetRepositoryWithTemplateRepositoryInfo() throws Exception {
GHRepository testRepo = gitHub.getRepositoryById(repo.getId());
assertThat(testRepo.getTemplateRepository(), notNullValue());
assertThat(testRepo.getTemplateRepository().getOwnerName(), equalTo("octocat"));
assertThat(testRepo.getTemplateRepository().isTemplate(), equalTo(true));
}
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1817 +/- ##
============================================
+ Coverage 80.66% 80.71% +0.04%
- Complexity 2342 2345 +3
============================================
Files 220 221 +1
Lines 7082 7119 +37
Branches 379 384 +5
============================================
+ Hits 5713 5746 +33
- Misses 1132 1136 +4
Partials 237 237 ☔ View full report in Codecov by Sentry. |
@gsmet Thank you for the review. I've resolved almost comments.
I'm not sure if with this solution provided is enought or you're waiting something more.....
|
Description
Add Support for Retrieving Template Repository Information for a Repository #1812
Before submitting a PR:
@link
JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.