This is an automated email from the ASF dual-hosted git repository.

prhomberg pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 2bf85a6  GEODE-4953: Extend spotless to prohibit the use of wildcard 
imports. (#1926)
2bf85a6 is described below

commit 2bf85a646c5ddf8814b4dc496c336b8ffb0399fa
Author: Patrick Rhomberg <prhomb...@pivotal.io>
AuthorDate: Tue May 22 10:00:57 2018 -0700

    GEODE-4953: Extend spotless to prohibit the use of wildcard imports. (#1926)
---
 .../geode/connectors/jdbc/JdbcConnectorExceptionTest.java     |  2 +-
 gradle/spotless.gradle                                        | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcConnectorExceptionTest.java
 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcConnectorExceptionTest.java
index f48151b..e93174a 100644
--- 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcConnectorExceptionTest.java
+++ 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcConnectorExceptionTest.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.connectors.jdbc;
 
-import static org.assertj.core.api.Assertions.*;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.sql.SQLException;
 
diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle
index 22fe693..0aa8561 100644
--- a/gradle/spotless.gradle
+++ b/gradle/spotless.gradle
@@ -27,15 +27,20 @@ subprojects {
 
       // As the method name suggests, bump this number if any of the below 
"custom" rules change.
       // Spotless will not run on unchanged files unless this number changes.
-      bumpThisNumberIfACustomStepChanges(2)
+      bumpThisNumberIfACustomStepChanges(3)
 
       removeUnusedImports()
 
       custom 'Remove commented-out import statements', {
         it.replaceAll(/\n\/\/ import .*?;.*/, '')
       }
-
-      // Enforce style import order
+      custom 'Refuse wildcard imports', {
+        // Wildcard imports can't be resolved by spotless itself.
+        // This will require the developer themselves to adhere to best 
practices.
+        if (it =~ /\nimport .*\*;/) {
+          throw new AssertionError("Do not use wildcard imports.  
'spotlessApply' cannot resolve this issue.");
+        }
+      }
       importOrderFile 
"${project(':geode-core').projectDir}/../etc/eclipseOrganizeImports.importorder"
 
       custom 'Remove unhelpful javadoc stubs', {

-- 
To stop receiving notification emails like this one, please contact
prhomb...@apache.org.

Reply via email to