oglimmer/ggo

View on GitHub

Showing 102 of 183 total issues

Function stringifyJSON has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        stringifyJSON: function (value) {
            var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, meta = {
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
Severity: Major
Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 2 hrs to fix

    File CombatCommandPhase.java has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package de.oglimmer.ggo.logic.phase;
    
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.HashMap;

      BasePhase has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @RequiredArgsConstructor
      abstract public class BasePhase implements de.oglimmer.atmospheremvc.game.Phase {
      
          private static final long serialVersionUID = 1L;
      
      
      Severity: Minor
      Found in core/src/main/java/de/oglimmer/ggo/logic/phase/BasePhase.java - About 2 hrs to fix

        Method command has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void command() {
                CombatCommandPhase combatCommandPhase = (CombatCommandPhase) game.getCurrentPhase();
                game.getBoard().getFields().stream().filter(f -> f.getUnit() != null)
                        .filter(f -> f.getUnit().getPlayer() == player).map(f -> f.getUnit()).forEach(u -> {
        Severity: Major
        Found in core/src/main/java/de/oglimmer/ggo/logic/ai/RandomStrategy.java - About 2 hrs to fix

          Function draw0 has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Unit.prototype.draw0 = function(ctx) {
                  var x = this.x;
                  var y = this.y;
                  var width = this.width;
                  var height = this.height;
          Severity: Minor
          Found in web/src/main/webapp/js/app/Unit.js - About 1 hr to fix

            Function getFieldByPos has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                /*private*/Board.prototype.getFieldByPos = function(pos) {
                    // x,y base coordinate
                    var hexPosY = Math.floor(pos.y / (Constants.size.height * 0.75));
                    var hexPosX = Math.floor(pos.x / Constants.size.width);
                    // odd or even row?
            Severity: Minor
            Found in web/src/main/webapp/js/app/Board.js - About 1 hr to fix

              Function _invokeCallback has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          function _invokeCallback() {
                              var call = function (index, func) {
                                  func(_response);
                              };
              
              
              Severity: Minor
              Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                Function _handleProtocol has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            function _handleProtocol(request, message) {
                
                                var nMessage = message;
                                if (request.transport === 'polling') return nMessage;
                
                
                Severity: Minor
                Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                  Function _doRequest has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              function _doRequest(ajaxRequest, request, create) {
                                  // Prevent Android to cache request
                                  var url = request.url;
                                  if (request.dispatchUrl != null && request.method === 'POST') {
                                      url += request.dispatchUrl;
                  Severity: Minor
                  Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                    Function draw has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        ModalDialog.prototype.draw = function(ctx) {
                            
                            if(!this.show) {
                                return;
                            }
                    Severity: Minor
                    Found in web/src/main/webapp/js/app/ModalDialog.js - About 1 hr to fix

                      Function str has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  return window.JSON && window.JSON.stringify ? window.JSON.stringify(value) : (function str(key, holder) {
                                      var i, v, len, partial, value = holder[key], type = typeof value;
                      
                                      if (value && typeof value === "object" && typeof value.toJSON === "function") {
                                          value = value.toJSON(key);
                      Severity: Minor
                      Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                        Function trackObject has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var trackObject= function(obj, callback, recursive, addNRemove) {
                                var change = null,lastTimerID = -1;
                                var isArr = isArray(obj);
                                var level,fn = function(prop, action, newValue, oldValue) {
                                    var timerID = getTimerID();
                        Severity: Minor
                        Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 1 hr to fix

                          Method getSupportableFields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public Set<Field> getSupportableFields(CommandCenter cc) {
                                  assert this.unitType != UnitType.ARTILLERY;
                                  /*
                                   * A unit can support a neighbor if an own unit is currently there and
                                   * not moving away.
                          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 execCmd has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              @Override
                              public void execCmd(Player player, String cmd, String param) {
                                  super.execCmd(player, cmd, param);
                                  switch (cmd) {
                                  case "selectHandCard":
                          Severity: Minor
                          Found in core/src/main/java/de/oglimmer/ggo/logic/phase/DraftPhase.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

                          Function _execute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      function _execute() {
                                          // Shared across multiple tabs/windows.
                                          if (_request.shared) {
                                              _localStorageService = _local(_request);
                                              if (_localStorageService != null) {
                          Severity: Minor
                          Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

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

                                                windowref: function () {
                                                    // Internet Explorer raises an invalid argument error
                                                    // when calling the window.open method with the name containing non-word characters
                                                    var neim = name.replace(/\W/g, ""), container = document.getElementById(neim), win;
                            
                            
                            Severity: Minor
                            Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                              Function storage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                                  storage: function () {
                                                      function onstorage(event) {
                                                          if (event.key === name && event.newValue) {
                                                              listener(event.newValue);
                                                          }
                              Severity: Minor
                              Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                                Function _trackMessageSize has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            function _trackMessageSize(message, request, response) {
                                                message = _handleProtocol(request, message);
                                                if (message.length === 0)
                                                    return true;
                                
                                
                                Severity: Minor
                                Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                                  Function poll has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                                          function poll() {
                                                              var url = rq.url;
                                                              if (rq.dispatchUrl != null) {
                                                                  url += rq.dispatchUrl;
                                                              }
                                  Severity: Minor
                                  Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

                                    Function each has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            each: function (obj, callback, args) {
                                                if (!obj) return;
                                                var value, i = 0, length = obj.length, isArray = atmosphere.util.isArray(obj);
                                    
                                                if (args) {
                                    Severity: Minor
                                    Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language