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

Reduced cognitive complexity of ProcessDefinitionServiceImpl class #15729

Open
wants to merge 20 commits into
base: dev
Choose a base branch
from

Conversation

akshitk20
Copy link

@akshitk20 akshitk20 commented Mar 16, 2024

Purpose of the pull request

For issue #15599
This PR reduces cognitive complexity of ProcessDefinitionServiceImpl in dolphin-scheduler-api.

below methods in this class are covered

  • importSqlProcessDefinition
  • doBatchOperateProcessDefinition

Verify this pull request

This pull request is code cleanup without any test coverage.

@SbloodyS SbloodyS added first time contributor First-time contributor improvement make more easy to user or prompt friendly 4.0.0 labels Mar 18, 2024
@SbloodyS SbloodyS added this to the 4.0.0-alpha milestone Mar 18, 2024
Copy link
Contributor

@rickchengx rickchengx left a comment

Choose a reason for hiding this comment

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

@akshitk20 please run 'mvn spotless:apply' to fix the code style

@codecov-commenter
Copy link

codecov-commenter commented Mar 23, 2024

Codecov Report

Attention: Patch coverage is 54.67626% with 63 lines in your changes are missing coverage. Please review.

Project coverage is 39.23%. Comparing base (08ac132) to head (f3e1621).

❗ Current head f3e1621 differs from pull request most recent head 39e8dd3. Consider uploading reports for the commit 39e8dd3 to get more accurate results

Files Patch % Lines
...api/service/impl/ProcessDefinitionServiceImpl.java 54.67% 49 Missing and 14 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev   #15729      +/-   ##
============================================
- Coverage     39.25%   39.23%   -0.02%     
- Complexity     4912     4916       +4     
============================================
  Files          1323     1323              
  Lines         45191    45210      +19     
  Branches       4812     4810       -2     
============================================
+ Hits          17738    17739       +1     
- Misses        25570    25587      +17     
- Partials       1883     1884       +1     

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

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.

private static final int thresholdSize = 1000000000; // 1 GB
private static final double thresholdRatio = 10;

private final Map<String, DataSource> dataSourceCache = new HashMap<>(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

These maps were originally local variables of method importSqlProcessDefinition, but they are now private variables of the class, which I think may cause problems

Copy link
Member

Choose a reason for hiding this comment

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

+1, this cannot work since ProcessDefinitionServiceImpl is singloten.

Copy link

sonarcloud bot commented Apr 12, 2024

Please retry analysis of this Pull-Request directly on SonarCloud

Copy link
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

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

I am -1 to this PR, this PR seems only move some code into single method, this cannot reduce complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0.0 backend don't merge first time contributor First-time contributor improvement make more easy to user or prompt friendly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants