estimancy/projestimate

View on GitHub
app/assets/javascripts/jit-2.0.1-excanvas.js

Summary

Maintainability
F
1 wk
Test Coverage

File jit-2.0.1-excanvas.js has 1084 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Major
Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 2 days to fix

    Consider simplifying this complex logical expression.
    Open

    if (!document.createElement('canvas').getContext) {
    
    (function() {
    
      // alias some functions to make (compiled) code shorter
    Severity: Critical
    Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

      Function appendFill has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function appendFill(ctx, lineStr, min, max) {
          var fillStyle = ctx.fillStyle;
          var arcScaleX = ctx.arcScaleX_;
          var arcScaleY = ctx.arcScaleY_;
          var width = max.x - min.x;
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

        Function drawImage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          contextPrototype.drawImage = function(image, var_args) {
            var dx, dy, dw, dh, sx, sy, sw, sh;
        
            // to find the original width we overide the width and height
            var oldRuntimeWidth = image.runtimeStyle.width;
        Severity: Major
        Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

          Function drawText_ has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
              var m = this.m_,
                  delta = 1000,
                  left = 0,
                  right = delta,
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 2 hrs to fix

            Function stroke has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              contextPrototype.stroke = function(aFill) {
                var lineStr = [];
                var lineOpen = false;
            
                var W = 10;
            Severity: Major
            Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 2 hrs to fix

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

                function CanvasRenderingContext2D_(canvasElement) {
                  this.m_ = createMatrixIdentity();
              
                  this.mStack_ = [];
                  this.aStack_ = [];
              Severity: Minor
              Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 1 hr to fix

                Function processStyle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function processStyle(styleString) {
                    if (styleString in processStyleCache) {
                      return processStyleCache[styleString];
                    }
                
                
                Severity: Minor
                Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 1 hr to fix

                  Function bezierCurveTo has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
                                                              aCP2x, aCP2y,
                                                              aX, aY) {
                  Severity: Minor
                  Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 45 mins to fix

                    Function arc has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      contextPrototype.arc = function(aX, aY, aRadius,
                                                      aStartAngle, aEndAngle, aClockwise) {
                    Severity: Minor
                    Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 45 mins to fix

                      Function createRadialGradient has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        contextPrototype.createRadialGradient = function(aX0, aY0, aR0,
                                                                         aX1, aY1, aR1) {
                      Severity: Minor
                      Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 45 mins to fix

                        Function transform has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
                        Severity: Minor
                        Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 45 mins to fix

                          Function setTransform has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
                          Severity: Minor
                          Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 45 mins to fix

                            Function drawText_ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
                            Severity: Minor
                            Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 35 mins to fix

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

                                  if (s == 0) {
                                    r = g = b = l; // achromatic
                                  } else {
                                    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
                                    var p = 2 * l - q;
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 5 hrs to fix
                              app/assets/javascripts/spectrum.js on lines 1553..1562

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

                              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

                                contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
                                  var oldPath = this.currentPath_;
                                  this.beginPath();
                              
                                  this.moveTo(aX, aY);
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 5 hrs to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 721..733

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

                              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

                                contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
                                  var oldPath = this.currentPath_;
                                  this.beginPath();
                              
                                  this.moveTo(aX, aY);
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 5 hrs to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 735..747

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

                              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

                                contextPrototype.moveTo = function(aX, aY) {
                                  var p = getCoords(this, aX, aY);
                                  this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
                                  this.currentX_ = p.x;
                                  this.currentY_ = p.y;
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 3 hrs to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 630..636

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

                              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

                                contextPrototype.lineTo = function(aX, aY) {
                                  var p = getCoords(this, aX, aY);
                                  this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
                              
                                  this.currentX_ = p.x;
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 3 hrs to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 623..628

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

                              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

                                    x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,
                              Severity: Minor
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 55 mins to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 1104..1104

                              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

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

                                    y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2
                              Severity: Minor
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 55 mins to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 1103..1103

                              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

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

                                      if (max.y == null || p.y > max.y) {
                                        max.y = p.y;
                                      }
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 3 other locations - About 35 mins to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 939..941
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 942..944
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 945..947

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

                              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

                                      if (min.x == null || p.x < min.x) {
                                        min.x = p.x;
                                      }
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 3 other locations - About 35 mins to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 942..944
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 945..947
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 948..950

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

                              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

                                      if (min.y == null || p.y < min.y) {
                                        min.y = p.y;
                                      }
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 3 other locations - About 35 mins to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 939..941
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 942..944
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 948..950

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

                              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

                                      if (max.x == null || p.x > max.x) {
                                        max.x = p.x;
                                      }
                              Severity: Major
                              Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 3 other locations - About 35 mins to fix
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 939..941
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 945..947
                              app/assets/javascripts/jit-2.0.1-excanvas.js on lines 948..950

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

                              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

                              There are no issues that match your filters.

                              Category
                              Status