You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "salmansharifov (via GitHub)" <gi...@apache.org> on 2023/05/16 21:54:06 UTC

[GitHub] [shardingsphere] salmansharifov opened a new pull request, #25717: small fixes added for sonar

salmansharifov opened a new pull request, #25717:
URL: https://github.com/apache/shardingsphere/pull/25717

   Fixes #ISSUSE_ID.
   
   Changes proposed in this pull request:
     -
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25717: small fixes added for sonar

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on code in PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717#discussion_r1199876060


##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java:
##########
@@ -106,11 +106,11 @@ public Optional<DataConsistencyCalculatedResult> calculateChunk(final DataConsis
                 ShardingSpherePreconditions.checkState(!isCanceling(), () -> new PipelineTableDataConsistencyCheckLoadingFailedException(param.getSchemaName(), param.getLogicTableName()));
                 ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
                 int columnCount = resultSetMetaData.getColumnCount();
-                Collection<Object> record = new LinkedList<>();
+                Collection<Object> columnRecord = new LinkedList<>();

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz merged pull request #25717: small fixes added for sonar

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz merged PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25717: small fixes added for sonar

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on code in PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717#discussion_r1198494485


##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java:
##########
@@ -106,11 +106,11 @@ public Optional<DataConsistencyCalculatedResult> calculateChunk(final DataConsis
                 ShardingSpherePreconditions.checkState(!isCanceling(), () -> new PipelineTableDataConsistencyCheckLoadingFailedException(param.getSchemaName(), param.getLogicTableName()));
                 ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
                 int columnCount = resultSetMetaData.getColumnCount();
-                Collection<Object> record = new LinkedList<>();
+                Collection<Object> columnRecord = new LinkedList<>();

Review Comment:
   Is there sonar issue of `record`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] salmansharifov commented on a diff in pull request #25717: small fixes added for sonar

Posted by "salmansharifov (via GitHub)" <gi...@apache.org>.
salmansharifov commented on code in PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717#discussion_r1198351983


##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/AbstractStreamingDataConsistencyCalculateAlgorithm.java:
##########
@@ -78,13 +78,13 @@ public boolean hasNext() {
         @Override
         public DataConsistencyCalculatedResult next() {
             calculateIfNecessary();
-            Optional<DataConsistencyCalculatedResult> nextResult = this.nextResult.get();
+            Optional<DataConsistencyCalculatedResult> nextCalculatedResult = this.nextResult.get();
             this.nextResult.set(null);
-            return nextResult.orElseThrow(NoSuchElementException::new);
+            return nextCalculatedResult.orElseThrow(NoSuchElementException::new);
         }
         
         private void calculateIfNecessary() {
-            if (null == nextResult.get()) {
+            if (!nextResult.get().isPresent()) {
                 nextResult.set(calculateChunk(param));
             }

Review Comment:
   change reverted



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] salmansharifov commented on a diff in pull request #25717: small fixes added for sonar

Posted by "salmansharifov (via GitHub)" <gi...@apache.org>.
salmansharifov commented on code in PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717#discussion_r1199419055


##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java:
##########
@@ -106,11 +106,11 @@ public Optional<DataConsistencyCalculatedResult> calculateChunk(final DataConsis
                 ShardingSpherePreconditions.checkState(!isCanceling(), () -> new PipelineTableDataConsistencyCheckLoadingFailedException(param.getSchemaName(), param.getLogicTableName()));
                 ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
                 int columnCount = resultSetMetaData.getColumnCount();
-                Collection<Object> record = new LinkedList<>();
+                Collection<Object> columnRecord = new LinkedList<>();

Review Comment:
   Yes: https://sonarcloud.io/project/issues?fileUuids=AYePD8WPmlEb3_Pqvjc0&resolved=false&id=apache_shardingsphere&open=AYePD_pgmlEb3_PqvlXe



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25717: small fixes added for sonar

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on code in PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717#discussion_r1197729758


##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/AbstractStreamingDataConsistencyCalculateAlgorithm.java:
##########
@@ -78,13 +78,13 @@ public boolean hasNext() {
         @Override
         public DataConsistencyCalculatedResult next() {
             calculateIfNecessary();
-            Optional<DataConsistencyCalculatedResult> nextResult = this.nextResult.get();
+            Optional<DataConsistencyCalculatedResult> nextCalculatedResult = this.nextResult.get();
             this.nextResult.set(null);
-            return nextResult.orElseThrow(NoSuchElementException::new);
+            return nextCalculatedResult.orElseThrow(NoSuchElementException::new);
         }
         
         private void calculateIfNecessary() {
-            if (null == nextResult.get()) {
+            if (!nextResult.get().isPresent()) {
                 nextResult.set(calculateChunk(param));
             }

Review Comment:
   There's `this.nextResult.set(null);`, so `nextResult.get()` might be null.
   
   `if (null == nextResult.get())` looks strange, since `calculateChunk` return `Optional`, there's no better way for now.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on pull request #25717: small fixes added for sonar

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on PR #25717:
URL: https://github.com/apache/shardingsphere/pull/25717#issuecomment-1556442506

   @salmansharifov Thanks for your contribution


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org