New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-6901] Flip checkstyle configuration files #4112
Conversation
@zentol did you mean to include |
tools/maven/suppressions-runtime.xml
Outdated
|
||
<suppressions> | ||
<suppress | ||
files=" (.*)runtime/akka/(.*)|(.*)runtime/blob/(.*)|(.*)runtime/broadcast/(.*)|(.*)runtime/checkpoint/(.*)|(.*)runtime/client/(.*)|(.*)runtime/clusterframework/(.*)|(.*)runtime/concurrent/(.*)|(.*)runtime/deployment/(.*)|(.*)runtime/execution/(.*)|(.*)runtime/executiongraph/(.*)|(.*)runtime/fs/(.*)|(.*)runtime/heartbeat/(.*)|(.*)runtime/highavailability/(.*)|(.*)runtime/instance/(.*)|(.*)runtime/io/(.*)|(.*)runtime/iterative/(.*)|(.*)runtime/jobgraph/(.*)|(.*)runtime/jobmanager/(.*)|(.*)runtime/jobmaster/(.*)|(.*)runtime/leaderelection/(.*)|(.*)runtime/memory/(.*)|(.*)runtime/messages/(.*)|(.*)runtime/minicluster/(.*)|(.*)runtime/net/(.*)|(.*)runtime/operators/(.*)|(.*)runtime/plugable/(.*)|(.*)runtime/query/(.*)|(.*)runtime/registration/(.*)|(.*)runtime/resourcemanager/(.*)|(.*)runtime/rpc/(.*)|(.*)runtime/security/(.*)|(.*)runtime/state/(.*)|(.*)runtime/taskexecutor/(.*)|(.*)runtime/taskmanager/(.*)|(.*)runtime/testutils/(.*)|(.*)runtime/util/(.*)|(.*)runtime/zookeeper/(.*)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we duplicate the listing one package per suppress
tag to prevent merge conflicts when removing excluded packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've split the suppressions by package.
@@ -114,15 +114,17 @@ public boolean next(StringValue target) { | |||
int pos = this.pos; | |||
|
|||
// skip the delimiter | |||
for (; pos < limit && Character.isWhitespace(data[pos]); pos++); | |||
for (; pos < limit && Character.isWhitespace(data[pos]); pos++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for these two changes in flink-core
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NeedBraces
module was extended with the strict-checkstyle to also apply to do
, while
and for
.
Since i can't selectively disable parts of the module I had to make the changes instead.
yes, i intended to include FLINK-6902, as described in the second paragraph of the PR description. |
+1 and my apologies for overlooking your comprehensive description. |
Looks like the same problem we have in flink-core also exists in flink-runtime, some braces are missing...
|
I've adjusted the suppressions file to properly work on windows (slashes...), and resolves the few issues in flink-runtime. I'm a bit unsure about the change in the NettyBufferPool, @uce does that look ok to you? |
536d7ac
to
a09d8e3
Compare
LGTM on a second look. Don't have any suggestion on NettyBufferPool. @uce? |
if (!PlatformDependent.hasUnsafe()) { | ||
try { | ||
Class.forName("sun.misc.Unsafe"); | ||
} catch (ClassNotFoundException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After checking with @StefanRRichter, it seems this check is unnecessary anyway since org.apache.flink.core.memory.MemoryUtils#UNSAFE
is getting the class if needed and if not existing, Flink should not start anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok with me to remove this check
671134f
to
76027e3
Compare
This PR makes the
strict-checkstyle.xml
the default checkstyle configuration.As a first step i made
flink-streaming-scala
checkstyle compliant (FLINK-6902), because it required few changes and i didn't want to add an exclusion only to remove it again tomorrow.Making the strict checkstyle the default required a few more changes than i expected. As it stands it is not possible to execute the checkstyle plugin twice in a single build with different configurations. This also implies that currently many parts of
flink-runtime
aren't even covered by the lenient checkstyle.So we need a way to both check the lenient for all files, and the strict for a subset in a single run. Given that the strict checkstyle is an extension of the lenient one i instead opted for creating suppression files for each of the non-covered modules, disabling all the new checks added by the strict checkstyle. This didn't work out completely as it still required resolving 2 violations in
flink-core
, but that's ok i guess.The suppression files are pretty ugly as they consist of a giant regex checking for every module in a single line, and the same for packages in flink-runtime, but i couldn't find a better solution. Spreading the regex over multiple-lines frustratingly enough doesn't work.
One could resolve this somewhat for flink-runtime by adding a separate suppression for every package, but you would still retain the endless rules regex.
Note that this change implies that every new module is now covered by the strict checkstyle.