oglimmer/ggo

View on GitHub

Showing 183 of 183 total issues

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

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

            for ( var f in globalData.model.boardState.idToUnits) {
                var unitToDraw = globalData.model.boardState.idToUnits[f];
                unitToDraw.draw0(this.ctxBoard);
            }
    Severity: Major
    Found in web/src/main/webapp/js/app/Board.js and 1 other location - About 1 hr to fix
    web/src/main/webapp/js/app/Board.js on lines 109..112

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

    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

            for ( var f in globalData.model.boardState.idToUnits) {
                var unitToDraw = globalData.model.boardState.idToUnits[f];
                unitToDraw.draw1(this.ctxBoard);
            }
    Severity: Major
    Found in web/src/main/webapp/js/app/Board.js and 1 other location - About 1 hr to fix
    web/src/main/webapp/js/app/Board.js on lines 104..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 67.

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

    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

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

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

            Button.prototype.onSelect = function() {
                if(this.selectable){
                    communication.send({
                        pid: globalData.playerId,
                        cmd: 'button',
        Severity: Major
        Found in web/src/main/webapp/js/app/Button.js and 3 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/Field.js on lines 76..84
        web/src/main/webapp/js/app/HandItem.js on lines 77..85
        web/src/main/webapp/js/app/Unit.js on lines 140..148

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

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

            Unit.prototype.onSelect = function() {
                if(this.selectable){
                    communication.send({
                        pid: globalData.playerId,
                        cmd: 'selectUnit',
        Severity: Major
        Found in web/src/main/webapp/js/app/Unit.js and 3 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/Button.js on lines 56..64
        web/src/main/webapp/js/app/Field.js on lines 76..84
        web/src/main/webapp/js/app/HandItem.js on lines 77..85

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

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

            Field.prototype.onSelect = function() {
                if(this.selectable) {
                    communication.send({
                        pid: globalData.playerId,
                        cmd: 'selectTargetField',
        Severity: Major
        Found in web/src/main/webapp/js/app/Field.js and 3 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/Button.js on lines 56..64
        web/src/main/webapp/js/app/HandItem.js on lines 77..85
        web/src/main/webapp/js/app/Unit.js on lines 140..148

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

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

            HandItem.prototype.onSelect = function() {
                if(this.selectable){
                    communication.send({
                        pid: globalData.playerId,
                        cmd: 'selectHandCard',
        Severity: Major
        Found in web/src/main/webapp/js/app/HandItem.js and 3 other locations - About 1 hr to fix
        web/src/main/webapp/js/app/Button.js on lines 56..64
        web/src/main/webapp/js/app/Field.js on lines 76..84
        web/src/main/webapp/js/app/Unit.js on lines 140..148

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

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

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

                    off: function (elem, type, fn) {
                        if (elem.removeEventListener) {
                            elem.removeEventListener(type, fn, false);
                        } else if (elem.detachEvent) {
                            elem.detachEvent("on" + type, fn);
            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 3238..3244

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

            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

                    on: function (elem, type, fn) {
                        if (elem.addEventListener) {
                            elem.addEventListener(type, fn, false);
                        } else if (elem.attachEvent) {
                            elem.attachEvent("on" + type, fn);
            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 3245..3251

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

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

                Method resolveBattle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected void resolveBattle(Unit u1, Unit u2, boolean crossing) {
                        int for1 = isFortified(u1);
                        int for2 = isFortified(u2);
                        int sup1 = isSupported(u1);
                        int sup2 = isSupported(u2);

                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 _attachHeaders has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            function _attachHeaders(request, url) {
                                var rq = _request;
                                if ((request != null) && (typeof (request) !== 'undefined')) {
                                    rq = request;
                                }
                Severity: Minor
                Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 1 hr to fix

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

                      HandItem.prototype.draw = function(ctx, x, y) {
                          this.width = Constants.size.width*.8;
                          this.height = Constants.size.height*.8;
                          this.x = x;
                          this.y = y;
                  Severity: Minor
                  Found in web/src/main/webapp/js/app/HandItem.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language