Showing 44 of 105 total issues
Function fromNode
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports.fromNode = function fromNode(node){
var text = new Tspan();
if(typeof node != 'undefined'){
- Read upRead up
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 toJSON
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
SvgObject.prototype.toJSON = function toJSON(matrix){
var json = {
type : this.type
};
- Read upRead up
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 31 lines of code (exceeds 25 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']);
}
Function calculateAllInnerBoxes
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Svg.prototype.calculateAllInnerBoxes = function calculateAllInnerBoxes(callback) {
var svg = new Svg();
async.each(this.elements, function (child, done) {
switch (child.type) {
case 'rect' :
Function is
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
is : function(o, type) {
type = Str.prototype.toLowerCase.call(type);
if (type == "finite") {
return isFinite(o);
}
- Read upRead up
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 parseJson
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Parser.parseJson = function parseJson(elements) {
var nodes = [];
_.each(elements, function (element) {
switch (element.type) {
Function parseXmlNode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Parser.parseXmlNode = function parseXmlNode(node) {
var nodes = [];
_.each(node, function (content, index) {
switch (index) {
Function fromElement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.fromElement = function(bbox, element){
if(typeof element.transform != 'undefined'){
var tstr = element.transform;
var res = [];
Function toXml
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
SvgObject.prototype.toXml = function toXml(matrix){
var xml = builder.create(this.type);
var style = "";
_.each(this.style, function(value, index){
Function fromJson
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.fromJson = function fromJson(object, json){
if(typeof json != 'undefined'){
if(typeof json.classes != 'undefined'){
object.classes = json.classes;
}
Function bbox
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
bbox : function(x, y, width, height) {
if (x == null) {
x = y = width = height = 0;
}
if (y == null) {
Function fromNode
has 26 lines of code (exceeds 25 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);
Avoid deeply nested control flow statements. Open
if (tlen == 2) {
bb = bb || bbox;
m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2);
} else if (tlen == 4) {
if (absolute) {
Avoid deeply nested control flow statements. Open
} else if (command == "s") {
if (tlen == 2 || tlen == 3) {
bb = bb || bbox;
m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2);
} else if (tlen == 4) {
Function add
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
matrixproto.add = function (a, b, c, d, e, f) {
Function fromNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.fromNode = function fromNode(node) {
var circle = new Circle();
if (typeof node !== 'undefined' && typeof node.$ !== 'undefined') {
SvgObject.fromNode(circle, node);
- Read upRead up
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 Matrix
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function Matrix(a, b, c, d, e, f) {
Function rectPath
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
rectPath : function(x, y, w, h, r) {
Function removeByType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Svg.prototype.removeByType = function removeByType(params) {
this.elements = _.filter(this.elements, function (element) {
if (!_.isArray(params.type)) {
var t = params.type;
params.type = [];
- Read upRead up
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 removeByType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Group.prototype.removeByType = function removeByType(params) {
this.childs = _.filter(this.childs, function (element) {
if (!_.isArray(params.type)) {
var t = params.type;
params.type = [];
- Read upRead up
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"