oglimmer/ggo

View on GitHub

Showing 183 of 183 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    protected void killBombarb(Unit unitKilled, Unit killer) {
        addInfo(unitKilled.getPlayer(),
                "DEFEAT: Your " + unitKilled.getUnitType() + " on " + unitKilled.getDeployedOn().getId()
                        + " got bombarded by " + killer.getUnitType() + " from " + killer.getDeployedOn().getId()
                        + ".");
core/src/main/java/de/oglimmer/ggo/logic/battle/BaseBattleResolver.java on lines 82..90
core/src/main/java/de/oglimmer/ggo/logic/battle/BaseBattleResolver.java on lines 101..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 121.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                            signal: function (type, data) {
                                if (!win.closed && win.fire) {
                                    win.fire(atmosphere.util.stringifyJSON({
                                        target: "p",
                                        type: type,
Severity: Major
Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js and 1 other location - About 1 hr to fix
web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js on lines 934..942

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                            signal: function (type, data) {
                                if (!win.closed && win.fire) {
                                    win.fire(atmosphere.util.stringifyJSON({
                                        target: "c",
                                        type: type,
Severity: Major
Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js and 1 other location - About 1 hr to fix
web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js on lines 721..729

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    protected void killOne(Unit killed, Unit killer) {
        addInfo(killed.getPlayer(), "DEFEAT: Your " + killed.getUnitType() + " on " + killed.getDeployedOn().getId()
                + " got destroyed by " + killer.getUnitType() + " from " + killer.getDeployedOn().getId() + ".");
        addInfo(killer.getPlayer(), "VICTORY: Your " + killer.getUnitType() + " on " + killer.getDeployedOn().getId()
                + " destroyed " + killed.getUnitType() + " on " + killed.getDeployedOn().getId() + ".");
core/src/main/java/de/oglimmer/ggo/logic/battle/BaseBattleResolver.java on lines 82..90
core/src/main/java/de/oglimmer/ggo/logic/battle/BaseBattleResolver.java on lines 118..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 121.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            $("#btnAi").click(function() {
                $.ajax({
                    url : "./CreateAiQuery.action",
                    success : function(result) {
                        document.location.href="Board.action?playerId="+result.playerId;
    Severity: Major
    Found in web/src/main/webapp/js/createGame.js and 1 other location - About 1 hr to fix
    web/src/main/webapp/js/createGame.js on lines 63..70

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            $("#btnTutorial").click(function() {
                $.ajax({
                    url : "./CreateTutorialQuery.action",
                    success : function(result) {
                        document.location.href="Board.action?playerId="+result.playerId;
    Severity: Major
    Found in web/src/main/webapp/js/createGame.js and 1 other location - About 1 hr to fix
    web/src/main/webapp/js/createGame.js on lines 71..78

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              ctx.lineTo(tox-headlen*Math.cos(angle-Math.PI/7),toy-headlen*Math.sin(angle-Math.PI/7));
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 1 other location - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 188..188

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              ctx.lineTo(tox-headlen*Math.cos(angle-Math.PI/7),toy-headlen*Math.sin(angle-Math.PI/7));
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 1 other location - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 181..181

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

                  case Constants.UNIT_TYPE_TANK:
                      var img=document.getElementById("tank_"+this.color);
                      ctx.drawImage(img,cx-img.width*.5,cy - img.height*.5);
                      break;
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 5 other locations - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 47..50
      web/src/main/webapp/js/app/Unit.js on lines 55..58
      web/src/main/webapp/js/app/Unit.js on lines 59..62
      web/src/main/webapp/js/app/Unit.js on lines 63..66
      web/src/main/webapp/js/app/Unit.js on lines 67..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

                  case Constants.UNIT_TYPE_ARTILLERY:
                      var img=document.getElementById("artillery_"+this.color);
                      ctx.drawImage(img,cx-img.width*.5,cy - img.height*.5);
                      break;
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 5 other locations - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 47..50
      web/src/main/webapp/js/app/Unit.js on lines 51..54
      web/src/main/webapp/js/app/Unit.js on lines 55..58
      web/src/main/webapp/js/app/Unit.js on lines 59..62
      web/src/main/webapp/js/app/Unit.js on lines 67..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

                  case Constants.UNIT_TYPE_INFANTRY:
                      var img=document.getElementById("infantry_"+this.color);
                      ctx.drawImage(img,cx-img.width*.5,cy - img.height*.5);
                      break;
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 5 other locations - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 51..54
      web/src/main/webapp/js/app/Unit.js on lines 55..58
      web/src/main/webapp/js/app/Unit.js on lines 59..62
      web/src/main/webapp/js/app/Unit.js on lines 63..66
      web/src/main/webapp/js/app/Unit.js on lines 67..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

                  case Constants.UNIT_TYPE_AIRBORNE:
                      var img=document.getElementById("airborne_"+this.color);
                      ctx.drawImage(img,cx-img.width*.5,cy - img.height*.5);
                      break;
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 5 other locations - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 47..50
      web/src/main/webapp/js/app/Unit.js on lines 51..54
      web/src/main/webapp/js/app/Unit.js on lines 59..62
      web/src/main/webapp/js/app/Unit.js on lines 63..66
      web/src/main/webapp/js/app/Unit.js on lines 67..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

                  case Constants.UNIT_TYPE_CITY:
                      var img=document.getElementById("city_"+this.color);
                      ctx.drawImage(img,cx-img.width*.5,cy - img.height*.5);
                      break;
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 5 other locations - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 47..50
      web/src/main/webapp/js/app/Unit.js on lines 51..54
      web/src/main/webapp/js/app/Unit.js on lines 55..58
      web/src/main/webapp/js/app/Unit.js on lines 59..62
      web/src/main/webapp/js/app/Unit.js on lines 63..66

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

                  case Constants.UNIT_TYPE_HELICOPTER:
                      var img=document.getElementById("helicopter_"+this.color);
                      ctx.drawImage(img,cx-img.width*.5,cy - img.height*.5);
                      break;
      Severity: Major
      Found in web/src/main/webapp/js/app/Unit.js and 5 other locations - About 1 hr to fix
      web/src/main/webapp/js/app/Unit.js on lines 47..50
      web/src/main/webapp/js/app/Unit.js on lines 51..54
      web/src/main/webapp/js/app/Unit.js on lines 55..58
      web/src/main/webapp/js/app/Unit.js on lines 63..66
      web/src/main/webapp/js/app/Unit.js on lines 67..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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
              Severity
              Category
              Status
              Source
              Language