Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Commit

Permalink
(#164) updated checkstyle.xml (#167)
Browse files Browse the repository at this point in the history
* Fixed checkstyle issues in src/main/java
  • Loading branch information
llorllale committed Mar 31, 2018
1 parent fa96729 commit 691e008
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 221 deletions.
14 changes: 13 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
<property name="offCommentFormat" value="@checkstyle.OFF\: [\w\|]+"/>
<property name="onCommentFormat" value="@checkstyle.ON\: [\w\|]+"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="@checkstyle (\w+) \((\d+) lines?\)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="$2"/>
</module>

<!--
Disallow non-final non-abstract classes.
Expand All @@ -84,7 +89,13 @@
<module name="Regexp">
<property name="message" value="All non-abstract classes must be final."/>
<property name="illegalPattern" value="true"/>
<property name="format" value="^((?!final)(?!abstract).)*class"/>
<property name="format" value="^((?!final)(?!abstract).)*[^\.]class"/>
<property name="ignoreComments" value="true"/>
</module>
<module name="Regexp">
<property name="message" value="All non-abstract classes must be final."/>
<property name="illegalPattern" value="true"/>
<property name="format" value="^class "/>
<property name="ignoreComments" value="true"/>
</module>

Expand Down Expand Up @@ -234,6 +245,7 @@
<module name="Indentation">
<property name="basicOffset" value="2"/>
<property name="caseIndent" value="2"/>
<property name="lineWrappingIndentation" value="2"/>
</module>
<module name="OuterTypeFilename"/>
<module name="TodoComment">
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<violationSeverity>info</violationSeverity>
<!--
@todo #164 <sourceDirectory> should be '${basedir}/src' in order to include
test sources in the checks, but there are MANY failures triggered there.
Will need to fix those step by step.
-->
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</configuration>
<reportSets>
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/org/llorllale/youtrack/api/DefaultComments.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@ final class DefaultComments implements Comments {
@Override
public Stream<Comment> stream() throws IOException, UnauthorizedException {
return new StreamOf<>(
new MappedCollection<>(
xml -> new XmlComment(this.issue(), this.session, xml),
new XmlsOf(
"//comment",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat(BASE_PATH)
.concat(this.issue().id())
.concat("/comment")
)
)
)
new MappedCollection<>(
xml -> new XmlComment(this.issue(), this.session, xml),
new XmlsOf(
"//comment",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat(BASE_PATH)
.concat(this.issue().id())
.concat("/comment")
)
)
)
)
)
)
);
}

Expand Down
34 changes: 17 additions & 17 deletions src/main/java/org/llorllale/youtrack/api/DefaultFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ public Project project() {
@Override
public Stream<ProjectField> stream() throws IOException, UnauthorizedException {
return new StreamOf<>(
new MappedCollection<>(
x -> new XmlProjectField(x, this.project(), this.session),
new XmlsOf(
"/projectCustomFieldRefs/projectCustomField",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat("/admin/project/")
.concat(this.project().id())
.concat("/customfield")
)
)
)
)
new MappedCollection<>(
x -> new XmlProjectField(x, this.project(), this.session),
new XmlsOf(
"/projectCustomFieldRefs/projectCustomField",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat("/admin/project/")
.concat(this.project().id())
.concat("/customfield")
)
)
)
)
)
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ final class DefaultIssueTimeTracking implements IssueTimeTracking {
@Override
public Stream<TimeTrackEntry> stream() throws IOException, UnauthorizedException {
return new StreamOf<>(
new MappedCollection<>(
xml -> new XmlTimeTrackEntry(this.issue, xml),
new XmlsOf(
"/workItems/workItem",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat(String.format(PATH_TEMPLATE, this.issue.id()))
)
)
)
new MappedCollection<>(
xml -> new XmlTimeTrackEntry(this.issue, xml),
new XmlsOf(
"/workItems/workItem",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat(String.format(PATH_TEMPLATE, this.issue.id()))
)
)
)
)
)
)
);
}

Expand Down
98 changes: 49 additions & 49 deletions src/main/java/org/llorllale/youtrack/api/DefaultIssues.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,26 @@ public Project project() {
public Stream<Issue> stream() throws IOException, UnauthorizedException {
final int pageSize = 10;
return new StreamOf<>(
new Pagination<>(
pageSize,
n -> new HttpRequestWithSession(
this.session,
new HttpGet(
new UncheckedUriBuilder(
this.session.baseUrl().toString()
.concat("/issue/byproject/")
.concat(this.project().id())
).param("after", String.valueOf(n))
.build()
)
),
resp ->
new MappedCollection<>(
xml -> new XmlIssue(this.project(), this.session, xml),
new XmlsOf("/issues/issue", resp)
),
this.httpClient
)
new Pagination<>(
pageSize,
n -> new HttpRequestWithSession(
this.session,
new HttpGet(
new UncheckedUriBuilder(
this.session.baseUrl().toString()
.concat("/issue/byproject/")
.concat(this.project().id())
).param("after", String.valueOf(n))
.build()
)
),
resp ->
new MappedCollection<>(
xml -> new XmlIssue(this.project(), this.session, xml),
new XmlsOf("/issues/issue", resp)
),
this.httpClient
)
);
}

Expand All @@ -104,20 +104,20 @@ public Optional<Issue> get(String issueId) throws IOException, UnauthorizedExcep
//when the issueId does not exist, YouTrack returns a 404 response with an error XML
//in the payload
return Optional.of(
new XmlOf(
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString().concat("/issue/").concat(issueId)
)
)
)
new XmlOf(
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString().concat("/issue/").concat(issueId)
)
)
)
)
)
).filter(x -> !x.child("//error").isPresent())
.map(x -> new XmlIssue(this.project(), this.session, x));
.map(x -> new XmlIssue(this.project(), this.session, x));
}

@Override
Expand All @@ -130,24 +130,24 @@ public Issue create(String summary, String description)
public Issue create(String summary, String description, Map<Field, FieldValue> fields)
throws IOException, UnauthorizedException {
return this.get(
new SubstringAfterLast(
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpPut(
new UncheckedUriBuilder(
this.session.baseUrl().toString().concat("/issue")
).param("project", this.project().id())
.param("summary", summary)
.paramIfPresent("description", Optional.ofNullable(description))
.build()
)
)
)
).httpResponse().getFirstHeader("Location").getValue(),
"/"
).get()
new SubstringAfterLast(
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpPut(
new UncheckedUriBuilder(
this.session.baseUrl().toString().concat("/issue")
).param("project", this.project().id())
.param("summary", summary)
.paramIfPresent("description", Optional.ofNullable(description))
.build()
)
)
)
).httpResponse().getFirstHeader("Location").getValue(),
"/"
).get()
).get().update().fields(fields);
}
}
52 changes: 26 additions & 26 deletions src/main/java/org/llorllale/youtrack/api/DefaultProjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,44 +68,44 @@ final class DefaultProjects implements Projects {
@Override
public Stream<Project> stream() throws IOException, UnauthorizedException {
return new StreamOf<>(
new MappedCollection<>(
xml -> new XmlProject(this.youtrack, this.session, xml),
new XmlsOf(
"/projects/project",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString().concat("/project/all")
)
)
)
new MappedCollection<>(
xml -> new XmlProject(this.youtrack, this.session, xml),
new XmlsOf(
"/projects/project",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString().concat("/project/all")
)
)
)
)
)
)
);
}

@Override
public Optional<Project> get(String id) throws IOException, UnauthorizedException {
return new MappedCollection<Xml, Project>(
xml -> new XmlProject(this.youtrack, this.session, xml),
new XmlsOf(
"/project",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat("/admin/project/")
.concat(id)
)
)
xml -> new XmlProject(this.youtrack, this.session, xml),
new XmlsOf(
"/project",
new HttpResponseAsResponse(
this.httpClient.execute(
new HttpRequestWithSession(
this.session,
new HttpGet(
this.session.baseUrl().toString()
.concat("/admin/project/")
.concat(id)
)
)
)
)
)
).stream().findAny();
}
}

1 comment on commit 691e008

@0pdd
Copy link

@0pdd 0pdd commented on 691e008 Mar 31, 2018

Choose a reason for hiding this comment

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

Puzzle 164-782b906d discovered in pom.xml and submitted as #168. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.