mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-23 15:50:48 +00:00
Enable automatic code formatter with CI validation
This may be controversial but it we're doing it. Having code formatting needs to be consistent and a non-issue during code review. I'm willing modify the configuration if people see a strong need, but formatting needs to be present and enforced.
This commit is contained in:
@@ -15,22 +15,23 @@ import static org.kohsuke.github.Previews.*;
|
||||
* @see GHCommit#listComments()
|
||||
* @see GHCommit#createComment(String, String, Integer, Integer)
|
||||
*/
|
||||
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
|
||||
"NP_UNWRITTEN_FIELD"}, justification = "JSON API")
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
|
||||
"NP_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||
public class GHCommitComment extends GHObject implements Reactable {
|
||||
private GHRepository owner;
|
||||
|
||||
String body, html_url, commit_id;
|
||||
Integer line;
|
||||
String path;
|
||||
GHUser user; // not fully populated. beware.
|
||||
GHUser user; // not fully populated. beware.
|
||||
|
||||
public GHRepository getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL like 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
|
||||
* URL like
|
||||
* 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
|
||||
* show this commit comment in a browser.
|
||||
*/
|
||||
public URL getHtmlUrl() {
|
||||
@@ -49,19 +50,19 @@ public class GHCommitComment extends GHObject implements Reactable {
|
||||
}
|
||||
|
||||
/**
|
||||
* A commit comment can be on a specific line of a specific file, if so, this field points to a file.
|
||||
* Otherwise null.
|
||||
* A commit comment can be on a specific line of a specific file, if so, this field points to a file. Otherwise
|
||||
* null.
|
||||
*/
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* A commit comment can be on a specific line of a specific file, if so, this field points to the line number in the file.
|
||||
* Otherwise -1.
|
||||
* A commit comment can be on a specific line of a specific file, if so, this field points to the line number in the
|
||||
* file. Otherwise -1.
|
||||
*/
|
||||
public int getLine() {
|
||||
return line!=null ? line : -1;
|
||||
return line != null ? line : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,27 +83,22 @@ public class GHCommitComment extends GHObject implements Reactable {
|
||||
* Updates the body of the commit message.
|
||||
*/
|
||||
public void update(String body) throws IOException {
|
||||
new Requester(owner.root)
|
||||
.with("body", body)
|
||||
.method("PATCH").to(getApiTail(), GHCommitComment.class);
|
||||
new Requester(owner.root).with("body", body).method("PATCH").to(getApiTail(), GHCommitComment.class);
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Preview @Deprecated
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHReaction createReaction(ReactionContent content) throws IOException {
|
||||
return new Requester(owner.root)
|
||||
.withPreview(SQUIRREL_GIRL)
|
||||
.with("content", content.getContent())
|
||||
.to(getApiTail()+"/reactions", GHReaction.class).wrap(owner.root);
|
||||
return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
|
||||
.to(getApiTail() + "/reactions", GHReaction.class).wrap(owner.root);
|
||||
}
|
||||
|
||||
@Preview @Deprecated
|
||||
@Preview
|
||||
@Deprecated
|
||||
public PagedIterable<GHReaction> listReactions() {
|
||||
return owner.root.retrieve().withPreview(SQUIRREL_GIRL)
|
||||
.asPagedIterable(
|
||||
getApiTail()+"/reactions",
|
||||
GHReaction[].class,
|
||||
item -> item.wrap(owner.root) );
|
||||
return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiTail() + "/reactions",
|
||||
GHReaction[].class, item -> item.wrap(owner.root));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,10 +109,9 @@ public class GHCommitComment extends GHObject implements Reactable {
|
||||
}
|
||||
|
||||
private String getApiTail() {
|
||||
return String.format("/repos/%s/%s/comments/%s",owner.getOwnerName(),owner.getName(),id);
|
||||
return String.format("/repos/%s/%s/comments/%s", owner.getOwnerName(), owner.getName(), id);
|
||||
}
|
||||
|
||||
|
||||
GHCommitComment wrap(GHRepository owner) {
|
||||
this.owner = owner;
|
||||
if (owner.root.isOffline()) {
|
||||
|
||||
Reference in New Issue
Block a user