[ 
https://issues.apache.org/jira/browse/FLINK-6107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15931770#comment-15931770
 ] 

ASF GitHub Bot commented on FLINK-6107:
---------------------------------------

GitHub user aljoscha opened a pull request:

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

    [FLINK-6107] Add custom checkstyle for flink-streaming-java

    I played around with this a bit over the weekend... 😃 
    
    This is a proposal for a way forward from the discussion on code style on 
the mailing list: 
https://lists.apache.org/thread.html/94c8c5186b315c58c3f8aaf536501b99e8b92ee97b0034dee295ff6a@%3Cdev.flink.apache.org%3E.
    
    This adds a custom `checkstyle.xml` based on the Apache Beam checkstyle for 
`flink-streaming-java` only. The code style is not really different form what 
we currently have, this just aims at unifying the existing codebase. The Flink 
specific changes are mostly:
     - Tabs instead of spaces
     - No line-length limit
     - We disallow a bunch of imports
    
    The first commit adds the checkstyle file but a lot of stuff is commented 
out because the Flink code base would fail those tests. The following commits 
subsequently add more and more invasive changes along with enabling more rules.
    
    The commits up to the last two commits at uncontroversial (in my opinion) 
checks that will make code reviews a lot easier in the future. Especially 
having an enforced import order and trailing whitespace policy will make import 
order changes and whitespace changes a thing of the past. The checks for 
spacing around unary and binary operators should also be unproblematic.
    
    The last two commits normalise the style of code blocks. Having a unified 
style for those should be good in the future and will prevent "edit wars" (same 
as for import order and whitespace) with people that have their IDE formatter 
configured differently.

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

    $ git pull https://github.com/aljoscha/flink 
strict-checkstyle-streaming-beam-style

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

    https://github.com/apache/flink/pull/3567.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 #3567
    
----
commit 78260ad4a349c7dc64d56742085899bc6c633e66
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-17T14:32:23Z

    [FLINK-6107] Custom checkstyle for flink-streaming-java
    
    This is based on the Apache Beam checkstyle with some custom
    modifications for making it fit the exisiting Flink code base. The most
    notable change is that Flink uses Tabs for indentation while Beam uses
    spaces.
    
    This adds a lot of checks that are commented out because they require
    non-trivial changes to the code base.
    
    There are some trivial code changes for good practices checkstyle rules
    that where only broken in very few places.

commit efbda9e9e6a88340d447988d90e1bd40d0940791
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T09:29:10Z

    [FLINK-6107] Enable newline at EOF check in streaming checkstyle

commit 42306cffcd0082ea5077892fb84e40371ba81377
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T10:17:47Z

    [FLINK-6107] Enable trailing whitespace check in streaming checkstyle

commit e8dd1759d059ac138b7a528ef4775217fbf55742
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T10:21:17Z

    [FLINK-6107] Enable Javadoc checks in streaming checkstyle

commit 4cd343c03fcbef3c8115005346d03a583e467849
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T11:23:22Z

    [FLINK-6107] Enable import order check in streaming checkstyle

commit bbc7d75bc692656707b70b844b044e71259d148a
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T13:54:35Z

    [FLINK-6107] Enable WhitespaceAfter check in streaming checkstyle

commit ccb3e28a66d17daee08bb71c89cdaf82fefc412b
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T14:02:00Z

    [FLINK-6107] Enable WhitespaceAround check in streaming checkstyle

commit 66f8f9b47f646ddaf2a333ec68ba51edac306c16
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T14:18:21Z

    [FLINK-6107] Enable RightCurly check in streaming checkstyle

commit e061edd14db4e3af6844697194aee78324170508
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T14:25:24Z

    [FLINK-6107] Enable LeftCurly check in streaming checkstyle

commit a88fb33dc02781e04030d7c91351659937d3a836
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T14:29:02Z

    [FLINK-6107] Enable MemberNameCheck in streaming checkstyle

commit 181d8b3649293b143106fe66d6a3b5c6b3dbaf93
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Date:   2017-03-19T14:30:23Z

    [FLINK-6107] Enable StaticVariableNameCheck in streaming checkstyle

----


> Add custom checkstyle for flink-streaming-java
> ----------------------------------------------
>
>                 Key: FLINK-6107
>                 URL: https://issues.apache.org/jira/browse/FLINK-6107
>             Project: Flink
>          Issue Type: Improvement
>          Components: DataStream API
>            Reporter: Aljoscha Krettek
>            Assignee: Aljoscha Krettek
>
> There was some consensus on the ML 
> (https://lists.apache.org/thread.html/94c8c5186b315c58c3f8aaf536501b99e8b92ee97b0034dee295ff6a@%3Cdev.flink.apache.org%3E)
>  that we want to have a more uniform code style. We should start 
> module-by-module and by introducing increasingly stricter rules. We have to 
> be aware of the PR situation and ensure that we have minimal breakage for 
> contributors.
> This issue aims at adding a custom checkstyle.xml for 
> {{flink-streaming-java}} that is based on our current checkstyle.xml but adds 
> these checks for Javadocs:
> {code}
> <!--
> JAVADOC CHECKS
> -->
> <!-- Checks for Javadoc comments.                     -->
> <!-- See http://checkstyle.sf.net/config_javadoc.html -->
> <module name="JavadocMethod">
>   <property name="scope" value="protected"/>
>   <property name="severity" value="error"/>
>   <property name="allowMissingJavadoc" value="true"/>
>   <property name="allowMissingParamTags" value="true"/>
>   <property name="allowMissingReturnTag" value="true"/>
>   <property name="allowMissingThrowsTags" value="true"/>
>   <property name="allowThrowsTagsForSubclasses" value="true"/>
>   <property name="allowUndeclaredRTE" value="true"/>
> </module>
> <!-- Check that paragraph tags are used correctly in Javadoc. -->
> <module name="JavadocParagraph"/>
> <module name="JavadocType">
>   <property name="scope" value="protected"/>
>   <property name="severity" value="error"/>
>   <property name="allowMissingParamTags" value="true"/>
> </module>
> <module name="JavadocStyle">
>   <property name="severity" value="error"/>
>   <property name="checkHtml" value="true"/>
> </module>
> {code}
> This checks:
>  - Every type has a type-level Javadoc
>  - Proper use of {{<p>}} in Javadocs
>  - First sentence must end with a proper punctuation mark
>  - Proper use (including closing) of HTML tags



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to