Skip to content
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

fix hugegraph-api code checkstyle #1845

Closed
wants to merge 3 commits into from
Closed

Conversation

Fizell
Copy link
Contributor

@Fizell Fizell commented Apr 24, 2022

rt

@codecov
Copy link

codecov bot commented Apr 24, 2022

Codecov Report

Merging #1845 (f28f9bd) into master (9a8259e) will decrease coverage by 0.01%.
The diff coverage is 76.92%.

@@             Coverage Diff              @@
##             master    #1845      +/-   ##
============================================
- Coverage     66.93%   66.92%   -0.02%     
- Complexity      444      731     +287     
============================================
  Files           446      446              
  Lines         37966    37948      -18     
  Branches       5410     5410              
============================================
- Hits          25413    25397      -16     
+ Misses         9957     9956       -1     
+ Partials       2596     2595       -1     
Impacted Files Coverage Δ
.../java/com/baidu/hugegraph/api/auth/ProjectAPI.java 82.05% <ø> (ø)
...va/com/baidu/hugegraph/api/profile/ProfileAPI.java 0.00% <0.00%> (ø)
...aidu/hugegraph/auth/WsAndHttpBasicAuthHandler.java 58.62% <0.00%> (+1.47%) ⬆️
...a/com/baidu/hugegraph/license/LicenseVerifier.java 0.00% <0.00%> (ø)
...om/baidu/hugegraph/auth/StandardAuthenticator.java 44.73% <50.00%> (+0.73%) ⬆️
.../com/baidu/hugegraph/server/ApplicationConfig.java 93.02% <50.00%> (-0.46%) ⬇️
...com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java 57.92% <62.50%> (+0.20%) ⬆️
...va/com/baidu/hugegraph/auth/HugeAuthenticator.java 40.10% <66.66%> (-0.11%) ⬇️
.../java/com/baidu/hugegraph/metrics/MetricsUtil.java 62.50% <66.66%> (ø)
...api/src/main/java/com/baidu/hugegraph/api/API.java 74.11% <70.00%> (-0.89%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a8259e...f28f9bd. Read the comment docs.

Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution~ 👍🏻

seems a lot of the code style conflict, maybe we could use a unified rule before change it

@@ -155,7 +151,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
private void sendError(ChannelHandlerContext ctx, Object msg) {
// Close the connection as soon as the error message is sent.
ctx.writeAndFlush(new DefaultFullHttpResponse(HTTP_1_1, UNAUTHORIZED))
.addListener(ChannelFutureListener.CLOSE);
.addListener(ChannelFutureListener.CLOSE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should keep the origin align?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the current style check specify that the code indented in multiples of 4,so we need to decide which style to use

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the current style check specify that the code indented in multiples of 4,so we need to decide which style to use

yep, we'll discuss this issue in the developer group, ensure the rule

Comment on lines -129 to +125
Charset.forName("UTF-8"));
StandardCharsets.UTF_8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use the hugegraph-style in the wiki (not java original style)

align the param with the highly priority

Comment on lines +41 to +46
import static io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaderNames.UPGRADE;
import static io.netty.handler.codec.http.HttpResponseStatus.UNAUTHORIZED;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_PASSWORD;
import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_USERNAME;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so as these import rules, u could refer the style file in root dir to improve them

Comment on lines -98 to +102
System.out.println(notEmptyPrompt);
LOG.info(notEmptyPrompt);
Copy link
Member

@imbajin imbajin Apr 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems it don't print in the log file (print on the console is right?) @javeme

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -1757,7 +1731,7 @@ public static class ContextThreadPoolExecutor extends ThreadPoolExecutor {
public ContextThreadPoolExecutor(int corePoolSize, int maxPoolSize,
ThreadFactory threadFactory) {
super(corePoolSize, maxPoolSize, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(), threadFactory);
new LinkedBlockingQueue<>(), threadFactory);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the origin align~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@imbajin
Copy link
Member

imbajin commented Apr 25, 2022

Open a new vote in #1848. we could discuss there.


static {
MetricsUtil.registerGauge(RestServer.class, "batch-write-threads",
() -> batchWriteThreads.intValue());
BATCH_WRITE_THREADS::intValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align with RestServer

@@ -254,7 +248,7 @@ public static class UserJson {
}
}

public static class RolePerm {
class RolePerm {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to keep public static class

@@ -394,7 +388,7 @@ public static boolean match(Object role, RolePermission grant,
}
}

public static class RequiredPerm {
class RequiredPerm {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to keep public static class


private static final Set<String> PROTECT_METHODS = ImmutableSet.of(
"instance");
"instance");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align with ImmutableSet

return verifySchemaPermission(HugePermission.READ, () -> {
return this.hugegraph.propertyKey(key);
});
return verifySchemaPermission(HugePermission.READ, () -> this.hugegraph.propertyKey(key));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to keep origin style for debug and readability

Comment on lines -98 to +102
System.out.println(notEmptyPrompt);
LOG.info(notEmptyPrompt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Fizell
Copy link
Contributor Author

Fizell commented Apr 25, 2022

seems that tends to keep the original align and keep original lambda style, so I submit a new PR to fix only some obvious style issues #1851, and this PR will be closed @javeme @imbajin

@Fizell Fizell closed this Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants