swsnu / swppfall2021

Learning Software Engineering By Building Web Services
28 stars 19 forks source link

Question about Sonarcloud detecting wrong code smells #154

Open davekjh opened 2 years ago

davekjh commented 2 years ago

After writing test codes for backend, Sonarcloud detected code smells, claiming that some variables are never used. However, those variables are actually used, not by the variable name themselves, but by the data they contain. The Sonarcloud error page is as follows: https://sonarcloud.io/project/issues?id=swsnu_swpp2021-team14&pullRequest=44&resolved=false&types=CODE_SMELL For example, the user3 variable isn't used by the user3 itself, but the object it initiated is used in the test_notfound test, as the user3 account is a sample account to test error situations on which no additional data exists in the account. All 3 other variables which Sonarcloud claims is not used has its purposes, and removing them results in error, or lower coverage. What can I do to solve this issue?

kdh0102 commented 2 years ago

Since you are writing test codes, there is no need to resolve all the code smells suggested by SonarCloud. I have checked the issues and I believe changing the testing codes to follow the suggested way by SonarCloud is not productive and necessary. You can manually resolve the issues or ignore testing codes from the analysis.