[Feature] Add params check in createUser Function#11255
[Feature] Add params check in createUser Function#11255ly1ex wants to merge 13 commits intoapache:devfrom
Conversation
|
PTAL @zhongjiajie |
Codecov Report
@@ Coverage Diff @@
## dev #11255 +/- ##
============================================
- Coverage 39.59% 39.58% -0.01%
- Complexity 4689 4696 +7
============================================
Files 1014 1014
Lines 37918 37910 -8
Branches 4238 4235 -3
============================================
- Hits 15013 15007 -6
- Misses 21297 21301 +4
+ Partials 1608 1602 -6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Kudos, SonarCloud Quality Gate passed! |
| user.setUserName(userName); | ||
| } | ||
|
|
||
| if (StringUtils.isNotEmpty(userPassword)) { |
There was a problem hiding this comment.
Please merge if statement
There was a problem hiding this comment.
Please merge if statement
Sorry, I don't get your point...
There was a problem hiding this comment.
I mean please fix code smell
There was a problem hiding this comment.
I think OK, and merging can lead to unclear exception semantics.
sometimes, code smell needs to be judged based on the actual situation.
| user.setUserName(userName); | ||
| user.setUserPassword(EncryptionUtils.getMd5(userPassword)); | ||
| user.setEmail(email); | ||
| if (StringUtils.isNotEmpty(userName)) { |
There was a problem hiding this comment.
Hello @lyleshaw , thx for this improvement. Since you have added several parameters checks, could you please update related unit tests to get those checks covered? Thx
EricGao888
left a comment
There was a problem hiding this comment.
We need to update corresponding unit tests to get those new checks covered.
Got it. |
|
@lyleshaw Please add a issue to target this PR, BTW, can we add some separate function from |
|
Hi all, I have solved the above problems (including adding tests, abstracting to checkParams functions, etc.) |
@lyleshaw But I find out we have some failed CI step, could you please make a check? |
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Outdated
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Show resolved
Hide resolved
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
Show resolved
Hide resolved
...hinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java
Outdated
Show resolved
Hide resolved
|
@lyleshaw It seems dwonload jdbc driver error, could you try to rebase on upstream/dev, and force push to restart CI? |
d8b6a51 to
d63c5c4
Compare
I usually use git merge instead of git rebase, hoping things won't go wrong... |
|
Kudos, SonarCloud Quality Gate passed! |
|
|
||
| user.setPhone(phone); | ||
| user = new User(userName, userPassword, email, phone, tenantId, state); | ||
| if (state == 0 && user.getState() != state && loginUser.getId() == user.getId()) { |
Check failure
Code scanning / CodeQL
Reference equality test of boxed types
| String phone = "123456789"; | ||
| String phone = "17366666666"; | ||
| String tenantCode = "tenantCode"; | ||
| Integer userId = 1; |
Check notice
Code scanning / CodeQL
Unread local variable
- Add params check in createUser Function
…/api/service/impl/UsersServiceImpl.java Co-authored-by: Jiajie Zhong <zhongjiajie955@gmail.com>
…/api/service/impl/UsersServiceImpl.java Co-authored-by: Jiajie Zhong <zhongjiajie955@gmail.com>
…/api/service/impl/UsersServiceImpl.java Co-authored-by: Jiajie Zhong <zhongjiajie955@gmail.com>
…/api/service/impl/UsersServiceImpl.java Co-authored-by: Jiajie Zhong <zhongjiajie955@gmail.com>
7165802 to
fa22386
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs. |
|
This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request. |









Purpose of the pull request
close #11277
Brief change log
Verify this pull request
This pull request is already covered by existing tests, such as (please describe tests).