Combat Items: SonarCloud Sprint 2 - UQdeco2800/2022-studio-2 GitHub Wiki

Sonar Cloud Errors

For sprint 2, we had more bugs in our code than the last sprint, however we had less code smells. Similar to the previous sprint we had some unused imports and variables which was removed, however there is still some package naming and accessor modifier code smells that are highlighted and will potentially need changing.

Solutions Fixed

Minor Issues

Some of the various minor code smells issues which were found and resolved included:

  • unused imports in our classes
  • unused global variables
  • changed variables from public to protected where required

Major Issues

In the additional code we found a few major bugs in the code concerning naming of our functions in the PlayerTouchAttackComponent. This is because the class is a subclass of TouchAttackComponent and rewrites methods within that class. While we initially thought @Override would resolve this, the naming still posed an issue.

Therefore we needed to change the names from the following:

  • onCollisionStart to playerCollidesEnemyStart,
  • onCollisionEnd to playerCollidesEnemyEnd, and
  • applyDamage to applyDamageToTarget
Screen Shot 2022-09-12 at 9 26 09 am Screen Shot 2022-09-12 at 9 30 06 am

This was the only bug found in the code we implemented into the game.

We did have another major code smells issue which was resolved. This was a an if/else loop which we added in the dispose() method, which had an empty if {} block of code and the implementation was in the else {} block. This was easily resolved by negating the if statement.

Screen Shot 2022-09-12 at 9 26 09 am

Which subsequently changed to:

if (!(component instanceOf AnimationRenderComponent) {
     dispose()
}

To Be Reviewed

Sonar Cloud detected some major code smells concerns regarding commented code. This is not something we want to remove until the next sprint as we still require the comments for future iterations and improvement. Another major code smells issue we should also review is specifically in the WeaponsFactory class. This task includes adding a private constructor to the class.

Some minor code smells are yet to be resolved including:

  • the packaging naming format
  • access modifiers for some variables (including changing to static final and protected)

However, changing these will have an impact on various other areas within the code for sprint 2.

Back to Combat Items Contents Page

Author:

  • Madi Feddema
  • GitHub: @madifeddema
  • Discord: madi-feddema#3384
  • Slack: Madi Feddema
⚠️ **GitHub.com Fallback** ⚠️