From 214165e56378e62496993b6f431db9a7ddc95db9 Mon Sep 17 00:00:00 2001 From: zentol Date: Fri, 26 May 2017 09:47:11 +0200 Subject: [PATCH] [FLINK-6728] Activate strict checkstyle for flink-quickstart --- .../org/apache/flink/quickstart/Dummy.java | 1 - .../src/main/java/BatchJob.java | 8 ++--- .../main/java/SocketTextStreamWordCount.java | 23 ++++++------ .../src/main/java/StreamingJob.java | 8 ++--- .../src/main/java/WordCount.java | 7 ++-- .../org/apache/flink/quickstart/Dummy.java | 1 - flink-quickstart/pom.xml | 35 +++++++++++++++++++ 7 files changed, 56 insertions(+), 27 deletions(-) diff --git a/flink-quickstart/flink-quickstart-java/src/main/java/org/apache/flink/quickstart/Dummy.java b/flink-quickstart/flink-quickstart-java/src/main/java/org/apache/flink/quickstart/Dummy.java index b9a76d24ebc2f..b590d76983423 100644 --- a/flink-quickstart/flink-quickstart-java/src/main/java/org/apache/flink/quickstart/Dummy.java +++ b/flink-quickstart/flink-quickstart-java/src/main/java/org/apache/flink/quickstart/Dummy.java @@ -16,7 +16,6 @@ * limitations under the License. */ - package org.apache.flink.quickstart; /** diff --git a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/BatchJob.java b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/BatchJob.java index a64742f5a5e22..d0e68a4b265be 100644 --- a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/BatchJob.java +++ b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/BatchJob.java @@ -23,10 +23,10 @@ /** * Skeleton for a Flink Batch Job. * - * For a full example of a Flink Batch Job, see the WordCountJob.java file in the + *

For a full example of a Flink Batch Job, see the WordCountJob.java file in the * same package/directory or have a look at the website. * - * You can also generate a .jar file that you can submit on your Flink + *

You can also generate a .jar file that you can submit on your Flink * cluster. * Just type * mvn clean package @@ -36,9 +36,9 @@ * From the CLI you can then run * ./bin/flink run -c ${package}.BatchJob target/${artifactId}-${version}.jar * - * For more information on the CLI see: + *

For more information on the CLI see: * - * http://flink.apache.org/docs/latest/apis/cli.html + *

http://flink.apache.org/docs/latest/apis/cli.html */ public class BatchJob { diff --git a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/SocketTextStreamWordCount.java b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/SocketTextStreamWordCount.java index abd62bb0c2ff3..9f4fbfff235e4 100644 --- a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/SocketTextStreamWordCount.java +++ b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/SocketTextStreamWordCount.java @@ -27,26 +27,23 @@ * This example shows an implementation of WordCount with data from a text * socket. To run the example make sure that the service providing the text data * is already up and running. - * - *

- * To start an example socket text stream on your local machine run netcat from + * + *

To start an example socket text stream on your local machine run netcat from * a command line: nc -lk 9999, where the parameter specifies the * port number. - * - * - *

- * Usage: + * + * + *

Usage: * SocketTextStreamWordCount <hostname> <port> *
- * - *

- * This example shows how to: + * + *

This example shows how to: *

- * + * * @see netcat */ public class SocketTextStreamWordCount { @@ -92,7 +89,7 @@ public static void main(String[] args) throws Exception { /** * Implements the string tokenizer that splits sentences into words as a user-defined * FlatMapFunction. The function takes a line (String) and splits it into - * multiple pairs in the form of "(word,1)" (Tuple2). + * multiple pairs in the form of "(word,1)" (Tuple2<String, Integer>). */ public static final class LineSplitter implements FlatMapFunction> { @@ -108,5 +105,5 @@ public void flatMap(String value, Collector> out) { } } } - } + } } diff --git a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/StreamingJob.java b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/StreamingJob.java index 2b157551b1aa2..45a67ae3b7bcf 100644 --- a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/StreamingJob.java +++ b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/StreamingJob.java @@ -24,10 +24,10 @@ /** * Skeleton for a Flink Streaming Job. * - * For a full example of a Flink Streaming Job, see the SocketTextStreamWordCount.java + *

For a full example of a Flink Streaming Job, see the SocketTextStreamWordCount.java * file in the same package/directory or have a look at the website. * - * You can also generate a .jar file that you can submit on your Flink + *

You can also generate a .jar file that you can submit on your Flink * cluster. * Just type * mvn clean package @@ -37,9 +37,9 @@ * From the CLI you can then run * ./bin/flink run -c ${package}.StreamingJob target/${artifactId}-${version}.jar * - * For more information on the CLI see: + *

For more information on the CLI see: * - * http://flink.apache.org/docs/latest/apis/cli.html + *

http://flink.apache.org/docs/latest/apis/cli.html */ public class StreamingJob { diff --git a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/WordCount.java b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/WordCount.java index 6202238426538..6c953890ff356 100644 --- a/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/WordCount.java +++ b/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/src/main/java/WordCount.java @@ -18,9 +18,9 @@ * limitations under the License. */ +import org.apache.flink.api.common.functions.FlatMapFunction; import org.apache.flink.api.java.DataSet; import org.apache.flink.api.java.ExecutionEnvironment; -import org.apache.flink.api.common.functions.FlatMapFunction; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.util.Collector; @@ -28,8 +28,7 @@ * Implements the "WordCount" program that computes a simple word occurrence histogram * over some sample data * - *

- * This example shows how to: + *

This example shows how to: *

    *
  • write a simple Flink program. *
  • use Tuple data types. @@ -75,7 +74,7 @@ public static void main(String[] args) throws Exception { /** * Implements the string tokenizer that splits sentences into words as a user-defined * FlatMapFunction. The function takes a line (String) and splits it into - * multiple pairs in the form of "(word,1)" (Tuple2). + * multiple pairs in the form of "(word,1)" (Tuple2<String, Integer>). */ public static final class LineSplitter implements FlatMapFunction> { diff --git a/flink-quickstart/flink-quickstart-scala/src/main/java/org/apache/flink/quickstart/Dummy.java b/flink-quickstart/flink-quickstart-scala/src/main/java/org/apache/flink/quickstart/Dummy.java index b9a76d24ebc2f..b590d76983423 100644 --- a/flink-quickstart/flink-quickstart-scala/src/main/java/org/apache/flink/quickstart/Dummy.java +++ b/flink-quickstart/flink-quickstart-scala/src/main/java/org/apache/flink/quickstart/Dummy.java @@ -16,7 +16,6 @@ * limitations under the License. */ - package org.apache.flink.quickstart; /** diff --git a/flink-quickstart/pom.xml b/flink-quickstart/pom.xml index ea669cd03b586..29befc8f0182a 100644 --- a/flink-quickstart/pom.xml +++ b/flink-quickstart/pom.xml @@ -92,6 +92,41 @@ under the License. + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + + com.puppycrawl.tools + checkstyle + 6.19 + + + + /tools/maven/strict-checkstyle.xml + /tools/maven/suppressions.xml + true + true + true + + + + + test-compile + + check + + + +