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

[Refactor] Preventing Unnecessary Object Creation and Using Utility Methods #1818

Merged
merged 21 commits into from
Apr 23, 2024

Conversation

dukbong
Copy link
Contributor

@dukbong dukbong commented Apr 23, 2024

What's changed?

  • Improved readability by preventing unnecessary object creation and utilizing utility methods.
  • Translated from Chinese to English.
    • The translation work is not yet complete.

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@zqr10159
Copy link
Member

Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/nginx/NginxCollectImpl.java:56:8: Unused import - org.springframework.util.ObjectUtils. [UnusedImports]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/nginx/NginxCollectImpl.java:56:8: Unused import: org.springframework.util.ObjectUtils. [UnusedImports]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java:44:1: Extra separation in import group before 'com.fasterxml.jackson.core.format.DataFormatDetector' [ImportOrder]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java:44:1: Import com.fasterxml.jackson.core.format.DataFormatDetector appears after other imports that it should precede [ImportOrder]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java:44:8: Unused import - com.fasterxml.jackson.core.format.DataFormatDetector. [UnusedImports]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java:44:8: Unused import: com.fasterxml.jackson.core.format.DataFormatDetector. [UnusedImports]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/dns/DnsCollectImpl.java:28:1: Extra separation in import group before 'org.apache.commons.collections4.CollectionUtils' [ImportOrder]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/dns/DnsCollectImpl.java:50:1: Extra separation in import group before 'com.google.common.collect.Lists' [ImportOrder]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/dns/DnsCollectImpl.java:50:1: Import com.google.common.collect.Lists appears after other imports that it should precede [ImportOrder]
Error: /home/runner/work/hertzbeat/hertzbeat/collector/src/main/java/org/apache/hertzbeat/collector/collect/dns/DnsCollectImpl.java:53:1: Extra separation in import group before 'lombok.AllArgsConstructor' [ImportOrder]

zqr10159
zqr10159 previously approved these changes Apr 23, 2024
@zqr10159
Copy link
Member

Still something wrong.

@dukbong
Copy link
Contributor Author

dukbong commented Apr 23, 2024

Still something wrong.

OMG........... sorry 😢
I'll fix it as soon as possible.....................

@zqr10159
Copy link
Member

Still something wrong.

OMG........... sorry 😢

I'll fix it as soon as possible.....................

Don't worry about it.

@zqr10159
Copy link
Member

@dukbong Hi, I checked the new checkstyle file and found that the import now needs to be sorted alphabetically by package name, I just tested it locally and it worked, but I can't push it to your repository, I hope this helps!

@zqr10159
Copy link
Member

image
You can run it locally.

@dukbong
Copy link
Contributor Author

dukbong commented Apr 23, 2024

@zqr10159 Thanks a lot for the help, but I'm currently working without my laptop, so I can't really apply your suggestions properly. 😭😭😭
If my commits end up causing issues with the open-source management, please let me know!
I don't want to break the code base!!!!!!
If that's the case, I'll sit tight until I get home and fix it properly following your advice! 🏃

@zqr10159
Copy link
Member

@zqr10159 Thanks a lot for the help, but I'm currently working without my laptop, so I can't really apply your suggestions properly. 😭😭😭 If my commits end up causing issues with the open-source management, please let me know! I don't want to break the code base!!!!!! If that's the case, I'll sit tight until I get home and fix it properly following your advice! 🏃

That's fine. Submit it at your convenience.

@crossoverJie
Copy link
Member

crossoverJie commented Apr 23, 2024

@dukbong

Refer to this link to install the plugin in IDEA to fix checkstyle problems more conveniently.

image


You can also run maven's checkstyle plugin directly to check.

image

@zqr10159 zqr10159 merged commit aa4d28b into apache:master Apr 23, 2024
3 checks passed
@dukbong dukbong deleted the refactor branch April 23, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants