You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by GitBox <gi...@apache.org> on 2022/04/25 13:08:09 UTC

[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1845: fix hugegraph-api code checkstyle

javeme commented on code in PR #1845:
URL: https://github.com/apache/incubator-hugegraph/pull/1845#discussion_r857601135


##########
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java:
##########
@@ -60,17 +61,20 @@
 import com.baidu.hugegraph.variables.HugeVariables;
 import com.google.common.collect.ImmutableSet;
 
+import org.slf4j.Logger;
 import sun.reflect.Reflection;
 
 public final class HugeFactoryAuthProxy {
 
+    private static final Logger LOG = Log.logger(HugeFactoryAuthProxy.class);
+
     public static final String GRAPH_FACTORY =
-           "gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy";
+            "gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy";
 
     private static final Set<String> PROTECT_METHODS = ImmutableSet.of(
-                                                       "instance");
+            "instance");

Review Comment:
   align with ImmutableSet



##########
hugegraph-api/src/main/java/com/baidu/hugegraph/api/graph/BatchAPI.java:
##########
@@ -47,11 +47,11 @@ public class BatchAPI extends API {
     private static final Logger LOG = Log.logger(BatchAPI.class);
 
     // NOTE: VertexAPI and EdgeAPI should share a counter
-    private static final AtomicInteger batchWriteThreads = new AtomicInteger(0);
+    private static final AtomicInteger BATCH_WRITE_THREADS = new AtomicInteger(0);
 
     static {
         MetricsUtil.registerGauge(RestServer.class, "batch-write-threads",
-                                  () -> batchWriteThreads.intValue());
+                BATCH_WRITE_THREADS::intValue);

Review Comment:
   align with RestServer



##########
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java:
##########
@@ -95,7 +99,7 @@ private String inputPassword() {
             if (!password.isEmpty()) {
                 return password;
             }
-            System.out.println(notEmptyPrompt);
+            LOG.info(notEmptyPrompt);

Review Comment:
   yes we need System.out sometimes like when using the console



##########
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java:
##########
@@ -254,7 +248,7 @@ public static class UserJson {
         }
     }
 
-    public static class RolePerm {
+    class RolePerm {

Review Comment:
   prefer to keep `public static class`



##########
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java:
##########
@@ -210,16 +210,12 @@ public Collection<PropertyKey> propertyKeys() {
 
     @Override
     public PropertyKey propertyKey(String key) {
-        return verifySchemaPermission(HugePermission.READ, () -> {
-            return this.hugegraph.propertyKey(key);
-        });
+        return verifySchemaPermission(HugePermission.READ, () -> this.hugegraph.propertyKey(key));

Review Comment:
   prefer to keep origin style for debug and readability



##########
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java:
##########
@@ -394,7 +388,7 @@ public static boolean match(Object role, RolePermission grant,
         }
     }
 
-    public static class RequiredPerm {
+    class RequiredPerm {

Review Comment:
   prefer to keep `public static class`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org