-
Notifications
You must be signed in to change notification settings - Fork 28.8k
[DONT MERGE] Enabled ImportOrder
check of Java code
#35949
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
Conversation
This reverts commit 8207b89.
ImportOrder
check of Java codeImportOrder
check of Java code
The Lines 156 to 163 in 4817b01
I try to re-enable it and change the rule as follows: <module name="ImportOrder">
<!-- simple imports -->
<property name="separated" value="true"/>
<property name="ordered" value="true"/>
<property name="groups" value="/^javax?\./,scala,*,org.apache.spark"/>
<!-- static imports -->
<property name="option" value="bottom"/>
<property name="staticGroups" value=""/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="separatedStaticGroups" value="true"/>
</module> The @srowen @dongjoon-hyun @HyukjinKwon I wonder if we need to complete this TODO ? |
The example of following the import java.io.IOException;
import java.nio.ByteBuffer;
import scala.Tuple2;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import org.apache.spark.network.buffer.ManagedBuffer;
import org.apache.spark.network.buffer.NioManagedBuffer;
import static org.apache.spark.network.shuffle.RetryingBlockTransferor.BlockTransferStarter;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*; |
I think this is mostly too much noise to bother with. Most imports are nearly-correctly-ordered and it matters little anyway. If there is a weaker check we can enforce (e.g. are imports grouped, if not ordered, correctly) that might be OK to try to enforce |
So we can accept a weak rule similar to the following: imports are grouped and interior of each group can be disordered ? |
Set |
@srowen for |
If this, still 180 files need to be changed :( |
I see, it's still a big change then. I'm not sure it's worth it. |
So should we remove this |
We could, I also don't care much about the TODO statement either |
ok |
What changes were proposed in this pull request?
This pr enabled ImportOrder check of Java code
Why are the changes needed?
Does this PR introduce any user-facing change?
No
How was this patch tested?
Pass GA