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/21 10:53:29 UTC

[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1838: fix hugegraph-example/Example checkstyle issue

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


##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -268,19 +270,19 @@ public static void testQuery(final HugeGraph graph) {
         GraphTraversal<Vertex, Vertex> vertices = graph.traversal().V();
         int size = vertices.toList().size();
         assert size == 12;
-        System.out.println(">>>> query all vertices: size=" + size);
+        LOG.info(">>>> query all vertices: size {}", size);
 
         // query by label
         vertices = graph.traversal().V().hasLabel("person");
         size = vertices.toList().size();
         assert size == 5;
-        System.out.println(">>>> query all persons: size=" + size);
+        LOG.info(">>>> query all persons: size {}", size);
 
         // query vertex by primary-values
         vertices = graph.traversal().V().hasLabel("author").has("id", 1);
         List<Vertex> vertexList = vertices.toList();
         assert vertexList.size() == 1;
-        System.out.println(">>>> query vertices by primary-values: " +
+        LOG.info(">>>> query vertices by primary-values: {}",

Review Comment:
   please update alignment of the next line



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -382,39 +382,39 @@ public static void testQuery(final HugeGraph graph) {
         vertices = graph.traversal().V().hasLabel("book");
         size = vertices.toList().size();
         assert size == 5;
-        LOG.info(">>>> query all books: size=" + size);
+        LOG.info(">>>> query all books: size {}", size);
 
         // query by vertex label and key-name
         vertices = graph.traversal().V().hasLabel("person").has("age");
         size = vertices.toList().size();
         assert size == 5;
-        LOG.info(">>>> query all persons with age: size=" + size);
+        LOG.info(">>>> query all persons with age: size {}", size);
 
         // query by vertex props
         vertices = graph.traversal().V().hasLabel("person")
                         .has("city", "Taipei");
         vertexList = vertices.toList();
         assert vertexList.size() == 1;
-        LOG.info(">>>> query all persons in Taipei: " + vertexList);
+        LOG.info(">>>> query all persons in Taipei: {}", vertexList);
 
         vertices = graph.traversal().V().hasLabel("person").has("age", 19);
         vertexList = vertices.toList();
         assert vertexList.size() == 1;
-        LOG.info(">>>> query all persons age==19: " + vertexList);
+        LOG.info(">>>> query all persons age==19: {}", vertexList);
 
         vertices = graph.traversal().V().hasLabel("person")
                         .has("age", P.lt(19));
         vertexList = vertices.toList();
         assert vertexList.size() == 1;
         assert vertexList.get(0).property("age").value().equals(3);
-        LOG.info(">>>> query all persons age<19: " + vertexList);
+        LOG.info(">>>> query all persons age<19: {}", vertexList);
 
         String addr = "Bay Area";
         vertices = graph.traversal().V().hasLabel("author")
                         .has("lived", Text.contains(addr));
         vertexList = vertices.toList();
         assert vertexList.size() == 1;
-        LOG.info(String.format(">>>> query all authors lived %s: %s",
+        LOG.info(String.format(">>>> query all authors lived {}: {}",

Review Comment:
   need to remove "String.format(" here



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -368,10 +370,10 @@ public static void testQuery(final HugeGraph graph) {
             q.key(HugeKeys.PROPERTIES, contribution.id());
             Iterator<Edge> edges3 = graph.edges(q);
             assert edges3.hasNext();
-            System.out.println(">>>> queryEdges(contribution): " +
+            LOG.info(">>>> queryEdges(contribution): {}",

Review Comment:
   ditto



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example2.java:
##########
@@ -58,41 +58,41 @@ public static void traversal(final HugeGraph graph) {
         GraphTraversalSource g = graph.traversal();
 
         GraphTraversal<Vertex, Vertex> vertices = g.V();
-        System.out.println(">>>> query all vertices: size=" +
+        LOG.info(">>>> query all vertices: size=" +
                            vertices.toList().size());
 
         List<Edge> edges = g.E().toList();
-        System.out.println(">>>> query all edges: size=" +
+        LOG.info(">>>> query all edges: size=" +
                            edges.size());
 
         List<Object> names = g.V().inE("knows").limit(2)
                               .outV().values("name").toList();
-        System.out.println(">>>> query vertex(with props) of edges: " + names);
+        LOG.info(">>>> query vertex(with props) of edges: " + names);

Review Comment:
   can we also use "{}" style?



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example2.java:
##########
@@ -58,41 +58,41 @@ public static void traversal(final HugeGraph graph) {
         GraphTraversalSource g = graph.traversal();
 
         GraphTraversal<Vertex, Vertex> vertices = g.V();
-        System.out.println(">>>> query all vertices: size=" +
+        LOG.info(">>>> query all vertices: size=" +

Review Comment:
   can we also use "... size={}" style?



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -368,10 +370,10 @@ public static void testQuery(final HugeGraph graph) {
             q.key(HugeKeys.PROPERTIES, contribution.id());
             Iterator<Edge> edges3 = graph.edges(q);
             assert edges3.hasNext();
-            System.out.println(">>>> queryEdges(contribution): " +
+            LOG.info(">>>> queryEdges(contribution): {}",
                                edges3.hasNext());
             while (edges3.hasNext()) {
-                System.out.println(">>>> queryEdges(contribution): " +
+                LOG.info(">>>> queryEdges(contribution): {}",

Review Comment:
   ditto



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -355,10 +357,10 @@ public static void testQuery(final HugeGraph graph) {
 
         Iterator<Edge> edges2 = graph.edges(q);
         assert edges2.hasNext();
-        System.out.println(">>>> queryEdges(id-condition): " +
+        LOG.info(">>>> queryEdges(id-condition): {}",
                            edges2.hasNext());
         while (edges2.hasNext()) {
-            System.out.println(">>>> queryEdges(id-condition): " +
+            LOG.info(">>>> queryEdges(id-condition): {}",

Review Comment:
   ditto



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example2.java:
##########
@@ -58,41 +58,41 @@ public static void traversal(final HugeGraph graph) {
         GraphTraversalSource g = graph.traversal();
 
         GraphTraversal<Vertex, Vertex> vertices = g.V();
-        System.out.println(">>>> query all vertices: size=" +
+        LOG.info(">>>> query all vertices: size=" +
                            vertices.toList().size());
 
         List<Edge> edges = g.E().toList();
-        System.out.println(">>>> query all edges: size=" +
+        LOG.info(">>>> query all edges: size=" +

Review Comment:
   ditto



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -355,10 +357,10 @@ public static void testQuery(final HugeGraph graph) {
 
         Iterator<Edge> edges2 = graph.edges(q);
         assert edges2.hasNext();
-        System.out.println(">>>> queryEdges(id-condition): " +
+        LOG.info(">>>> queryEdges(id-condition): {}",

Review Comment:
   ditto



##########
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java:
##########
@@ -291,19 +293,19 @@ public static void testQuery(final HugeGraph graph) {
         GraphTraversal<Vertex, Edge> edgesOfVertex = vertices.outE("created");
         List<Edge> edgeList = edgesOfVertex.toList();
         assert edgeList.size() == 1;
-        System.out.println(">>>> query edges of vertex: " + edgeList);
+        LOG.info(">>>> query edges of vertex: {}", edgeList);
 
         vertices = graph.traversal().V(authorId);
         vertexList = vertices.out("created").toList();
         assert vertexList.size() == 1;
-        System.out.println(">>>> query vertices of vertex: " + vertexList);
+        LOG.info(">>>> query vertices of vertex: {}", vertexList);
 
         // query edge by sort-values
         vertices = graph.traversal().V(authorId);
         edgesOfVertex = vertices.outE("write").has("time", "2017-4-28");
         edgeList = edgesOfVertex.toList();
         assert edgeList.size() == 2;
-        System.out.println(">>>> query edges of vertex by sort-values: " +
+        LOG.info(">>>> query edges of vertex by sort-values: " +

Review Comment:
   ditto



-- 
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