-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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: refactor the Result
Class
#7176
Conversation
f198304
to
ccb6634
Compare
ccb6634
to
0c848e9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #7176 +/- ##
=========================================
Coverage 51.58% 51.58%
- Complexity 6815 6818 +3
=========================================
Files 1169 1169
Lines 41505 41487 -18
Branches 4857 4858 +1
=========================================
- Hits 21409 21402 -7
+ Misses 18073 18061 -12
- Partials 2023 2024 +1
🚀 New features to boost your workflow:
|
|
||
public Result() { | ||
this(SUCCESS.code, SUCCESS.msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An implicit success isn't a great design choice because it doesn't align with the conventional understanding of a zero value. If it needs to represent success, it's better to make it clear in the method name rather than assigning it to a default constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch :)
Done in 3b4370f !
Result<String> res = createGroup(namespace, vGroup, clusterName, unitName); | ||
SingleResult<Void> res = createGroup(namespace, vGroup, clusterName, unitName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the refactorings I made was distinguishing between setting the message of Result as a String
and making the generic type of Result a String
—these are separate concerns.
I understand that there are many instances of this pattern in the code.
I plan to focus on refactoring this part as well.
I also saw the UT cases failed. To explain in more detail, I can see that
This test checks the isSuccess method of the
When checking the unit test, I can confirm that the values
@slievrly What do you think? PS. please assign below issue to me :) I'll do my best to implement this issue And I’m interested in your mission among Seata’s GSOC missions. 🙂 |
It was a little confusing. I can run your PR code locally and it will pass the unit test. Maybe it's not the code itself, and I'll try to pinpoint the cause.
I have already commented on this issue.
Are you talking about this GSoC project? https://cwiki.apache.org/confluence/display/COMDEV/GSoC+2025+Ideas+list#GSoC2025Ideaslist-GSoC2025-ApacheSeata(Incubating)EnhancingConnectionPoolManagementforApacheSeataAT/XATransactionModes |
Yes, I'm interested in this issue. |
GSoC project has to apply for conditions to open source mainly for beginner or student, specific refer to: https://developers.google.cn/open-source/gsoc/faq If you meet the requirements for registration, you are welcome to apply. In addition, the projects you see on this page are currently in idea status, and ASF needs to further approve which projects will eventually participate in GSoC. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Result
ClassResult
Class
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #7158
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews