Duplicated block of Code in Sonar for import statements in Java

We Are Going To Discuss About Duplicated block of Code in Sonar for import statements in Java. So lets Start this Java Article.

Duplicated block of Code in Sonar for import statements in Java

  1. Duplicated block of Code in Sonar for import statements in Java

    The Duplicate Blocks rule raises issues at the file level. So it's not trying to tell you that your import statement is duplicated, but that somewhere in the file is a duplicate block. If you'll scroll down, you should see a vertical yellow/orange bar in the left margin.

  2. Duplicated block of Code in Sonar for import statements in Java

    The Duplicate Blocks rule raises issues at the file level. So it's not trying to tell you that your import statement is duplicated, but that somewhere in the file is a duplicate block. If you'll scroll down, you should see a vertical yellow/orange bar in the left margin.

Solution 1

The Duplicate Blocks rule raises issues at the file level. So it’s not trying to tell you that your import statement is duplicated, but that somewhere in the file is a duplicate block. If you’ll scroll down, you should see a vertical yellow/orange bar in the left margin. It marks the duplicate block. Click on the bar to get details of where the block is duplicated.

EDIT In more recent versions the duplication marker is brown or gray.

Original Author G. Ann – SonarSource Team Of This Content

Solution 2

You have to look (scroll down) your code. There will be a duplication marker in brown/gray like this:

enter image description here

Original Author Carlos Cruz Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment