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

[ISSUE #3855] General code simplification #3856

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

pandaapo
Copy link
Member

@pandaapo pandaapo commented May 1, 2023

Fixes #3855.

Motivation

see "Enhancement Request" in issue related.

Modifications

see "Describe the solution you'd like" in issue related.

Documentation

  • Does this pull request introduce a new feature? no

Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

Hi @pandaapo IMO, If you overuse the static import feature, it makes the program unreadable and unmaintainable.

@pandaapo
Copy link
Member Author

pandaapo commented May 3, 2023

Hi @pandaapo IMO, If you overuse the static import feature, it makes the program unreadable and unmaintainable.

Thanks for your review. It is indeed controversial about import static's advantage and disadvantage.

In consideration of "use it when you require frequent access to static members from one or two classes" in Guidance, should I revoke all of them? Or revoke some except for the follows(>= 3 times access to static members of a class)?

import static io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;

import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.CONSUMERGROUP;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.ENV;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.IDC;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.IP;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.PASSWD;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.PID;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.PRODUCERGROUP;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.SYS;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.ClientInstanceKey.USERNAME;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.CloudEventsKey.ID;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.CloudEventsKey.SOURCE;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.CloudEventsKey.SUBJECT;
import static org.apache.eventmesh.common.protocol.http.common.ProtocolKey.CloudEventsKey.TYPE;

import static io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;

In addition, I think it will be better if community can specify when to use import static as part of code conduct.

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Merging #3856 (8abfaed) into master (3f49cd4) will decrease coverage by 3.00%.
The diff coverage is 30.30%.

❗ Current head 8abfaed differs from pull request most recent head e1ca83c. Consider uploading reports for the commit e1ca83c to get more accurate results

@@             Coverage Diff              @@
##             master    #3856      +/-   ##
============================================
- Coverage     16.91%   13.92%   -3.00%     
+ Complexity     1410     1291     -119     
============================================
  Files           588      570      -18     
  Lines         25743    28806    +3063     
  Branches       2376     2806     +430     
============================================
- Hits           4355     4011     -344     
- Misses        20954    24422    +3468     
+ Partials        434      373      -61     
Impacted Files Coverage Δ
...org/apache/eventmesh/common/ThreadPoolFactory.java 16.66% <ø> (ø)
...mmon/protocol/grpc/common/BatchMessageWrapper.java 0.00% <0.00%> (ø)
...mon/protocol/grpc/common/SimpleMessageWrapper.java 0.00% <0.00%> (ø)
...entmesh/common/protocol/http/HttpEventWrapper.java 0.00% <0.00%> (ø)
.../apache/eventmesh/common/protocol/tcp/Package.java 75.00% <60.00%> (+1.66%) ⬆️
...he/eventmesh/common/protocol/http/HttpCommand.java 66.25% <84.21%> (+7.62%) ⬆️
...pache/eventmesh/common/EventMeshThreadFactory.java 61.11% <100.00%> (-8.46%) ⬇️

... and 231 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@xwm1992
Copy link
Contributor

xwm1992 commented May 9, 2023

@pandaapo please fix the conflicts.

@pandaapo
Copy link
Member Author

pandaapo commented May 9, 2023

@pandaapo please fix the conflicts.

OK.

But 1 question:
What do you think about this review that I was waiting for replying? Should I revoke all of import static? Or revoke a portion except for accessing 3 or more static members of a type? CC @mxsm

@xwm1992
Copy link
Contributor

xwm1992 commented May 15, 2023

revoke a portion except for accessing 3 or more static members of a type

IMO, revoke a portion except for accessing 3 or more static members of a type is better. @pandaapo

Copy link
Contributor

It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback.

If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh.

@github-actions github-actions bot added the Stale label Apr 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 30.30303% with 46 lines in your changes missing coverage. Please review.

Project coverage is 13.92%. Comparing base (3f49cd4) to head (8abfaed).
Report is 506 commits behind head on master.

Current head 8abfaed differs from pull request most recent head e1ca83c

Please upload reports for the commit e1ca83c to get more accurate results.

Files Patch % Lines
...entmesh/common/protocol/http/HttpEventWrapper.java 0.00% 39 Missing ⚠️
...he/eventmesh/common/protocol/http/HttpCommand.java 84.21% 2 Missing and 1 partial ⚠️
.../apache/eventmesh/common/protocol/tcp/Package.java 60.00% 2 Missing ⚠️
...mmon/protocol/grpc/common/BatchMessageWrapper.java 0.00% 1 Missing ⚠️
...mon/protocol/grpc/common/SimpleMessageWrapper.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3856      +/-   ##
============================================
- Coverage     16.91%   13.92%   -3.00%     
+ Complexity     1410     1291     -119     
============================================
  Files           588      570      -18     
  Lines         25743    28806    +3063     
  Branches       2376     2806     +430     
============================================
- Hits           4355     4011     -344     
- Misses        20954    24422    +3468     
+ Partials        434      373      -61     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Pil0tXia Pil0tXia changed the title [ISSUE #3855]General code simplification [ISSUE #3855] General code simplification Apr 23, 2024
@Pil0tXia
Copy link
Member

I agree with "use it when you require frequent access to static members from one or two classes". The class name of a static import member is helpful to indicate the use of the member.

Please resolve conflicts~

@github-actions github-actions bot removed the Stale label Apr 23, 2024
Copy link
Contributor

It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback.

If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh.

@github-actions github-actions bot added Stale and removed Stale labels Jun 22, 2024
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.

[Enhancement] General code simplification
5 participants