Bound Checkstyle to validate goal for automated enforcement. (#1149)
This commit is contained in:
parent
3d6800874c
commit
eb6fd0cf32
6 changed files with 86 additions and 0 deletions
|
|
@ -130,7 +130,9 @@ class ShardConsumerSubscriber implements Subscriber<RecordsRetrieved> {
|
|||
Duration timeSinceLastResponse = Duration.between(lastRequestTime, now);
|
||||
if (timeSinceLastResponse.toMillis() > maxTimeBetweenRequests) {
|
||||
log.error(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: Last request was dispatched at {}, but no response as of {} ({}). Cancelling subscription, and restarting. Last successful request details -- {}",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
shardInfoId, lastRequestTime, now, timeSinceLastResponse, recordsPublisher.getLastSuccessfulRequestDetails());
|
||||
cancel();
|
||||
|
||||
|
|
|
|||
|
|
@ -369,7 +369,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher {
|
|||
} else {
|
||||
if (triggeringFlow != null) {
|
||||
log.debug(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: [SubscriptionLifetime] - (FanOutRecordsPublisher#errorOccurred) @ {} id: {} -- {} -> triggeringFlow wasn't the active flow. Didn't dispatch error",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
streamAndShardId, triggeringFlow.connectionStartedAt, triggeringFlow.subscribeToShardId,
|
||||
category.throwableTypeString);
|
||||
triggeringFlow.cancel();
|
||||
|
|
@ -605,7 +607,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher {
|
|||
synchronized (lockObject) {
|
||||
if (subscriber != s) {
|
||||
log.warn(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: (FanOutRecordsPublisher/Subscription#request) - Rejected an attempt to request({}), because subscribers don't match. Last successful request details -- {}",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
streamAndShardId, n, lastSuccessfulRequestDetails);
|
||||
return;
|
||||
}
|
||||
|
|
@ -632,13 +636,17 @@ public class FanOutRecordsPublisher implements RecordsPublisher {
|
|||
synchronized (lockObject) {
|
||||
if (subscriber != s) {
|
||||
log.warn(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: (FanOutRecordsPublisher/Subscription#cancel) - Rejected attempt to cancel subscription, because subscribers don't match. Last successful request details -- {}",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
streamAndShardId, lastSuccessfulRequestDetails);
|
||||
return;
|
||||
}
|
||||
if (!hasValidSubscriber()) {
|
||||
log.warn(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: (FanOutRecordsPublisher/Subscription#cancel) - Cancelled called even with an invalid subscriber. Last successful request details -- {}",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
streamAndShardId, lastSuccessfulRequestDetails);
|
||||
}
|
||||
subscriber = null;
|
||||
|
|
@ -808,7 +816,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher {
|
|||
isErrorDispatched = true;
|
||||
} else {
|
||||
log.debug(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: [SubscriptionLifetime]: (RecordFlow#exceptionOccurred) @ {} id: {} -- An error has previously been dispatched, not dispatching this error {}: {}",
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
parent.streamAndShardId, connectionStartedAt, subscribeToShardId, throwable.getClass().getName(),
|
||||
throwable.getMessage());
|
||||
}
|
||||
|
|
@ -839,7 +849,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher {
|
|||
.add(new RecordsRetrievedContext(Either.right(subscriptionShutdownEvent), this, Instant.now()));
|
||||
} catch (Exception e) {
|
||||
log.warn(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: Unable to enqueue the {} shutdown event due to capacity restrictions in delivery queue with remaining capacity {}. Ignoring. Last successful request details -- {}",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
parent.streamAndShardId, subscriptionShutdownEvent.getEventIdentifier(), parent.recordsDeliveryQueue.remainingCapacity(),
|
||||
parent.lastSuccessfulRequestDetails, subscriptionShutdownEvent.getShutdownEventThrowableOptional());
|
||||
}
|
||||
|
|
@ -863,7 +875,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher {
|
|||
}
|
||||
if (this.isDisposed) {
|
||||
log.warn(
|
||||
// CHECKSTYLE.OFF: LineLength
|
||||
"{}: [SubscriptionLifetime]: (RecordFlow#complete) @ {} id: {} -- This flow has been disposed not dispatching completion. Last successful request details -- {}",
|
||||
// CHECKSTYLE.ON: LineLength
|
||||
parent.streamAndShardId, connectionStartedAt, subscribeToShardId, parent.lastSuccessfulRequestDetails);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,9 @@ public class KinesisDataFetcher implements DataFetcher {
|
|||
}
|
||||
}
|
||||
|
||||
// CHECKSTYLE.OFF: MemberName
|
||||
final DataFetcherResult TERMINAL_RESULT = new DataFetcherResult() {
|
||||
// CHECKSTYLE.ON: MemberName
|
||||
@Override
|
||||
public GetRecordsResponse getResult() {
|
||||
return GetRecordsResponse.builder()
|
||||
|
|
|
|||
8
checkstyle/checkstyle-suppressions.xml
Normal file
8
checkstyle/checkstyle-suppressions.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
|
||||
<suppressions>
|
||||
<!-- Disable all checks for protobuf-generated files. -->
|
||||
<suppress files=".*/kpl/Messages.java" checks="[a-zA-Z0-9]*"/>
|
||||
</suppressions>
|
||||
39
checkstyle/checkstyle.xml
Normal file
39
checkstyle/checkstyle.xml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<module name="Checker">
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="LineLength">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="max" value="170"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
|
||||
<module name="SuppressWithPlainTextCommentFilter">
|
||||
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
|
||||
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
|
||||
<!-- $1 refers to the first match group in the regex defined in commentFormat -->
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="ConstantName"/>
|
||||
<module name="InvalidJavadocPosition"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="OneStatementPerLine"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
21
pom.xml
21
pom.xml
|
|
@ -72,6 +72,27 @@
|
|||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<configLocation>checkstyle/checkstyle.xml</configLocation>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<suppressionsLocation>checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
|||
Loading…
Reference in a new issue