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 <[email protected]>
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 <[email protected]>
Date: 2017-03-19T09:29:10Z
[FLINK-6107] Enable newline at EOF check in streaming checkstyle
commit 42306cffcd0082ea5077892fb84e40371ba81377
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T10:17:47Z
[FLINK-6107] Enable trailing whitespace check in streaming checkstyle
commit e8dd1759d059ac138b7a528ef4775217fbf55742
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T10:21:17Z
[FLINK-6107] Enable Javadoc checks in streaming checkstyle
commit 4cd343c03fcbef3c8115005346d03a583e467849
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T11:23:22Z
[FLINK-6107] Enable import order check in streaming checkstyle
commit bbc7d75bc692656707b70b844b044e71259d148a
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T13:54:35Z
[FLINK-6107] Enable WhitespaceAfter check in streaming checkstyle
commit ccb3e28a66d17daee08bb71c89cdaf82fefc412b
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T14:02:00Z
[FLINK-6107] Enable WhitespaceAround check in streaming checkstyle
commit 66f8f9b47f646ddaf2a333ec68ba51edac306c16
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T14:18:21Z
[FLINK-6107] Enable RightCurly check in streaming checkstyle
commit e061edd14db4e3af6844697194aee78324170508
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T14:25:24Z
[FLINK-6107] Enable LeftCurly check in streaming checkstyle
commit a88fb33dc02781e04030d7c91351659937d3a836
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T14:29:02Z
[FLINK-6107] Enable MemberNameCheck in streaming checkstyle
commit 181d8b3649293b143106fe66d6a3b5c6b3dbaf93
Author: Aljoscha Krettek <[email protected]>
Date: 2017-03-19T14:30:23Z
[FLINK-6107] Enable StaticVariableNameCheck in streaming checkstyle
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---