Skip to content

Conversation

@ruanwenjun
Copy link
Member

@ruanwenjun ruanwenjun commented Nov 18, 2023

Purpose of the pull request

Use Result/Map<String, Object> as method result is not a good practice, this PR will refactor some service method.

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(or)

If your pull request contain incompatible change, you should also add it to docs/docs/en/guide/upgrede/incompatible.md

@ruanwenjun ruanwenjun marked this pull request as draft November 18, 2023 04:01
public Result getAlertPluginInstance(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
Map<String, Object> result = alertPluginInstanceService.queryAll();
return returnDataList(result);
public Result<List<AlertPluginInstanceVO>> getAlertPluginInstance(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {

Check notice

Code scanning / CodeQL

Useless parameter

The parameter 'loginUser' is never used.
* @return token string
*/
Map<String, Object> generateToken(User loginUser, int userId, String expireTime);
String generateToken(User loginUser, int userId, String expireTime);

Check notice

Code scanning / CodeQL

Useless parameter

The parameter 'loginUser' is never used.
putMsg(result, Status.CREATE_ALERT_GROUP_ERROR);
return alertGroup;
}
log.error("Create alert group error, groupName:{}", alertGroup.getGroupName());

Check failure

Code scanning / CodeQL

Log Injection

This log entry depends on a [user-provided value](1).
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch 2 times, most recently from 405fddf to 3c41548 Compare November 18, 2023 08:31
@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2023

Codecov Report

Attention: 167 lines in your changes are missing coverage. Please review.

Comparison is base (6aa6e11) 38.28% compared to head (8b3322d) 37.93%.

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

Files Patch % Lines
...uler/api/service/impl/DataAnalysisServiceImpl.java 50.00% 19 Missing and 1 partial ⚠️
...eduler/api/service/impl/AlertGroupServiceImpl.java 59.45% 14 Missing and 1 partial ⚠️
...duler/api/service/impl/EnvironmentServiceImpl.java 62.16% 12 Missing and 2 partials ⚠️
...i/service/impl/AlertPluginInstanceServiceImpl.java 48.00% 10 Missing and 3 partials ⚠️
...scheduler/api/service/impl/ProjectServiceImpl.java 13.33% 13 Missing ⚠️
...scheduler/api/controller/DataSourceController.java 23.07% 10 Missing ⚠️
...nscheduler/api/service/impl/DqRuleServiceImpl.java 23.07% 10 Missing ⚠️
...nscheduler/api/service/impl/TenantServiceImpl.java 41.17% 6 Missing and 4 partials ⚠️
...duler/api/service/impl/AccessTokenServiceImpl.java 55.55% 7 Missing and 1 partial ⚠️
...scheduler/api/service/impl/ClusterServiceImpl.java 87.75% 5 Missing and 1 partial ⚠️
... and 18 more
Additional details and impacted files
@@             Coverage Diff              @@
##                dev   #15181      +/-   ##
============================================
- Coverage     38.28%   37.93%   -0.36%     
+ Complexity     4701     4667      -34     
============================================
  Files          1285     1278       -7     
  Lines         45547    44872     -675     
  Branches       4957     4869      -88     
============================================
- Hits          17436    17020     -416     
+ Misses        26217    25997     -220     
+ Partials       1894     1855      -39     

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

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch from 3c41548 to 5514692 Compare November 18, 2023 08:49
@ruanwenjun ruanwenjun changed the title Remove API Result in Service Remove Result in Service Nov 18, 2023
@ruanwenjun ruanwenjun marked this pull request as ready for review November 18, 2023 08:50
@ruanwenjun ruanwenjun added refactor improvement make more easy to user or prompt friendly labels Nov 18, 2023
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch from 5514692 to 6e18a96 Compare November 18, 2023 09:07
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch 3 times, most recently from 31d95fe to 70beaa2 Compare November 18, 2023 14:29
@Radeity Radeity added the discussion discussion label Nov 18, 2023
@ruanwenjun ruanwenjun requested a review from Radeity November 19, 2023 02:24
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch 6 times, most recently from df34684 to ebcb7c0 Compare November 19, 2023 03:51
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch from ebcb7c0 to 3fe9d76 Compare November 19, 2023 05:30
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch from 3fe9d76 to 4bb40e6 Compare November 19, 2023 05:32
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch from 4bb40e6 to deca8b0 Compare November 19, 2023 07:15
SbloodyS
SbloodyS previously approved these changes Nov 20, 2023
Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

LGTM. This is really a big change. Thanks 👍🏻

@ruanwenjun
Copy link
Member Author

Resolve the conflicts.

@ruanwenjun ruanwenjun requested a review from SbloodyS November 20, 2023 05:25
@ruanwenjun ruanwenjun force-pushed the dev_wenjun_refactorService branch from 07a0b0a to 9ccc112 Compare November 20, 2023 08:32
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 3 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 55 Code Smells

70.2% 70.2% Coverage
0.3% 0.3% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Contributor

@caishunfeng caishunfeng left a comment

Choose a reason for hiding this comment

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

LGTM overall

@ruanwenjun ruanwenjun merged commit 9be81be into apache:dev Nov 20, 2023
@ruanwenjun ruanwenjun deleted the dev_wenjun_refactorService branch November 20, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend improvement make more easy to user or prompt friendly ready-to-merge refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants