Code smells and bugs - UQcsse3200/2023-studio-2 GitHub Wiki
Introduction
Addressing code smells and prompt bug fixing are required in order to provide the user an immersive and seamless experience with our game. Ignoring these can lead to disruptions like game crashes, excessive loading times, or unresolved in-game glitches. This wiki page details key areas that were addressed by the Player team.
Code Smells
By analysing our Studio's codebase on Sonarcloud, we noticed that we had many poor programming practices, which may make the code harder to maintain and extend over time. We addressed issues related to duplicated code, overly long methods, and many more issues that Sonarcloud identified:
Pull #485: Minor Code smells addressed:
- This commit addressed code smells in multiple classes created by various teams in the Studio.
- Although the purpose of this commit was primarily to address bug fixes, some code smells were inadvertently fixed during the process.
Pull #485: Large number of code smells addressed:
- This commit used SonarLint add on in IntelliJ to identify and eliminate code smells in a wide variety of classes.
Pull #485: Removed all code smells from game/components/player/.:
- This commit addressed all code smells within the player components.
- The intention of this commit was only to remove code smells
Pull #485: Numerous more commits addressing the removal of code smells:
- The following commit addressed some of the code smells present in game/components/companion/. Link to commit
- The following commit also addressed companion related code smells (including companion, companion weapons, companion configs and companion factories) Link to commit
- This commit targeted unused variable declarations, unused import statements and commented out code, in various files Link to commit
- The following commit continued to target the previously mentioned issues to reduce the number of code smells Link to commit
Pull #504: Minor code smells addressed:
- This commit addressed code smells in multiple classes created by various teams in the Studio.
Pull #555: Large amount of code smells resolved:
- This commit addressed code smells in a wide variety of classes, and were identified using the in-built SonarLint software in Intellij
Bug Fixes
To maintain code quality our team actively utilised Sonarcloud by linking it with an IntelliJ plugin; SonarLint, which allowed us to identify and address bugs and code smells more easily. To enable the user to have a seamless experience with the end game, our team identified and addressed many bugs:
Sonarcloud bug fixes
Pull #485: Sonarcloud Bug fixes:
- This commit addressed 20 Sonarcloud-identified bugs over 14 classes created by multiple teams within the Studio.
- One notable instance was when SonarCloud identified a recurring problem related to the frequent use of
new Random()
in our code. By repeatedly creating a new instance ofRandom
, we inadvertently introduced potential bugs due to the nature of random number generation. Specifically, Random was used in such a way that random number-generated seeds could be deterministic - which goes against the goal of generating a random number. - SonarCloud flagged other minor potential bugs which were addressed within the commit, such as no/poor type casting, switch statements with no exit, and null checks