Showing 39 of 88 total issues
Method generateButtonsOnMap
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
private void generateButtonsOnMap() {
List<Button> mapButtons = new ArrayList<>();
View.OnClickListener listener = view -> {
Optional<Button> button = mapButtons.stream().filter(e -> view.getTransitionName().equals(e.getTransitionName())).findFirst();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File Game.java
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.dhbw.game;
import android.app.AlertDialog;
import android.content.Intent;
import android.view.View;
Method create
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void create(GameActivity gameActivity) {
Wave wave1 = new Wave(waveSpeed);
wave1.addWaveCompositions(w1_Plane);
wave1.generate(gameActivity);
Game
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
public class Game {
private GameActivity gameActivity;
private MapStructure mapStructure;
Method calculatePath
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public static int calculatePath(float xCoord, float yCoord) {
int pathImage = DRAWABLE_PATH_HORIZONTAL;
int pathNumber = getPathNumber(xCoord, yCoord);
if (pathNumber != 0 && pathNumber != 20) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void create(GameActivity gameActivity) {
Wave wave1 = new Wave(waveSpeed);
wave1.addWaveCompositions(w1_Tank);
ATower
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
public abstract class ATower extends ATimerUsage {
private UUID id;
private TowerType towerType;
private int level;
AEnemy
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
public abstract class AEnemy {
private String label;
private UUID uuid;
private boolean isPaused = false;
private int value;
Method create
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void create(GameActivity gameActivity) {
Wave wave1 = new Wave(waveSpeed);
wave1.addWaveCompositions(w1_Car);
Method generateButtonsOnMap
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void generateButtonsOnMap() {
List<Button> mapButtons = new ArrayList<>();
View.OnClickListener listener = view -> {
Optional<Button> button = mapButtons.stream().filter(e -> view.getTransitionName().equals(e.getTransitionName())).findFirst();
MatchField
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
public class MatchField {
private final GameActivity gameActivity;
private List<AEnemy> enemies;
private List<ATower> towers;
GameActivity
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
public class GameActivity extends AppCompatActivity implements IStatusBar {
private static final boolean AUTO_HIDE = true;
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
private static final int UI_ANIMATION_DELAY = 300;
File MatchField.java
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.dhbw.map.matchfield;
import android.view.View;
import android.widget.ImageView;
Method createPath
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private FieldDescription[][] createPath() {
// There is only one fixed Path with the Coordinates generated as following
FieldDescription[][] fieldDescription = new FieldDescription[AMOUNT_COLUMNS][AMOUNT_ROWS];
boolean spawn = true;
for (int i = 0; i < 11; i++) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File HardMatch.java
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.dhbw.game.match;
import de.dhbw.activities.GameActivity;
import de.dhbw.game.Difficulty;
import de.dhbw.game.EnemyType;
Method calculatePath
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static int calculatePath(float xCoord, float yCoord) {
int pathImage = DRAWABLE_PATH_HORIZONTAL;
int pathNumber = getPathNumber(xCoord, yCoord);
if (pathNumber != 0 && pathNumber != 20) {
Method startMusicPlayer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void startMusicPlayer(Activity activity){
this.isStarted=true;
if(timer!=null){
timer.cancel();
timerTask.cancel();
Method move
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean move(MapStructure map) {
if (actualField == null) {
actualField = getEnemyField(map);
progress++;
moveToPosition(actualField.getSpawnPoint());
Method slowEnemy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public void slowEnemy(AEnemy enemy){
if(matchFieldTimer.isCanceled()){
return;
}
enemy.getTimerTask().cancel();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method hitEnemy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void hitEnemy() {
super.hitEnemy();
enemies.remove(targetEnemy);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"