ursinn/DeadByDaylightMC

View on GitHub
src/main/java/noahnok/dbdl/files/game/MatchMaking.java

Summary

Maintainability
B
6 hrs
Test Coverage

Method addToMatchmaking has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean addToMatchmaking(Player p, String playType) {
        //Check if there are any available games
        if (waitingGames.isEmpty()) {
            //Try and create a new game
            DGame game = main.getGameManager().createNewGame();
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 2 hrs to fix

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 addPlayerToMatchMakingLoop has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void addPlayerToMatchMakingLoop(final Player p, final String playType) {
        BukkitTask tryMatchMake = new BukkitRunnable() {
            public void run() {
                if (addToMatchmaking(p, playType)) {
                    removePlayerFromMatchMakingLoop(p);
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 1 hr to fix

Method addToMatchmaking has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public boolean addToMatchmaking(Player p, String playType) {
        //Check if there are any available games
        if (waitingGames.isEmpty()) {
            //Try and create a new game
            DGame game = main.getGameManager().createNewGame();
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 1 hr to fix

Avoid too many return statements within this method.
Open

                return false;
Severity: Major
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return true;
Severity: Major
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 30 mins to fix

Refactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.
Open

    public boolean addToMatchmaking(Player p, String playType) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

TODO found
Open

                //Check playtype //TODO swap out set values for gamemode value

There are no issues that match your filters.

Category
Status