eventmesh icon indicating copy to clipboard operation
eventmesh copied to clipboard

[ISSUE #3855] General code simplification

Open pandaapo opened this issue 2 years ago • 11 comments

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

pandaapo avatar May 01 '23 17:05 pandaapo

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)? https://github.com/apache/eventmesh/blob/21f0bb9eba43220e5148f1d5add8ac12bc212861/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/http/HttpCommand.java#L22-L24 https://github.com/apache/eventmesh/blob/21f0bb9eba43220e5148f1d5add8ac12bc212861/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/http/HttpEventWrapper.java#L23-L35 https://github.com/apache/eventmesh/blob/21f0bb9eba43220e5148f1d5add8ac12bc212861/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/http/HttpEventWrapper.java#L38-L40

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

pandaapo avatar May 03 '23 19:05 pandaapo

Codecov Report

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

:exclamation: 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%) :arrow_up:
...he/eventmesh/common/protocol/http/HttpCommand.java 66.25% <84.21%> (+7.62%) :arrow_up:
...pache/eventmesh/common/EventMeshThreadFactory.java 61.11% <100.00%> (-8.46%) :arrow_down:

... and 231 files with indirect coverage changes

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

codecov[bot] avatar May 05 '23 07:05 codecov[bot]

@pandaapo please fix the conflicts.

xwm1992 avatar May 09 '23 02:05 xwm1992

@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

pandaapo avatar May 09 '23 08:05 pandaapo

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

xwm1992 avatar May 15 '23 09:05 xwm1992

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[bot] avatar Apr 22 '24 18:04 github-actions[bot]

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.

:exclamation: 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 :warning:
...he/eventmesh/common/protocol/http/HttpCommand.java 84.21% 2 Missing and 1 partial :warning:
.../apache/eventmesh/common/protocol/tcp/Package.java 60.00% 2 Missing :warning:
...mmon/protocol/grpc/common/BatchMessageWrapper.java 0.00% 1 Missing :warning:
...mon/protocol/grpc/common/SimpleMessageWrapper.java 0.00% 1 Missing :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 22 '24 18:04 codecov-commenter

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~

Pil0tXia avatar Apr 23 '24 07:04 Pil0tXia

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[bot] avatar Jun 22 '24 18:06 github-actions[bot]

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[bot] avatar Aug 22 '24 18:08 github-actions[bot]