Skip to content

Commit

Permalink
FAB-4504 Add checkstyle import ordering rules
Browse files Browse the repository at this point in the history
. Enforced the order: java, javax, other, static
. All sections are sorted alphabetically
. Line breaks between groups are allowed but not enforced
. Changed pom.xml to display errors on console for maven builds
. Also fixed the ordering of the imports in a couple of source files

Change-Id: I8a0c57706ccaa4439806948adcc7cb67c432e493
Signed-off-by: Chris Murphy <chrism@fast.au.fujitsu.com>
  • Loading branch information
chrism28282828 committed Jun 10, 2017
1 parent d86c346 commit 2aee0bd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
7 changes: 7 additions & 0 deletions checkstyle-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="ImportOrder">
<property name="groups" value="/^java\./,javax"/>
<property name="ordered" value="true"/>
<property name="separated" value="false"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="option" value="bottom"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
</execution>
</executions>
<configuration>
<consoleOutput>false</consoleOutput>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import java.lang.ref.WeakReference;

import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import org.hyperledger.fabric.protos.peer.Chaincode.ChaincodeInvocationSpec;
import org.hyperledger.fabric.sdk.exception.InvalidProtocolBufferRuntimeException;

import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;

class ChaincodeInvocationSpecDeserializer {
private final ByteString byteString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package org.hyperledger.fabric.sdk.helper;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.File;
import java.io.IOException;
Expand All @@ -24,6 +23,7 @@
import java.util.List;
import java.util.Properties;

import com.google.protobuf.ByteString;
import org.bouncycastle.crypto.digests.SHA3Digest;
import org.bouncycastle.util.encoders.Hex;
import org.junit.Assert;
Expand All @@ -32,7 +32,8 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import com.google.protobuf.ByteString;
import static java.nio.charset.StandardCharsets.UTF_8;


public class UtilsTest {

Expand Down

0 comments on commit 2aee0bd

Please sign in to comment.