oglimmer/ggo

View on GitHub

Showing 102 of 183 total issues

Avoid deeply nested control flow statements.
Open

                                        if (!_response.ffTryingReconnect) {
                                            _triggerOpen(rq);
                                        }
Severity: Major
Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 45 mins to fix

    Consider simplifying this complex logical expression.
    Open

                                    if (!cdoc.body || !cdoc.body.firstChild || cdoc.body.firstChild.nodeName.toLowerCase() !== "pre") {
                                        // Injects a plaintext element which renders text without interpreting the HTML and cannot be stopped
                                        // it is deprecated in HTML5, but still works
                                        var head = cdoc.head || cdoc.getElementsByTagName("head")[0] || cdoc.documentElement || cdoc;
                                        var script = cdoc.createElement("script");
    Severity: Major
    Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 40 mins to fix

      Function addPendingChange has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          var addPendingChange = function(obj,prop, mode, newval, oldval) {
      Severity: Minor
      Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

        Function watchMany has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            var watchMany = function (obj, props, watcher, level, addNRemove) {
        Severity: Minor
        Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

          Function trackProperty has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              var trackProperty = function(obj,prop,callback,recursive, addNRemove) { 
          Severity: Minor
          Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

            Function callWatchers has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                var callWatchers = function (obj, prop, action, newval, oldval) {
            Severity: Minor
            Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

              Function watchOne has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  var watchOne = function (obj, prop, watcher, level, addNRemove) {
              Severity: Minor
              Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

                Method diffEntry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private void diffEntry(ObjectNode diffNode, String key, JsonNode oldValue, JsonNode newValue) {
                        if (newValue != null && newValue.isArray()) {
                            diffArray(diffNode, key, oldValue, newValue);
                        } else if (newValue != null && newValue.isObject()) {
                            diffObject(diffNode, key, oldValue, newValue);
                Severity: Minor
                Found in atmosphere-mvc/src/main/java/de/oglimmer/atmospheremvc/util/Json.java - About 35 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 deploy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public void deploy() {
                        Unit toDeploy = player.getUnitInHand().get(0);
                        DeployPhase dp = (DeployPhase) game.getCurrentPhase();
                        Field toDeployField = null;
                Severity: Minor
                Found in core/src/main/java/de/oglimmer/ggo/logic/ai/RandomStrategy.java - About 35 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

                Avoid too many return statements within this function.
                Open

                                    return false;
                Severity: Major
                Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return Math.random() < 0.5 ? player1 : player2;
                  Severity: Major
                  Found in core/src/main/java/de/oglimmer/ggo/logic/phase/DeployPhase.java - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                                            return;
                    Severity: Major
                    Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return true;
                      Severity: Major
                      Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return val;
                        Severity: Major
                        Found in web/src/main/webapp/js/app/ObjectMerger.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return false;
                          Severity: Major
                          Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                            return;
                            Severity: Major
                            Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 30 mins to fix

                              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 nextPhase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  @Override
                                  protected void nextPhase() {
                                      cc.calcBattle();
                                      combatPhaseRoundCounter.incRound();
                                      if (combatPhaseRoundCounter.lastRoundReached() || getGame().getBoard().getTotalUnits() == 0) {
                              Severity: Minor
                              Found in core/src/main/java/de/oglimmer/ggo/logic/phase/CombatDisplayPhase.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 diffPrimitive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private void diffPrimitive(ObjectNode diffNode, String key, JsonNode oldValue, JsonNode newValue) {
                                      assert newValue == null || !newValue.isContainerNode();
                                      assert oldValue == null || !oldValue.isContainerNode();
                                      if ((newValue == null && oldValue != null) || (newValue != null && !newValue.equals(oldValue))) {
                                          diffNode.set(key, newValue);
                              Severity: Minor
                              Found in atmosphere-mvc/src/main/java/de/oglimmer/atmospheremvc/util/Json.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 score has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected static void score(Unit winningUnit, CommandCenter cc) {
                                      CommandType ct = cc.getByUnit(winningUnit).getCommandType();
                                      if (!cc.isDry()) {
                                          int score = 0;
                                          if (ct == CommandType.MOVE) {
                              Severity: Minor
                              Found in core/src/main/java/de/oglimmer/ggo/logic/battle/BaseBattleResolver.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