nahsra / WebGoat_12_23

Other
0 stars 2 forks source link

(Sonar) Fixed finding: "Multiple variables should not be declared on the same line" #36

Closed pixeebot[bot] closed 1 month ago

pixeebot[bot] commented 1 month ago

Remediation

This change fixes "Multiple variables should not be declared on the same line" (id = java:S1659) identified by Sonar.

Details

This change splits variable assignments onto their own lines. Many sources believe it is easier to review code where the variables are separate statements on their own individual line.

Our changes look something like this:

-   int i = 0, limit = 10;
+   int i = 0;
+   int limit = 10;

    while (i < limit){
More reading * [https://rules.sonarsource.com/java/RSPEC-1659/](https://rules.sonarsource.com/java/RSPEC-1659/) * [https://wiki.sei.cmu.edu/confluence/display/java/DCL52-J.+Do+not+declare+more+than+one+variable+per+declaration](https://wiki.sei.cmu.edu/confluence/display/java/DCL52-J.+Do+not+declare+more+than+one+variable+per+declaration)

I have additional improvements ready for this repo! If you want to see them, leave the comment:

@pixeebot next

... and I will open a new PR right away!

šŸ§ššŸ¤– Powered by Pixeebot

Feedback | Community | Docs | Codemod ID: sonar:java/declare-variable-on-separate-line-s1659

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud