Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #331 from spotify/rculbertson/checkstyle
Browse files Browse the repository at this point in the history
Updated checkstyle version and configuration
  • Loading branch information
rculbertson committed Dec 22, 2014
2 parents 2205d79 + e00949e commit 7802583
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 22 deletions.
35 changes: 23 additions & 12 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ page at http://checkstyle.sourceforge.net/config.html -->
<property name="severity" value="error"/>
</module>

<module name="AvoidStarImport"/>
<module name="NoLineWrap"/>

<!--
NAMING CHECKS
Expand Down Expand Up @@ -211,6 +214,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
<property name="severity" value="error"/>
</module>

<module name="ArrayTypeStyle"/>

<!--
Expand All @@ -234,18 +238,25 @@ page at http://checkstyle.sourceforge.net/config.html -->
-->

<module name="WhitespaceAround">
<!-- Checks that various tokens are surrounded by whitespace.
This includes most binary operators and keywords followed
by regular or curly braces.
-->
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
<property name="severity" value="error"/>
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace."/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>

<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>

<module name="WhitespaceAfter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public static JsonNode readTree(final byte[] bytes) throws IOException {
return OBJECT_MAPPER.readTree(bytes);
}

public static JsonNode readTreeUnchecked(final byte[] bytes){
public static JsonNode readTreeUnchecked(final byte[] bytes) {
try {
return readTree(bytes);
} catch (IOException e) {
Expand All @@ -269,7 +269,7 @@ public static JsonNode readTree(final String content) throws IOException {
return OBJECT_MAPPER.readTree(content);
}

public static JsonNode readTreeUnchecked(final String content){
public static JsonNode readTreeUnchecked(final String content) {
try {
return readTree(content);
} catch (IOException e) {
Expand All @@ -281,7 +281,7 @@ public static JsonNode readTree(final File file) throws IOException {
return OBJECT_MAPPER.readTree(file);
}

public static JsonNode readTreeUnchecked(final File file){
public static JsonNode readTreeUnchecked(final File file) {
try {
return readTree(file);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.AbstractIdleService;

import com.spotify.helios.common.descriptors.*;
import com.spotify.helios.common.descriptors.Goal;
import com.spotify.helios.common.descriptors.Job;
import com.spotify.helios.common.descriptors.JobId;
import com.spotify.helios.common.descriptors.Task;
import com.spotify.helios.common.descriptors.TaskStatus;
import com.spotify.helios.servicescommon.PersistentAtomicReference;
import com.spotify.helios.servicescommon.Reactor;
import com.spotify.helios.servicescommon.ReactorFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ public void test() throws Exception {
final Map<String, Object> resultObj2 = OBJECT_MAPPER.readValue(result2, MAP_TYPE);
// It might conceivably get here at some point, but better be empty if it does
assertTrue(resultObj2.isEmpty());
} catch (JsonParseException e) {}
} catch (JsonParseException ignored) {
}

final String result3 = cli("jobs", "-y", "--json");
try {
final Map<String, Object> resultObj3 = OBJECT_MAPPER.readValue(result3, MAP_TYPE);
assertTrue(result3, resultObj3.isEmpty());
} catch (JsonParseException e) {}
} catch (JsonParseException ignored) {
}

HeliosClient client = defaultClient();
client.deploy(Deployment.of(jobId, Goal.START), testHost());
Expand All @@ -86,6 +88,7 @@ public void test() throws Exception {
try {
final Map<String, Object> resultObj4 = OBJECT_MAPPER.readValue(result4, MAP_TYPE);
assertFalse(resultObj4.isEmpty());
} catch (JsonParseException e) {}
} catch (JsonParseException ignored) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ protected ZooKeeperTestManager zooKeeperTestManager() {
}

@Override
protected void tearDownJobs() {}
protected void tearDownJobs() {
}

@Test
public void test() throws Exception {
Expand Down Expand Up @@ -112,7 +113,9 @@ public CuratorFramework newClient(String connectString,
try {
when(builder.forPath(anyString())).thenThrow(
new KeeperException.ConnectionLossException());
} catch (Exception e) {} // never throws
} catch (Exception ignored) {
// never throws
}
when(curator.newNamespaceAwareEnsurePath(anyString())).thenReturn(mock(EnsurePath.class));

return curator;
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.12.1</version>
<version>2.13</version>
<executions>
<execution>
<id>validate</id>
Expand All @@ -456,6 +456,13 @@
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.1.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit 7802583

Please sign in to comment.