oglimmer/ggo

View on GitHub

Showing 183 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

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

                                            if (rq.reconnectInterval > 0) {
                                                rq.reconnectId = setTimeout(function () {
                                                    _ieStreaming(rq);
                                                }, rq.reconnectInterval);
                                            } else {
    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 2499..2505

    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 58.

    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

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

                                        if (rq.reconnectInterval > 0) {
                                            rq.reconnectId = setTimeout(function () {
                                                _ieStreaming(rq);
                                            }, rq.reconnectInterval);
                                        } else {
    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 2483..2489

    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 58.

    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 _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

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

                    case Constants.UNIT_TYPE_INFANTRY:
                        var img=document.getElementById("infantry_"+globalData.model.myColor);
                        ctx.drawImage(img,this.x,this.y);
                        break;
        Severity: Major
        Found in web/src/main/webapp/js/app/HandItem.js and 4 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/HandItem.js on lines 53..56
        web/src/main/webapp/js/app/HandItem.js on lines 57..60
        web/src/main/webapp/js/app/HandItem.js on lines 61..64
        web/src/main/webapp/js/app/HandItem.js on lines 65..68

        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 57.

        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 5 locations. Consider refactoring.
        Open

                    case Constants.UNIT_TYPE_TANK:
                        var img=document.getElementById("tank_"+globalData.model.myColor);
                        ctx.drawImage(img,this.x,this.y);
                        break;
        Severity: Major
        Found in web/src/main/webapp/js/app/HandItem.js and 4 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/HandItem.js on lines 49..52
        web/src/main/webapp/js/app/HandItem.js on lines 57..60
        web/src/main/webapp/js/app/HandItem.js on lines 61..64
        web/src/main/webapp/js/app/HandItem.js on lines 65..68

        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 57.

        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 5 locations. Consider refactoring.
        Open

                    case Constants.UNIT_TYPE_AIRBORNE:
                        var img=document.getElementById("airborne_"+globalData.model.myColor);
                        ctx.drawImage(img,this.x,this.y);
                        break;
        Severity: Major
        Found in web/src/main/webapp/js/app/HandItem.js and 4 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/HandItem.js on lines 49..52
        web/src/main/webapp/js/app/HandItem.js on lines 53..56
        web/src/main/webapp/js/app/HandItem.js on lines 61..64
        web/src/main/webapp/js/app/HandItem.js on lines 65..68

        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 57.

        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 5 locations. Consider refactoring.
        Open

                    case Constants.UNIT_TYPE_HELICOPTER:
                        var img=document.getElementById("helicopter_"+globalData.model.myColor);
                        ctx.drawImage(img,this.x,this.y);
                        break;
        Severity: Major
        Found in web/src/main/webapp/js/app/HandItem.js and 4 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/HandItem.js on lines 49..52
        web/src/main/webapp/js/app/HandItem.js on lines 53..56
        web/src/main/webapp/js/app/HandItem.js on lines 57..60
        web/src/main/webapp/js/app/HandItem.js on lines 65..68

        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 57.

        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 5 locations. Consider refactoring.
        Open

                    case Constants.UNIT_TYPE_ARTILLERY:
                        var img=document.getElementById("artillery_"+globalData.model.myColor);
                        ctx.drawImage(img,this.x,this.y);
                        break;
        Severity: Major
        Found in web/src/main/webapp/js/app/HandItem.js and 4 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/HandItem.js on lines 49..52
        web/src/main/webapp/js/app/HandItem.js on lines 53..56
        web/src/main/webapp/js/app/HandItem.js on lines 57..60
        web/src/main/webapp/js/app/HandItem.js on lines 61..64

        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 57.

        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

        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

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

                        if (even(thisX) && even(thisY) || odd(thisX) && even(thisY)) {
                            if (minus(thisX, fx) && minus(thisY, fy) || zero(thisX, fx) && minus(thisY, fy)
                                    || minus(thisX, fx) && plus(thisY, fy) || zero(thisX, fx) && plus(thisY, fy)) {
                                return true;
                            }
                core/src/main/java/de/oglimmer/ggo/logic/util/FieldUtil.java on lines 60..65

                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

                        } else {
                            if (zero(thisX, fx) && minus(thisY, fy) || plus(thisX, fx) && minus(thisY, fy)
                                    || zero(thisX, fx) && plus(thisY, fy) || plus(thisX, fx) && plus(thisY, fy)) {
                                return true;
                            }
                core/src/main/java/de/oglimmer/ggo/logic/util/FieldUtil.java on lines 55..60

                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

                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

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

                            $(window).on('pagehide', function() {
                                $.ajax({url : "./RemoveAbandonedGame.action", data: {gameId:gameId}, async: false});
                            });
                Severity: Minor
                Found in web/src/main/webapp/js/createGame.js and 1 other location - About 55 mins to fix
                web/src/main/webapp/js/createGame.js on lines 28..30

                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 53.

                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

                Severity
                Category
                Status
                Source
                Language