throrin19/svgutils

View on GitHub

Showing 44 of 105 total issues

Function transform2matrix has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    transform2matrix : function(tstr, bbox){
        var tdata = this.parseTransformString(tstr),
            m = new Matrix;
        if (tdata) {
            for (var i = 0, ii = tdata.length; i < ii; i++) {
Severity: Minor
Found in libs/matrix/utils.js - About 7 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

File svg.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

var fs          = require('fs'),
    xml2js      = require('xml2js'),
    _           = require('underscore'),
Severity: Minor
Found in libs/svg.js - About 5 hrs to fix

    Function getInnerBox has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Polygon.prototype.getInnerBox = function getInnerBox(callback) {
        var verticesY       = [],
            pointsCount     = this.points.length,
            segments        = [],
            prevY           = Infinity,
    Severity: Major
    Found in libs/objects/polygon.js - About 3 hrs to fix

      Function fromNode has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports.fromNode = function fromNode(object, node){
          if(typeof node != 'undefined' && typeof node.$ != 'undefined'){
              if(typeof node.$['class'] != 'undefined'){
                  object.setClassesFromString(node.$['class']);
              }
      Severity: Minor
      Found in libs/objects/svgobject.js - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function transform2matrix has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          transform2matrix : function(tstr, bbox){
              var tdata = this.parseTransformString(tstr),
                  m = new Matrix;
              if (tdata) {
                  for (var i = 0, ii = tdata.length; i < ii; i++) {
      Severity: Major
      Found in libs/matrix/utils.js - About 2 hrs to fix

        File polygon.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        var Matrix      = require(__dirname + '/../matrix/extends'),
            SvgObject   = require(__dirname + '/svgobject'),
            utils       = require(__dirname + '/../matrix/utils'),
        Severity: Minor
        Found in libs/objects/polygon.js - About 2 hrs to fix

          File svgobject.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          "use strict";
          
          var _       = require('underscore'),
              builder = require('xmlbuilder'),
              async   = require('async'),
          Severity: Minor
          Found in libs/objects/svgobject.js - About 2 hrs to fix

            Function getInnerBox has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            Polygon.prototype.getInnerBox = function getInnerBox(callback) {
                var verticesY       = [],
                    pointsCount     = this.points.length,
                    segments        = [],
                    prevY           = Infinity,
            Severity: Minor
            Found in libs/objects/polygon.js - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            module.exports.fromJson = function fromJson(object, json){
                if(typeof json != 'undefined'){
                    if(typeof json.classes != 'undefined'){
                        object.classes = json.classes;
                    }
            Severity: Minor
            Found in libs/objects/svgobject.js - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function fromNode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.fromNode = function fromNode(node){
                var text = new Text();
            
                SvgObject.fromNode(text, node);
            
            
            Severity: Minor
            Found in libs/objects/text.js - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function fromNode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.fromNode = function fromNode(node) {
                var image = new Img();
            
                if (typeof node !== 'undefined' && typeof node.$ !== 'undefined') {
                    SvgObject.fromNode(image, node);
            Severity: Minor
            Found in libs/objects/image.js - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            Polygon.prototype._widestSegmentAtY = function _widestSegmentAtY(y) {
                var segment = {
                        x : 0,
                        y : y,
                        width : 0
            Severity: Minor
            Found in libs/objects/polygon.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            module.exports.fromNode = function fromNode(node){
                var rect = new Rect();
            
                if(typeof node != 'undefined' && typeof node.$ != 'undefined'){
                    SvgObject.fromNode(rect, node);
            Severity: Minor
            Found in libs/objects/rect.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function fromDxfFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.fromDxfFile = function fromDxfFile(params, callback) {
                SvgParser.convertDxf(params, function (err, result) {
                    if (err) {
                        callback (err);
                        return;
            Severity: Minor
            Found in libs/svg.js - About 1 hr to fix

              Function contains has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              SvgObject.prototype.contains = function contains(svgObject, callback){
                  var self = this;
                  async.parallel({
                      ownBbox : function(c){
                          self.getBBox(function(bbox){
              Severity: Minor
              Found in libs/objects/svgobject.js - About 1 hr to fix

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

                module.exports.fromJson = function fromJson(json){
                    var rect = new Rect();
                
                    if(typeof json != 'undefined'){
                        SvgObject.fromJson(rect, json);
                Severity: Minor
                Found in libs/objects/rect.js - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                module.exports.fromJson = function fromJson(json){
                    var image = new Img();
                
                    if (typeof json != 'undefined') {
                        SvgObject.fromJson(image, json);
                Severity: Minor
                Found in libs/objects/image.js - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                Polygon.prototype._widestSegmentAtY = function _widestSegmentAtY(y) {
                    var segment = {
                            x : 0,
                            y : y,
                            width : 0
                Severity: Minor
                Found in libs/objects/polygon.js - About 1 hr to fix

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

                  module.exports.fromJson = function fromJson(json){
                      var text = new Text();
                  
                      if(typeof json != 'undefined'){
                          SvgObject.fromJson(text, json);
                  Severity: Minor
                  Found in libs/objects/text.js - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                  Group.prototype.calculateAllInnerBoxes = function calculateAllInnerBoxes(callback) {
                      var group = new Group();
                      group.style   = this.style;
                      group.classes = this.classes;
                      group.id      = this.id;
                  Severity: Minor
                  Found in libs/objects/group.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language