Showing 86 of 120 total issues
File baseattr.js
has 356 lines of code (exceeds 350 allowed). Consider refactoring. Open
import SvgPath from 'svg-path-to-canvas';
import {Matrix} from 'sprite-math';
import NodeAttr from './attr';
import {parseColorString, oneOrTwoValues, fourValuesShortCut, eightValuesShortCut,
parseStringInt, parseStringFloat, parseStringTransform,
Function resolveStates
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
resolveStates(states, before, after) {
let currentAnimation = null,
resolved = false;
const _states = [];
Function render
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
render(t, drawingContext) {
super.render(t, drawingContext);
const textAlign = this.attr('textAlign'),
flexible = this.attr('flexible'),
Function draw
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
draw(t, drawingContext = this.context) { // eslint-disable-line complexity
super.draw(t, drawingContext);
if(!this.isVisible()) {
return;
Function enter
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
enter(toState) {
const states = this.attr('states');
let ret;
if(states && (states.beforeEnter || states.afterEnter)) {
const deferred = this.resolveStates(['beforeEnter', 'afterEnter'], (_states) => {
Function relayout
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
export function relayout(containerSprite, itemsSprite) {
itemsSprite.sort((a, b) => {
const orderA = a.attributes.order | 0,
orderB = b.attributes.order | 0;
if(orderA !== orderB) {
Function draw
has a Cognitive Complexity of 34 (exceeds 25 allowed). Consider refactoring. Open
draw(t, drawingContext = this.context) { // eslint-disable-line complexity
super.draw(t, drawingContext);
if(!this.isVisible()) {
return;
- 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 drawDot9Image
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
function drawDot9Image(drawingContext, image, clip9, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
const w = image.width,
h = image.height;
const [top, right, bottom, left] = clip9 || [16, 16, 16, 16];
Function dispatchEvent
has a Cognitive Complexity of 33 (exceeds 25 allowed). Consider refactoring. Open
dispatchEvent(type, evt, collisionState = false, swallow = false, useCapturePhase = null) { // eslint-disable-line complexity
let handlers = this.getEventHandlers(type);
if(this.children && useCapturePhase === true) handlers = handlers.filter(handler => handler.useCapture);
if(this.children && useCapturePhase === false) handlers = handlers.filter(handler => !handler.useCapture);
evt.returnValue = true;
- 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 dispatchEvent
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
dispatchEvent(type, evt, collisionState = false, swallow = false, useCapturePhase = null) {
const handlers = this.getEventHandlers(type);
if(swallow && handlers.length === 0) {
return;
}
Function render
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
render(t, drawingContext) {
super.render(t, drawingContext);
const d = this.attr('d'),
lineWidth = this.attr('lineWidth'),
lineCap = this.attr('lineCap'),
Function calculTextboxSize
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
function calculTextboxSize(node) {
if(!node.context) return '';
const text = node.text,
font = node.attr('font'),
lineHeight = node.attr('lineHeight'),
Function sizeToPixel
has a Cognitive Complexity of 31 (exceeds 25 allowed). Consider refactoring. Open
export function sizeToPixel(value, defaultWidth) { // eslint-disable-line complexity
if(typeof value === 'string') {
const matched = value.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%)$/);
if(matched) {
value = {size: parseFloat(matched[1]), unit: matched[2]};
- 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 applyRative
has a Cognitive Complexity of 31 (exceeds 25 allowed). Consider refactoring. Open
function applyRative(elementDescriptor, type) {
const {descriptor} = elementDescriptor;
const setter = descriptor.set;
- 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 transition
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
transition(sec, easing = 'linear', isStyleAnim = false) {
const that = this,
_animation = Symbol('animation');
easing = easing || 'linear';
Function _split
has 10 arguments (exceeds 5 allowed). Consider refactoring. Open
function _split(x1, y1, x2, y2, x3, y3, x4, y4, t, reverse) {
Function render
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
render(t, drawingContext) {
const border = this.attr('border'),
borderRadius = this.attr('borderRadius'),
padding = this.attr('padding'),
[offsetWidth, offsetHeight] = this.offsetSize,
Function fromDocumentCSS
has a Cognitive Complexity of 30 (exceeds 25 allowed). Consider refactoring. Open
fromDocumentCSS(stylesheets, override) /* istanbul ignore next */ {
if(override) {
cssRules = cssRules.filter(r => !r.fromDoc);
}
if(typeof document === 'undefined') return;
- 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
Consider simplifying this complex logical expression. Open
if((key === 'font'
|| key === 'lineHeight'
|| key === 'lineBreak'
|| key === 'wordBreak'
|| key === 'letterSpacing'
Function split
has 9 arguments (exceeds 5 allowed). Consider refactoring. Open
function split(x1, y1, x2, y2, x3, y3, x4, y4, t) {