oglimmer/ggo

View on GitHub

Showing 102 of 183 total issues

Method shutdown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public synchronized void shutdown() {
        if (cpds != null) {
            log.debug("Shutdown c3p0 connection pool");
            try {
                final int WAIT_TIME = 5;
Severity: Minor
Found in web/src/main/java/de/oglimmer/ggo/db/ConnectionPool.java - About 25 mins 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 getTargetableFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public Set<Field> getTargetableFields() {
        assert this.unitType == UnitType.ARTILLERY || this.unitType == UnitType.HELICOPTER;
        /*
         * A unit can target a neighbor if an enemy unit is on that field (don't
         * care about enemy commands)
Severity: Minor
Found in core/src/main/java/de/oglimmer/ggo/logic/Unit.java - About 25 mins 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

Severity
Category
Status
Source
Language