GreyRook/gown.js

View on GitHub

Showing 79 of 271 total issues

Function refreshMinAndMaxScrollPositions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

Scroller.prototype.refreshMinAndMaxScrollPositions = function () {
    var visibleViewPortWidth = this.actualWidth - (this._viewPortOffset.left + this._viewPortOffset.right);
    var visibleViewPortHeight = this.actualHeight - (this._viewPortOffset.top + this._viewPortOffset.bottom);
    if (this.explicitPageWidth !== this.explicitPageWidth) { //isNaN
        this.actualPageWidth = visibleViewPortWidth;
Severity: Minor
Found in src/controls/Scroller.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 layout has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

LayoutAlignment.prototype.layout = function(items, maxWidth, maxHeight) {
    var _hor = (this.alignment === LayoutAlignment.HORIZONTAL_ALIGNMENT);

    // width/height the current layout takes
    var width = 0;
Severity: Minor
Found in src/layout/LayoutAlignment.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 mouseWheelSupport has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mouseWheelSupport(stage, enable) {
    var canvas = stage.canvas;
    if (enable || enable === undefined) {
        if (GOWN._mouseWheelHandler !== undefined) {
            return;
Severity: Minor
Found in src/utils/mouseWheelSupport.js - About 1 hr to fix

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

    ScaleContainer.prototype._positionTilable = function() {
        // left / middle / right width
        var lw = this.rect.x;
        var mw = this.rect.width;
        var rw = this.frame.width - (mw + lw);
    Severity: Minor
    Found in src/utils/ScaleContainer.js - About 1 hr to fix

      Function applyPercent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      LayoutAlignment.prototype.applyPercent = function(items, explicit) {
          var _hor = (this.alignment === LayoutAlignment.HORIZONTAL_ALIGNMENT);
      
          var itemCount = items.length;
          var remaining = explicit;
      Severity: Minor
      Found in src/layout/LayoutAlignment.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 layout has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      LayoutAlignment.prototype.layout = function(items, maxWidth, maxHeight) {
          var _hor = (this.alignment === LayoutAlignment.HORIZONTAL_ALIGNMENT);
      
          // width/height the current layout takes
          var width = 0;
      Severity: Minor
      Found in src/layout/LayoutAlignment.js - About 1 hr to fix

        Function checkForDrag has 37 lines of code (exceeds 25 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 1 hr to fix

          Function ScaleContainer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function ScaleContainer(texture, rect, middleWidth, centerHeight) {
              PIXI.Container.call( this );
          
              /**
               * The rectangle with position and dimensions of the center piece.
          Severity: Minor
          Found in src/utils/ScaleContainer.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 drawResults has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          AutoComplete.prototype.drawResults = function (text) {
              if (text.length < this._minAutoCompleteLength) {
                  this.results = [];
              } else {
                  var lowerCaseText = text.toString().toLowerCase();
          Severity: Minor
          Found in src/controls/AutoComplete.js - About 1 hr to fix

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

            Scroller.prototype.refreshPageCount = function () {
                if (this._snapToPages) {
                    var horizontalScrollRange = this._maxHorizontalScrollPosition - this._minHorizontalScrollPosition;
                    var roundedDownRange;
                    if (horizontalScrollRange === Number.POSITIVE_INFINITY) {
            Severity: Minor
            Found in src/controls/Scroller.js - About 1 hr to fix

              Function refreshMinAndMaxScrollPositions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Scroller.prototype.refreshMinAndMaxScrollPositions = function () {
                  var visibleViewPortWidth = this.actualWidth - (this._viewPortOffset.left + this._viewPortOffset.right);
                  var visibleViewPortHeight = this.actualHeight - (this._viewPortOffset.top + this._viewPortOffset.bottom);
                  if (this.explicitPageWidth !== this.explicitPageWidth) { //isNaN
                      this.actualPageWidth = visibleViewPortWidth;
              Severity: Minor
              Found in src/controls/Scroller.js - About 1 hr to fix

                Function throwToPage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Scroller.prototype.throwToPage = function (targetHorizontalPageIndex, targetVerticalPageIndex, duration) {
                    duration = duration || 0.5;
                    var targetHorizontalScrollPosition = this._horizontalScrollPosition;
                    if (targetHorizontalPageIndex >= this._minHorizontalPageIndex) {
                        targetHorizontalScrollPosition = this.actualPageWidth * targetHorizontalPageIndex;
                Severity: Minor
                Found in src/controls/Scroller.js - About 1 hr to fix

                  Function handleEvent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Button.prototype.handleEvent = function(type) {
                      if (!this._enabled) {
                          return;
                      }
                      if (type === Button.DOWN || type === Button.TOUCHSTART) {
                  Severity: Minor
                  Found in src/controls/Button.js - About 1 hr to fix

                    Function applyPercent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    LayoutAlignment.prototype.applyPercent = function(items, explicit) {
                        var _hor = (this.alignment === LayoutAlignment.HORIZONTAL_ALIGNMENT);
                    
                        var itemCount = items.length;
                        var remaining = explicit;
                    Severity: Minor
                    Found in src/layout/LayoutAlignment.js - About 1 hr to fix

                      Function updateTransform has 31 lines of code (exceeds 25 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

                        Function parseData has 30 lines of code (exceeds 25 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 1 hr to fix

                          Function createInput has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          InputWrapper.createInput = function() {
                              if (!InputWrapper.hiddenInput) {
                                  var input = document.createElement('input');
                                  input.type = 'text';
                                  input.tabindex = -1;
                          Severity: Minor
                          Found in src/utils/InputWrapper.js - About 1 hr to fix

                            Function _drawSelectionBg has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            TextArea.prototype._drawSelectionBg = function (fromTextPos, toTextPos) {
                                this.textToPixelPos(fromTextPos, this._fromPos);
                                this.textToPixelPos(toTextPos, this._toPos);
                            
                                this.selectionBg.beginFill(0x0080ff);
                            Severity: Minor
                            Found in src/controls/TextArea.js - About 1 hr to fix

                              Function refreshScrollSteps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                              Scroller.prototype.refreshScrollSteps = function () {
                                  if (this.explicitHorizontalScrollStep !== this.explicitHorizontalScrollStep) //isNaN
                                  {
                                      if (this._viewPort) {
                                          this.actualHorizontalScrollStep = this._viewPort.horizontalScrollStep;
                              Severity: Minor
                              Found in src/controls/Scroller.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 throwTo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                              Scroller.prototype.throwTo = function (targetHorizontalScrollPosition, targetVerticalScrollPosition, duration) {
                                  duration = duration || 500;
                              
                                  var verticalScrollPosition = this._throwToTween(targetHorizontalScrollPosition, 'horizontal');
                                  var horizontalScrollPosition = this._throwToTween(targetVerticalScrollPosition, 'vertical');
                              Severity: Minor
                              Found in src/controls/Scroller.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

                              Severity
                              Category
                              Status
                              Source
                              Language