You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by dawidwys <gi...@git.apache.org> on 2017/07/14 09:25:43 UTC

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

GitHub user dawidwys opened a pull request:

    https://github.com/apache/flink/pull/4340

    [FLINK-7185] Activate checkstyle flink-java/io

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [ ] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [ ] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dawidwys/flink checkstyle-java-io

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/4340.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4340
    
----
commit 143157a2cd99c0855aebdee607583c566c004070
Author: Dawid Wysakowicz <dw...@apache.org>
Date:   2017-07-14T08:31:34Z

    [FLINK-7185] Activate checkstyle flink-java/io

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/4340
  
    merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127506011
  
    --- Diff: flink-java/src/test/java/org/apache/flink/api/java/io/CollectionInputFormatTest.java ---
    @@ -90,18 +94,18 @@ public String toString() {
     	@Test
     	public void testSerializability() {
     		try (ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    -			 ObjectOutputStream out = new ObjectOutputStream(buffer)) {
    +				ObjectOutputStream out = new ObjectOutputStream(buffer)) {
    --- End diff --
    
    indentation seems off.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r130338481
  
    --- Diff: flink-java/src/test/java/org/apache/flink/api/java/io/FromElementsTest.java ---
    @@ -22,7 +22,7 @@
     import org.junit.Test;
     
     /**
    - * Tests for {@link ExecutionEnvironment::fromElements}.
    + * Tests for {@link ExecutionEnvironment#fromElements}}.
    --- End diff --
    
    duplicate `}`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127580379
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java ---
    @@ -23,9 +23,32 @@
     import org.apache.flink.api.java.ExecutionEnvironment;
     import org.apache.flink.api.java.Utils;
     import org.apache.flink.api.java.operators.DataSource;
    -//CHECKSTYLE.OFF: AvoidStarImport - Needed for TupleGenerator
    -import org.apache.flink.api.java.tuple.*;
    -//CHECKSTYLE.ON: AvoidStarImport
    +import org.apache.flink.api.java.tuple.Tuple;
    +import org.apache.flink.api.java.tuple.Tuple1;
    +import org.apache.flink.api.java.tuple.Tuple10;
    +import org.apache.flink.api.java.tuple.Tuple11;
    +import org.apache.flink.api.java.tuple.Tuple12;
    +import org.apache.flink.api.java.tuple.Tuple13;
    +import org.apache.flink.api.java.tuple.Tuple14;
    +import org.apache.flink.api.java.tuple.Tuple15;
    +import org.apache.flink.api.java.tuple.Tuple16;
    +import org.apache.flink.api.java.tuple.Tuple17;
    +import org.apache.flink.api.java.tuple.Tuple18;
    +import org.apache.flink.api.java.tuple.Tuple19;
    --- End diff --
    
    Oh, ok. I didn't notice, it was because of code generation previously. How do we want to proceed with it then? Do we want to add suppression for it? Just adding the `//CHECKSTYLE: OFF` won't work as it violates the `ImportOrder` rule.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/4340


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127504115
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/CsvInputFormat.java ---
    @@ -21,13 +21,18 @@
     import org.apache.flink.annotation.Internal;
     import org.apache.flink.api.common.io.GenericCsvInputFormat;
     import org.apache.flink.core.fs.FileInputSplit;
    +import org.apache.flink.core.fs.Path;
     import org.apache.flink.types.parser.FieldParser;
     import org.apache.flink.util.Preconditions;
    +import org.apache.flink.util.StringUtils;
     
     import java.io.IOException;
    -import org.apache.flink.core.fs.Path;
    -import org.apache.flink.util.StringUtils;
     
    +/**
    + * InputFormat thar reads csv files.
    --- End diff --
    
    thar -> that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127506234
  
    --- Diff: flink-java/src/test/java/org/apache/flink/api/java/io/CsvInputFormatTest.java ---
    @@ -266,42 +269,41 @@ public void ignoreSingleCharPrefixComments() {
     			fail("Test failed due to a " + ex.getClass().getName() + ": " + ex.getMessage());
     		}
     	}
    -	
    +
     	@Test
     	public void ignoreMultiCharPrefixComments() {
     		try {
    -			
    -			
    +
     			final String fileContent = "//description of the data\n" +
    -									   "//successive commented line\n" +
    -									   "this is|1|2.0|\n"+
    -									   "a test|3|4.0|\n" +
    -									   "//next|5|6.0|\n";
    -			
    +										"//successive commented line\n" +
    --- End diff --
    
    move more to the left


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127505648
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/TextOutputFormat.java ---
    @@ -18,65 +18,73 @@
     
     package org.apache.flink.api.java.io;
     
    +import org.apache.flink.annotation.PublicEvolving;
    +import org.apache.flink.api.common.io.FileOutputFormat;
    +import org.apache.flink.core.fs.Path;
    +
     import java.io.IOException;
     import java.io.Serializable;
     import java.nio.charset.Charset;
     import java.nio.charset.IllegalCharsetNameException;
     import java.nio.charset.UnsupportedCharsetException;
     
    -import org.apache.flink.annotation.PublicEvolving;
    -import org.apache.flink.api.common.io.FileOutputFormat;
    -import org.apache.flink.core.fs.Path;
    -
    +/**
    + * {@link FileOutputFormat} that stores values by calling {@link Object#toString()} method.
    --- End diff --
    
    This isn't necessarily correct, as a `TextFormatter` might be used.
    
    How about
    ```
    A {@link FileOutputFormat} that writes objects to a text file.
    
    <p>Objects are converted to Strings using either {@link Object#toString()} or a {@link TextFormatter}.
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127504421
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java ---
    @@ -23,9 +23,32 @@
     import org.apache.flink.api.java.ExecutionEnvironment;
     import org.apache.flink.api.java.Utils;
     import org.apache.flink.api.java.operators.DataSource;
    -//CHECKSTYLE.OFF: AvoidStarImport - Needed for TupleGenerator
    -import org.apache.flink.api.java.tuple.*;
    -//CHECKSTYLE.ON: AvoidStarImport
    +import org.apache.flink.api.java.tuple.Tuple;
    +import org.apache.flink.api.java.tuple.Tuple1;
    +import org.apache.flink.api.java.tuple.Tuple10;
    +import org.apache.flink.api.java.tuple.Tuple11;
    +import org.apache.flink.api.java.tuple.Tuple12;
    +import org.apache.flink.api.java.tuple.Tuple13;
    +import org.apache.flink.api.java.tuple.Tuple14;
    +import org.apache.flink.api.java.tuple.Tuple15;
    +import org.apache.flink.api.java.tuple.Tuple16;
    +import org.apache.flink.api.java.tuple.Tuple17;
    +import org.apache.flink.api.java.tuple.Tuple18;
    +import org.apache.flink.api.java.tuple.Tuple19;
    --- End diff --
    
    ah...now i see why the star import is useful here; the tuple generator doesn't have to modify the import statements.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127504763
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/PrintingOutputFormat.java ---
    @@ -18,12 +18,16 @@
     
     package org.apache.flink.api.java.io;
     
    -import java.io.PrintStream;
    -
     import org.apache.flink.annotation.PublicEvolving;
     import org.apache.flink.api.common.io.RichOutputFormat;
     import org.apache.flink.configuration.Configuration;
     
    +import java.io.PrintStream;
    +
    +/**
    + * Output format that prints results into underlying {@link PrintStream}.
    --- End diff --
    
    I would reword this to mention stdout/stderr; the usage of `PrintStream` is an (unimportant) implementation detail.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127506443
  
    --- Diff: flink-java/src/test/java/org/apache/flink/api/java/io/FromElementsTest.java ---
    @@ -18,8 +18,12 @@
     package org.apache.flink.api.java.io;
     
     import org.apache.flink.api.java.ExecutionEnvironment;
    +
     import org.junit.Test;
     
    +/**
    + * Tests for {@link ExecutionEnvironment::fromElements}.
    --- End diff --
    
    is this a valid javadoc notation?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127505784
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/TextOutputFormat.java ---
    @@ -18,65 +18,73 @@
     
     package org.apache.flink.api.java.io;
     
    +import org.apache.flink.annotation.PublicEvolving;
    +import org.apache.flink.api.common.io.FileOutputFormat;
    +import org.apache.flink.core.fs.Path;
    +
     import java.io.IOException;
     import java.io.Serializable;
     import java.nio.charset.Charset;
     import java.nio.charset.IllegalCharsetNameException;
     import java.nio.charset.UnsupportedCharsetException;
     
    -import org.apache.flink.annotation.PublicEvolving;
    -import org.apache.flink.api.common.io.FileOutputFormat;
    -import org.apache.flink.core.fs.Path;
    -
    +/**
    + * {@link FileOutputFormat} that stores values by calling {@link Object#toString()} method.
    + * @param <T> type of elements
    + */
     @PublicEvolving
     public class TextOutputFormat<T> extends FileOutputFormat<T> {
     
     	private static final long serialVersionUID = 1L;
    -	
    +
     	private static final int NEWLINE = '\n';
     
     	private String charsetName;
    -	
    +
     	private transient Charset charset;
     
     	// --------------------------------------------------------------------------------------------
     
    -	public static interface TextFormatter<IN> extends Serializable {
    -		public String format(IN value);
    +
    +	/**
    +	 * Formatter that transforms values into its {@link String} representations.
    --- End diff --
    
    into its -> into their


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by dawidwys <gi...@git.apache.org>.
Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r130345351
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java ---
    @@ -23,9 +23,32 @@
     import org.apache.flink.api.java.ExecutionEnvironment;
     import org.apache.flink.api.java.Utils;
     import org.apache.flink.api.java.operators.DataSource;
    -//CHECKSTYLE.OFF: AvoidStarImport - Needed for TupleGenerator
    -import org.apache.flink.api.java.tuple.*;
    -//CHECKSTYLE.ON: AvoidStarImport
    +import org.apache.flink.api.java.tuple.Tuple;
    +import org.apache.flink.api.java.tuple.Tuple1;
    +import org.apache.flink.api.java.tuple.Tuple10;
    +import org.apache.flink.api.java.tuple.Tuple11;
    +import org.apache.flink.api.java.tuple.Tuple12;
    +import org.apache.flink.api.java.tuple.Tuple13;
    +import org.apache.flink.api.java.tuple.Tuple14;
    +import org.apache.flink.api.java.tuple.Tuple15;
    +import org.apache.flink.api.java.tuple.Tuple16;
    +import org.apache.flink.api.java.tuple.Tuple17;
    +import org.apache.flink.api.java.tuple.Tuple18;
    +import org.apache.flink.api.java.tuple.Tuple19;
    --- End diff --
    
    Yes, previously I tried:
    
        //CHECKSTYLE OFF: AvoidStarImport
        import org.apache.flink.api.java.tuple.*;
        //CHECKSTYLE ON: AvoidStarImport
    
    and it did not work as the comment line was treated as an empty line between import blocks.
    
    It worked though with the comments at the end of the line. Sorry I did not try it earlier.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r127506187
  
    --- Diff: flink-java/src/test/java/org/apache/flink/api/java/io/CsvInputFormatTest.java ---
    @@ -224,34 +230,31 @@ private void ignoreInvalidLines(int bufferSize) {
     			fail("Test failed due to a " + ex.getClass().getName() + ": " + ex.getMessage());
     		}
     	}
    -	
    +
     	@Test
     	public void ignoreSingleCharPrefixComments() {
     		try {
     			final String fileContent = "#description of the data\n" +
    -									   "#successive commented line\n" +
    -									   "this is|1|2.0|\n" +
    -									   "a test|3|4.0|\n" +
    -									   "#next|5|6.0|\n";
    -			
    +										"#successive commented line\n" + "this is|1|2.0|\n" + "a test|3|4.0|\n" + "#next|5|6.0|\n";
    --- End diff --
    
    lets move this line more to the left and keep them in separate lines


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #4340: [FLINK-7185] Activate checkstyle flink-java/io

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4340#discussion_r130338928
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java ---
    @@ -23,9 +23,32 @@
     import org.apache.flink.api.java.ExecutionEnvironment;
     import org.apache.flink.api.java.Utils;
     import org.apache.flink.api.java.operators.DataSource;
    -//CHECKSTYLE.OFF: AvoidStarImport - Needed for TupleGenerator
    -import org.apache.flink.api.java.tuple.*;
    -//CHECKSTYLE.ON: AvoidStarImport
    +import org.apache.flink.api.java.tuple.Tuple;
    +import org.apache.flink.api.java.tuple.Tuple1;
    +import org.apache.flink.api.java.tuple.Tuple10;
    +import org.apache.flink.api.java.tuple.Tuple11;
    +import org.apache.flink.api.java.tuple.Tuple12;
    +import org.apache.flink.api.java.tuple.Tuple13;
    +import org.apache.flink.api.java.tuple.Tuple14;
    +import org.apache.flink.api.java.tuple.Tuple15;
    +import org.apache.flink.api.java.tuple.Tuple16;
    +import org.apache.flink.api.java.tuple.Tuple17;
    +import org.apache.flink.api.java.tuple.Tuple18;
    +import org.apache.flink.api.java.tuple.Tuple19;
    --- End diff --
    
    We will have to disable them in place as we otherwise disable entire rules for some files. You can specify multiple rules to disable like this: `//CHECKSTYLE.OFF: AvoidStarImport|ImportOrder`. At least that should work.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---