GreyRook/gown.js

View on GitHub

Showing 271 of 271 total issues

Function parseData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

ThemeParser.prototype.parseData = function(data) {
    this.hoverSkin = data.hoverSkin;
    this.thumbSkin = data.thumbSkin;
    this.themeScale = data.themeScale || 1.0;

Severity: Minor
Found in src/skin/ThemeParser.js - About 2 hrs 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 LoginDialog has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var LoginDialog = function() {
    GOWN.Control.call(this);
    // background
    this.bg = new GOWN.shapes.Rect(0x515151, 0.7, 200, 350, 5);
    this.addChild(this.bg);
Severity: Major
Found in docs/examples/example 13 - login dialog/js/LoginDialog.js - About 2 hrs to fix

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

    Object.defineProperty(AutoComplete.prototype, 'results', {
        get: function () {
            return this._results;
        },
        set: function (results) {
    Severity: Major
    Found in src/controls/AutoComplete.js and 2 other locations - About 2 hrs to fix
    src/controls/AutoComplete.js on lines 293..303
    src/controls/AutoComplete.js on lines 332..342

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

    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

    Object.defineProperty(AutoComplete.prototype, 'minAutoCompleteLength', {
        get: function () {
            return this._minAutoCompleteLength;
        },
        set: function (minAutoCompleteLength) {
    Severity: Major
    Found in src/controls/AutoComplete.js and 2 other locations - About 2 hrs to fix
    src/controls/AutoComplete.js on lines 293..303
    src/controls/AutoComplete.js on lines 313..323

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

    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

    Object.defineProperty(AutoComplete.prototype, 'source', {
        get: function () {
            return this._source;
        },
        set: function (source) {
    Severity: Major
    Found in src/controls/AutoComplete.js and 2 other locations - About 2 hrs to fix
    src/controls/AutoComplete.js on lines 313..323
    src/controls/AutoComplete.js on lines 332..342

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

    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 checkForDrag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    Scroller.prototype.checkForDrag = function (currentTouch) {
        if (this._isScrollingStopped) {
            return;
        }
        var horizontalMoved = Math.abs(currentTouch.x - this._startTouch.x);
    Severity: Minor
    Found in src/controls/Scroller.js - About 2 hrs 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 exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(destination, source) {
        for (var key in source) {
            if (source.hasOwnProperty(key)) {
                if(key === 'defineProperty') {
                    for (var name in source[key]) {
    Severity: Minor
    Found in src/utils/mixin.js - About 2 hrs 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 Scroller has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Scroller(theme) {
        Control.call(this);
        this.setTheme(theme);
        this.interactive = true;
    
    
    Severity: Major
    Found in src/controls/Scroller.js - About 2 hrs to fix

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

              if (this._viewPort.width === Number.POSITIVE_INFINITY) {
                  //we don't want to risk the possibility of negative infinity
                  //being added to positive infinity. the result is NaN.
                  this._maxHorizontalScrollPosition = Number.POSITIVE_INFINITY;
              } else {
      Severity: Major
      Found in src/controls/Scroller.js and 1 other location - About 2 hrs to fix
      src/controls/Scroller.js on lines 859..865

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

      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

              if (this._viewPort.height === Number.POSITIVE_INFINITY) {
                  //we don't want to risk the possibility of negative infinity
                  //being added to positive infinity. the result is NaN.
                  this._maxVerticalScrollPosition = Number.POSITIVE_INFINITY;
              } else {
      Severity: Major
      Found in src/controls/Scroller.js and 1 other location - About 2 hrs to fix
      src/controls/Scroller.js on lines 848..854

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

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

      function Application(config, screenMode, parentId, width, height, renderer, stage) {
          screenMode = screenMode || Application.SCREEN_MODE_RESIZE;
          var fullscreen = false;
          var element = document.getElementById(parentId);
          if (screenMode === Application.SCREEN_MODE_RESIZE) {
      Severity: Major
      Found in src/controls/Application.js - About 2 hrs to fix

        Function Application has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function Application(config, screenMode, parentId, width, height, renderer, stage) {
            screenMode = screenMode || Application.SCREEN_MODE_RESIZE;
            var fullscreen = false;
            var element = document.getElementById(parentId);
            if (screenMode === Application.SCREEN_MODE_RESIZE) {
        Severity: Minor
        Found in src/controls/Application.js - 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 updateTransform has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            updateTransform: function() {
                var wt = this.worldTransform;
                var scaleX = 1;
                var scaleY = 1;
        
        
        Severity: Minor
        Found in src/utils/resizeScaling.js - 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

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

        Button.prototype.onTouchEnd = function() {
            this.handleEvent(Button.TOUCHEND);
        
            this.off('touchend', this.onTouchEnd, this);
            this.off('touchendoutside', this.onTouchEndOutside, this);
        Severity: Major
        Found in src/controls/Button.js and 2 other locations - About 1 hr to fix
        src/controls/Button.js on lines 201..206
        src/controls/Button.js on lines 234..238

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

        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

        Button.prototype.onUp = function() {
            this.handleEvent(Button.UP);
        
            this.off('mouseupoutside', this.onUp, this);
            this.off('mouseup', this.onUp, this);
        Severity: Major
        Found in src/controls/Button.js and 2 other locations - About 1 hr to fix
        src/controls/Button.js on lines 234..238
        src/controls/Button.js on lines 245..250

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

        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

        Button.prototype.onTouchStart = function() {
            this.handleEvent(Button.TOUCHSTART);
            this.on('touchend', this.onTouchEnd, this);
            this.on('touchendoutside', this.onTouchEndOutside, this);
        };
        Severity: Major
        Found in src/controls/Button.js and 2 other locations - About 1 hr to fix
        src/controls/Button.js on lines 201..206
        src/controls/Button.js on lines 245..250

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

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

        Object.defineProperty(Shape.prototype, 'alpha', {
            get: function() {
                return this._alpha;
            },
            set: function(alpha) {
        Severity: Major
        Found in src/shapes/Shape.js and 7 other locations - About 1 hr to fix
        src/shapes/Line.js on lines 62..70
        src/shapes/Shape.js on lines 78..86
        src/shapes/Shape.js on lines 94..102
        src/shapes/Shape.js on lines 113..121
        src/shapes/Shape.js on lines 168..176
        src/shapes/Shape.js on lines 185..193
        src/shapes/Shape.js on lines 201..209

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

        Object.defineProperty(Shape.prototype, 'width', {
            get: function() {
                return this._width;
            },
            set: function(width) {
        Severity: Major
        Found in src/shapes/Shape.js and 7 other locations - About 1 hr to fix
        src/shapes/Line.js on lines 62..70
        src/shapes/Shape.js on lines 94..102
        src/shapes/Shape.js on lines 113..121
        src/shapes/Shape.js on lines 130..138
        src/shapes/Shape.js on lines 168..176
        src/shapes/Shape.js on lines 185..193
        src/shapes/Shape.js on lines 201..209

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

        Object.defineProperty(Shape.prototype, 'border', {
            get: function() {
                return this._border;
            },
            set: function(border) {
        Severity: Major
        Found in src/shapes/Shape.js and 7 other locations - About 1 hr to fix
        src/shapes/Line.js on lines 62..70
        src/shapes/Shape.js on lines 78..86
        src/shapes/Shape.js on lines 94..102
        src/shapes/Shape.js on lines 113..121
        src/shapes/Shape.js on lines 130..138
        src/shapes/Shape.js on lines 168..176
        src/shapes/Shape.js on lines 185..193

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

        Object.defineProperty(Shape.prototype, 'height', {
            get: function() {
                return this._height;
            },
            set: function(height) {
        Severity: Major
        Found in src/shapes/Shape.js and 7 other locations - About 1 hr to fix
        src/shapes/Line.js on lines 62..70
        src/shapes/Shape.js on lines 78..86
        src/shapes/Shape.js on lines 113..121
        src/shapes/Shape.js on lines 130..138
        src/shapes/Shape.js on lines 168..176
        src/shapes/Shape.js on lines 185..193
        src/shapes/Shape.js on lines 201..209

        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

        Severity
        Category
        Status
        Source
        Language