oglimmer/ggo

View on GitHub

Showing 102 of 183 total issues

Function listener has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                function listener(string) {
                    var command = atmosphere.util.parseJSON(string), data = command.data;

                    if (command.target === "c") {
                        switch (command.type) {
Severity: Minor
Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

    Function _disconnect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function _disconnect() {
                    if (_request.enableProtocol && !_request.disableDisconnect && !_request.firstMessage) {
                        var query = "X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=" + _request.uuid;
    
                        atmosphere.util.each(_request.headers, function (name, value) {
    Severity: Minor
    Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

      Function WebsocketApiAdapter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              WebsocketApiAdapter: function (request) {
                  var _socket, _adapter;
      
                  /**
                   * Overrides the onMessage callback in given request.
      Severity: Minor
      Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

        Method show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            @DefaultHandler
            @DontValidate
            public Resolution show() {
                if (getContext().getRequest().getCookies() != null) {
                    for (Cookie cookie : getContext().getRequest().getCookies()) {
        Severity: Minor
        Found in web/src/main/java/de/oglimmer/ggo/web/action/LandingActionBean.java - About 1 hr 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 getPossibleCommandTypes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public Set<CommandType> getPossibleCommandTypes(CommandCenter cc, Field targetField) {
                Set<CommandType> possibleCommands = new HashSet<>();
                if (getMovableFields(cc).contains(targetField)) {
                    possibleCommands.add(CommandType.MOVE);
                }
        Severity: Minor
        Found in core/src/main/java/de/oglimmer/ggo/logic/Unit.java - About 1 hr 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 getPossibleCommandTypes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public Set<CommandType> getPossibleCommandTypes(CommandCenter cc, Field targetField) {
                Set<CommandType> possibleCommands = new HashSet<>();
                if (getMovableFields(cc).contains(targetField)) {
                    possibleCommands.add(CommandType.MOVE);
                }
        Severity: Minor
        Found in core/src/main/java/de/oglimmer/ggo/logic/Unit.java - About 1 hr to fix

          Function param has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  param: function (params) {
                      var prefix, s = [];
          
                      function add(key, value) {
                          value = atmosphere.util.isFunction(value) ? value() : (value == null ? "" : value);
          Severity: Minor
          Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

            Function windowref has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                                windowref: function () {
                                    var win = window.open("", name.replace(/\W/g, ""));
            
                                    if (!win || win.closed || !win.callbacks) {
                                        return;
            Severity: Minor
            Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

              Function watchAll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var watchAll = function (obj, watcher, level, addNRemove) {
              
                      if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
                          return;
                      }
              Severity: Minor
              Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 1 hr to fix

                Method existsOrChanged has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private JsonNode existsOrChanged(JsonNode nodeToFind, ArrayNode arrayToSearchThrough) {
                        if (nodeToFind.isObject()) {
                            for (Iterator<JsonNode> it = arrayToSearchThrough.elements(); it.hasNext();) {
                                JsonNode elementInArray = it.next();
                                assert elementInArray.isObject();
                Severity: Minor
                Found in atmosphere-mvc/src/main/java/de/oglimmer/atmospheremvc/util/Json.java - About 55 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

                Function drawArrow has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    function drawArrow(ctx, fromx, fromy, tox, toy, color, onlyHeads){
                Severity: Major
                Found in web/src/main/webapp/js/app/Unit.js - About 50 mins to fix

                  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

                    Avoid deeply nested control flow statements.
                    Open

                                            for (var j=0; j<subj.obj.watchers[subj.prop].length; j++) {
                                                watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
                                            }
                    Severity: Major
                    Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                              if (v) {
                                                                  partial.push(quote(i) + ":" + v);
                                                              }
                      Severity: Major
                      Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

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

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (action!=='splice') {
                                                          watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
                                                      }
                                                      else {
                                                          // watch spliced values
                          Severity: Major
                          Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if(b[i] === undefined) {
                                                        aplus.push(i);
                                                    }
                            Severity: Major
                            Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                                      if (_response.status !== 500 && ajaxRequest.responseText.length > rq.lastIndex) {
                                                                          try {
                                                                              _response.status = ajaxRequest.status;
                                                                              _response.headers = atmosphere.util.parseHeaders(ajaxRequest.getAllResponseHeaders());
                              
                              
                              Severity: Major
                              Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if(a[j] === undefined) {
                                                            bplus.push(j);
                                                        }
                                Severity: Major
                                Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 45 mins to fix

                                  Method setCurrentPhase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public boolean setCurrentPhase(BasePhase nextPhase) {
                                          if (currentPhase instanceof TutorialDelegateBasePhase) {
                                              // currentPhase is a delegable
                                              TutorialDelegateBasePhase currentPhaseTutorial = (TutorialDelegateBasePhase) currentPhase;
                                              if (nextPhase instanceof TutorialDelegateBasePhase) {
                                  Severity: Minor
                                  Found in core/src/main/java/de/oglimmer/ggo/logic/Game.java - About 45 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