gopheracademy/gcon

View on GitHub
assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js

Summary

Maintainability
F
9 mos
Test Coverage

Function build has 2019 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function build() {
        var svg = { };
        
        svg.FRAMERATE = 30;
        svg.MAX_VIRTUAL_PIXELS = 30000;

    File canvas-tools.src.js has 2486 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @license A class to parse color values
     * @author Stoyan Stefanov <sstoo@gmail.com>
     * @link   http://www.phpied.com/rgb-color-parser-in-javascript/
     * Use it if you like it
    Severity: Major
    Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 6 days to fix

      Function path has 266 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              svg.Element.path = function(node) {
                  this.base = svg.Element.PathElementBase;
                  this.base(node);
                          
                  var d = this.attribute('d').value;
      Severity: Major
      Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 1 day to fix

        Function RGBColor has 253 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function RGBColor(color_string)
        {
            this.ok = false;
        
            // strip any leading #
        Severity: Major
        Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 1 day to fix

          Function path has 156 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      this.path = function(ctx) {
                          var pp = this.PathParser;
                          pp.reset();
          
                          var bb = new svg.BoundingBox();
          Severity: Major
          Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 6 hrs to fix

            Function RGBColor has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

            function RGBColor(color_string)
            {
                this.ok = false;
            
                // strip any leading #
            Severity: Minor
            Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 5 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 ElementBase has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    svg.Element.ElementBase = function(node) {    
                        this.attributes = {};
                        this.styles = {};
                        this.children = [];
                        
            Severity: Major
            Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 4 hrs to fix

              Function Property has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      svg.Property = function(name, value) {
                          this.name = name;
                          this.value = value;
                          
                          this.hasValue = function() {
              Severity: Major
              Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 3 hrs to fix

                Function loadXmlDoc has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        svg.loadXmlDoc = function(ctx, dom) {
                            svg.init(ctx);
                            
                            var mapXY = function(p) {
                                var e = ctx.canvas;
                Severity: Major
                Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 3 hrs to fix

                  Function PathParser has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              this.PathParser = new (function(d) {
                                  this.tokens = d.split(' ');
                                  
                                  this.reset = function() {
                                      this.i = -1;
                  Severity: Major
                  Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 3 hrs to fix

                    Function Transform has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            svg.Transform = function(v) {    
                                var that = this;
                                this.Type = {}
                            
                                // translate
                    Severity: Major
                    Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 3 hrs to fix

                      Function BoundingBox has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              svg.BoundingBox = function(x1, y1, x2, y2) { // pass in initial points if you want
                                  this.x1 = Number.NaN;
                                  this.y1 = Number.NaN;
                                  this.x2 = Number.NaN;
                                  this.y2 = Number.NaN;
                      Severity: Major
                      Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 3 hrs to fix

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

                                svg.Element.TextElementBase = function(node) {
                                    this.base = svg.Element.RenderedElementBase;
                                    this.base(node);
                                    
                                    this.getGlyph = function(font, text, i) {
                        Severity: Major
                        Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 3 hrs to fix

                          Function feGaussianBlur has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  svg.Element.feGaussianBlur = function(node) {
                                      this.base = svg.Element.ElementBase;
                                      this.base(node);    
                                      
                                      function make_fgauss(sigma) {
                          Severity: Major
                          Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 2 hrs to fix

                            Function svg has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    svg.Element.svg = function(node) {
                                        this.base = svg.Element.RenderedElementBase;
                                        this.base(node);
                                        
                                        this.baseClearContext = this.clearContext;
                            Severity: Major
                            Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 2 hrs to fix

                              Function text has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      svg.Element.text = function(node) {
                                          this.base = svg.Element.RenderedElementBase;
                                          this.base(node);
                                          
                                          if (node != null) {
                              Severity: Major
                              Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 2 hrs to fix

                                Function AnimateBase has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        svg.Element.AnimateBase = function(node) {
                                            this.base = svg.Element.ElementBase;
                                            this.base(node);
                                            
                                            svg.Animations.push(this);
                                Severity: Major
                                Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 2 hrs to fix

                                  Function configure has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          configure: function (chart) {
                                              var renderer = this,
                                                  options = chart.options.tooltip,
                                                  borderWidth = options.borderWidth,
                                                  tooltipDiv = renderer.ttDiv,
                                  Severity: Major
                                  Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 2 hrs to fix

                                    Function setContext has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                                this.setContext = function(ctx) {
                                                    // initial values
                                                    ctx.strokeStyle = 'rgba(0,0,0,0)';
                                                    ctx.lineCap = 'butt';
                                                    ctx.lineJoin = 'miter';

                                      Function style has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              svg.Element.style = function(node) { 
                                                  this.base = svg.Element.ElementBase;
                                                  this.base(node);
                                                  
                                                  // text, or spaces then CDATA

                                        Function GradientBase has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                svg.Element.GradientBase = function(node) {
                                                    this.base = svg.Element.ElementBase;
                                                    this.base(node);
                                                    
                                                    this.gradientUnits = this.attribute('gradientUnits').valueOrDefault('objectBoundingBox');

                                          Function RenderedElementBase has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  svg.Element.RenderedElementBase = function(node) {
                                                      this.base = svg.Element.ElementBase;
                                                      this.base(node);
                                                      
                                                      this.setContext = function(ctx) {

                                            Function setContext has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                        this.setContext = function(ctx) {
                                                            // fill
                                                            if (this.style('fill').Definition.isUrl()) {
                                                                var fs = this.style('fill').Definition.getFillStyle(this);
                                                                if (fs != null) ctx.fillStyle = fs;

                                              Function canvg has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  this.canvg = function (target, s, opts) {
                                                      // no parameters
                                                      if (target == null && s == null && opts == null) {
                                                          var svgTags = document.getElementsByTagName('svg');
                                                          for (var i=0; i<svgTags.length; i++) {

                                                Function Mouse has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                        svg.Mouse = new (function() {
                                                            this.events = [];
                                                            this.hasEvents = function() { return this.events.length != 0; }
                                                        
                                                            this.onclick = function(x, y) {

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

                                                              this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
                                                                  // from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
                                                                  var p0 = [p0x, p0y], p1 = [p1x, p1y], p2 = [p2x, p2y], p3 = [p3x, p3y];
                                                                  this.addPoint(p0[0], p0[1]);
                                                                  this.addPoint(p3[0], p3[1]);

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

                                                            svg.Element.filter = function(node) {
                                                                this.base = svg.Element.ElementBase;
                                                                this.base(node);
                                                                            
                                                                this.apply = function(ctx, element) {

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

                                                              svg.Element.PathElementBase = function(node) {
                                                                  this.base = svg.Element.RenderedElementBase;
                                                                  this.base(node);
                                                                  
                                                                  this.path = function(ctx) {

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

                                                                    var draw = function() {
                                                                        svg.ViewPort.Clear();
                                                                        if (ctx.canvas.parentNode) svg.ViewPort.SetCurrent(ctx.canvas.parentNode.clientWidth, ctx.canvas.parentNode.clientHeight);
                                                                    
                                                                        if (svg.opts['ignoreDimensions'] != true) {

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

                                                              this.getHelpXML = function () {
                                                          
                                                                  var examples = new Array();
                                                                  // add regexps
                                                                  for (var i = 0; i < color_defs.length; i++) {

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

                                                                        this.createGradient = function(ctx, element) {
                                                                            var stopsContainer = this;
                                                                            if (this.attribute('xlink:href').hasValue()) {
                                                                                stopsContainer = this.attribute('xlink:href').Definition.getDefinition();
                                                                            }

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

                                                                          this.renderChildren = function(ctx) {
                                                                              var textAnchor = this.style('text-anchor').valueOrDefault('start');
                                                                              var x = this.attribute('x').Length.toPixels('x');
                                                                              var y = this.attribute('y').Length.toPixels('y');
                                                                              for (var i=0; i<this.children.length; i++) {

                                                                Function AspectRatio has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                        svg.AspectRatio = function(ctx, aspectRatio, width, desiredWidth, height, desiredHeight, minX, minY, refX, refY) {

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

                                                                          setContainer: function (container, chartWidth, chartHeight) {
                                                                              var containerStyle = container.style,
                                                                                  containerParent = container.parentNode,
                                                                                  containerLeft = containerStyle.left,
                                                                                  containerTop = containerStyle.top,

                                                                    Function a has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                            svg.Element.a = function(node) {
                                                                                this.base = svg.Element.TextElementBase;
                                                                                this.base(node);
                                                                                
                                                                                this.hasText = true;

                                                                      Function font has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                              svg.Element.font = function(node) {
                                                                                  this.base = svg.Element.ElementBase;
                                                                                  this.base(node);
                                                                      
                                                                                  this.horizAdvX = this.attribute('horiz-adv-x').numValue();            

                                                                        Function apply has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                                    this.apply = function(ctx, element) {
                                                                                        // render as temp svg    
                                                                                        var bb = element.getBoundingBox();
                                                                                        var x = this.attribute('x').Length.toPixels('x');
                                                                                        var y = this.attribute('y').Length.toPixels('y');

                                                                          Function Font has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                          Open

                                                                                  svg.Font = new (function() {
                                                                                      this.Styles = ['normal','italic','oblique','inherit'];
                                                                                      this.Variants = ['normal','small-caps','inherit'];
                                                                                      this.Weights = ['normal','bold','bolder','lighter','100','200','300','400','500','600','700','800','900','inherit'];
                                                                                      

                                                                            Function renderChildren has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                            Open

                                                                                        this.renderChildren = function(ctx) {
                                                                                            var customFont = this.parent.style('font-family').Definition.getDefinition();
                                                                                            if (customFont != null) {
                                                                                                var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
                                                                                                var fontStyle = this.parent.style('font-style').valueOrDefault(svg.Font.Parse(svg.ctx.font).fontStyle);

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

                                                                                      svg.Element.mask = function(node) {
                                                                                          this.base = svg.Element.ElementBase;
                                                                                          this.base(node);
                                                                                                      
                                                                                          this.apply = function(ctx, element) {

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

                                                                                            this.update = function(delta) {    
                                                                                                // set initial value
                                                                                                if (this.initialValue == null) {
                                                                                                    this.initialValue = this.getProperty().value;
                                                                                                }

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

                                                                                          svg.Element.radialGradient = function(node) {
                                                                                              this.base = svg.Element.GradientBase;
                                                                                              this.base(node);
                                                                                              
                                                                                              this.getGradient = function(ctx, element) {

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

                                                                                            svg.Element.image = function(node) {
                                                                                                this.base = svg.Element.RenderedElementBase;
                                                                                                this.base(node);
                                                                                                
                                                                                                svg.Images.push(this);

                                                                                      Function rect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                      Open

                                                                                              svg.Element.rect = function(node) {
                                                                                                  this.base = svg.Element.PathElementBase;
                                                                                                  this.base(node);
                                                                                                  
                                                                                                  this.path = function(ctx) {

                                                                                        Function addBezierCurve has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                        Open

                                                                                                    this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {

                                                                                          Function imSet has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                          Open

                                                                                                      function imSet(img, x, y, width, height, rgba, val) {
                                                                                          Severity: Major
                                                                                          Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 50 mins to fix

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

                                                                                                        function imGet(img, x, y, width, height, rgba) {
                                                                                            Severity: Minor
                                                                                            Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                              Avoid deeply nested control flow statements.
                                                                                              Open

                                                                                                                          for (var name in styles) {
                                                                                                                              this.styles[name] = styles[name];
                                                                                                                          }
                                                                                              Severity: Major
                                                                                              Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                                Avoid deeply nested control flow statements.
                                                                                                Open

                                                                                                                            if (cssClass == '@font-face') {
                                                                                                                                var fontFamily = props['font-family'].value.replace(/"/g,'');
                                                                                                                                var srcs = props['src'].value.split(',');
                                                                                                                                for (var s=0; s<srcs.length; s++) {
                                                                                                                                    if (srcs[s].indexOf('format("svg")') > 0) {
                                                                                                Severity: Major
                                                                                                Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                                  Avoid deeply nested control flow statements.
                                                                                                  Open

                                                                                                                          if (typeof(this.glyphs[child.unicode]) == 'undefined') this.glyphs[child.unicode] = [];
                                                                                                  Severity: Major
                                                                                                  Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

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

                                                                                                                this.addQuadraticCurve = function(p0x, p0y, p1x, p1y, p2x, p2y) {
                                                                                                    Severity: Minor
                                                                                                    Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                                      Avoid deeply nested control flow statements.
                                                                                                      Open

                                                                                                                          else if (!set.fontWeight && that.Weights.indexOf(d[i]) != -1) {    if (d[i] != 'inherit') f.fontWeight = d[i]; set.fontStyle = set.fontVariant = set.fontWeight = true; }
                                                                                                      Severity: Major
                                                                                                      Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

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

                                                                                                                    this.CreateFont = function(fontStyle, fontVariant, fontWeight, fontSize, fontFamily, inherit) { 
                                                                                                        Severity: Minor
                                                                                                        Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                                          Avoid deeply nested control flow statements.
                                                                                                          Open

                                                                                                                              else if (!set.fontSize) { if (d[i] != 'inherit') f.fontSize = d[i].split('/')[0]; set.fontStyle = set.fontVariant = set.fontWeight = set.fontSize = true; }
                                                                                                                              else { if (d[i] != 'inherit') ff += d[i]; }
                                                                                                          Severity: Major
                                                                                                          Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                                            Avoid deeply nested control flow statements.
                                                                                                            Open

                                                                                                                                        for (var name in styles) {
                                                                                                                                            this.styles[name] = styles[name];
                                                                                                                                        }
                                                                                                            Severity: Major
                                                                                                            Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

                                                                                                              Avoid deeply nested control flow statements.
                                                                                                              Open

                                                                                                                                          for (var k=0; k<cssProps.length; k++) {
                                                                                                                                              var prop = cssProps[k].indexOf(':');
                                                                                                                                              var name = cssProps[k].substr(0, prop);
                                                                                                                                              var value = cssProps[k].substr(prop + 1, cssProps[k].length - prop);
                                                                                                                                              if (name != null && value != null) {
                                                                                                              Severity: Major
                                                                                                              Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 45 mins to fix

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

                                                                                                                            function convolve_even(src, dst, mask, width, height) {
                                                                                                                Severity: Minor
                                                                                                                Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 35 mins to fix

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

                                                                                                                              this.apply = function(ctx, x, y, width, height) {
                                                                                                                  Severity: Minor
                                                                                                                  Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 35 mins to fix

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

                                                                                                                        CanvasRenderingContext2D.prototype.drawSvg = function(s, dx, dy, dw, dh) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 35 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                                          if (s.match(/in$/)) return that.numValue() * this.DPI(viewPort);
                                                                                                                      Severity: Major
                                                                                                                      Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

                                                                                                                                            return that.numValue() * (Math.PI / 180.0);
                                                                                                                        Severity: Major
                                                                                                                        Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

                                                                                                                                              return that.numValue();
                                                                                                                          Severity: Major
                                                                                                                          Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

                                                                                                                                                if (s.match(/cm$/)) return that.numValue() * this.DPI(viewPort) / 2.54;
                                                                                                                            Severity: Major
                                                                                                                            Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                                  if (s.match(/mm$/)) return that.numValue() * this.DPI(viewPort) / 25.4;
                                                                                                                              Severity: Major
                                                                                                                              Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

                                                                                                                                                    if (s.match(/pt$/)) return that.numValue() * 1.25;
                                                                                                                                Severity: Major
                                                                                                                                Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                                      if (s.match(/pc$/)) return that.numValue() * 15;
                                                                                                                                  Severity: Major
                                                                                                                                  Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

                                                                                                                                                        if (s.match(/%$/)) return that.numValue() * svg.ViewPort.ComputeSize(viewPort);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in assets/admin/global/plugins/highstock/js/modules/canvas-tools.src.js - About 30 mins to fix

                                                                                                                                      TODO found
                                                                                                                                      Open

                                                                                                                                                                  bb.addPoint(cp.x, cp.y); // TODO: this is too naive, make it better

                                                                                                                                      TODO found
                                                                                                                                      Open

                                                                                                                                                  // TODO: convert to real lexer based on http://www.w3.org/TR/SVG11/paths.html#PathDataBNF

                                                                                                                                      TODO found
                                                                                                                                      Open

                                                                                                                                                          return 96.0; // TODO: compute?

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

                                                                                                                                      (function(){
                                                                                                                                          // canvg(target, s)
                                                                                                                                          // empty parameters: replace all 'svg' elements on page with 'canvas' elements
                                                                                                                                          // target: canvas element or the id of a canvas element
                                                                                                                                          // s: svg string, url to svg file, or xml document
                                                                                                                                      assets/admin/global/plugins/highcharts/js/modules/canvas-tools.src.js on lines 316..2895
                                                                                                                                      assets/admin/global/plugins/highmaps/js/modules/canvas-tools.src.js on lines 316..2895

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

                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                      Refactorings

                                                                                                                                      Further Reading

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

                                                                                                                                      function RGBColor(color_string)
                                                                                                                                      {
                                                                                                                                          this.ok = false;
                                                                                                                                      
                                                                                                                                          // strip any leading #
                                                                                                                                      assets/admin/global/plugins/highcharts/js/modules/canvas-tools.src.js on lines 8..288
                                                                                                                                      assets/admin/global/plugins/highmaps/js/modules/canvas-tools.src.js on lines 8..288

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

                                                                                                                                      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

                                                                                                                                      (function (Highcharts) { // encapsulate
                                                                                                                                          var UNDEFINED,
                                                                                                                                              DIV = 'div',
                                                                                                                                              ABSOLUTE = 'absolute',
                                                                                                                                              RELATIVE = 'relative',
                                                                                                                                      assets/admin/global/plugins/highcharts/js/modules/canvas-tools.src.js on lines 2922..3113
                                                                                                                                      assets/admin/global/plugins/highmaps/js/modules/canvas-tools.src.js on lines 2922..3113

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

                                                                                                                                      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

                                                                                                                                      if (CanvasRenderingContext2D) {
                                                                                                                                          CanvasRenderingContext2D.prototype.drawSvg = function(s, dx, dy, dw, dh) {
                                                                                                                                              canvg(this.canvas, s, { 
                                                                                                                                                  ignoreMouse: true, 
                                                                                                                                                  ignoreAnimation: true, 
                                                                                                                                      assets/admin/global/plugins/highcharts/js/modules/canvas-tools.src.js on lines 2897..2910
                                                                                                                                      assets/admin/global/plugins/highmaps/js/modules/canvas-tools.src.js on lines 2897..2910

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

                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                      Refactorings

                                                                                                                                      Further Reading

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

                                                                                                                                      if(!Array.prototype.indexOf){
                                                                                                                                          Array.prototype.indexOf = function(obj){
                                                                                                                                              for(var i=0; i<this.length; i++){
                                                                                                                                                  if(this[i]==obj){
                                                                                                                                                      return i;
                                                                                                                                      assets/admin/global/plugins/highcharts/js/modules/canvas-tools.src.js on lines 305..314
                                                                                                                                      assets/admin/global/plugins/highmaps/js/modules/canvas-tools.src.js on lines 305..314

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

                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                      Refactorings

                                                                                                                                      Further Reading

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

                                                                                                                                      if(!window.console) {
                                                                                                                                          window.console = {};
                                                                                                                                          window.console.log = function(str) {};
                                                                                                                                          window.console.dir = function(str) {};
                                                                                                                                      }
                                                                                                                                      assets/admin/global/plugins/highcharts/js/modules/canvas-tools.src.js on lines 299..303
                                                                                                                                      assets/admin/global/plugins/highmaps/js/modules/canvas-tools.src.js on lines 299..303

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

                                                                                                                                      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