Showing 225 of 354 total issues
File Node.ts
has 1787 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util, Transform } from './Util';
import { Factory } from './Factory';
import { SceneCanvas, HitCanvas, Canvas } from './Canvas';
import { Konva } from './Global';
import { Container } from './Container';
File Transformer.ts
has 1151 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util, Transform } from '../Util';
import { Factory } from '../Factory';
import { Node } from '../Node';
import { Shape } from '../Shape';
import { Rect } from './Rect';
Node
has 111 functions (exceeds 20 allowed). Consider refactoring. Open
export abstract class Node<Config extends NodeConfig = NodeConfig> {
_id = idCounter++;
eventListeners: {
[index: string]: Array<{ name: string; handler: Function }>;
} = {};
File Util.ts
has 848 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Konva } from './Global';
import { Context } from './Context';
import { IRect, RGB, RGBA, Vector2d } from './types';
/*
File BezierFunctions.ts
has 793 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Credits: rveciana/svg-path-properties
// Legendre-Gauss abscissae (xi values, defined at i=n as the roots of the nth order Legendre polynomial Pn(x))
export const tValues = [
[],
File Shape.ts
has 785 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Konva } from './Global';
import { Transform, Util } from './Util';
import { Factory } from './Factory';
import { Node, NodeConfig } from './Node';
import {
File Path.ts
has 774 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Factory } from '../Factory';
import { Shape, ShapeConfig } from '../Shape';
import { _registerNode } from '../Global';
import { GetSet, PathSegment } from '../types';
File Stage.ts
has 767 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util } from './Util';
import { Factory } from './Factory';
import { Container, ContainerConfig } from './Container';
import { Konva } from './Global';
import { SceneCanvas, HitCanvas } from './Canvas';
File Context.ts
has 667 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util } from './Util';
import { Konva } from './Global';
import { Canvas } from './Canvas';
import { Shape } from './Shape';
import { IRect } from './types';
Function parsePathData
has 277 lines of code (exceeds 25 allowed). Consider refactoring. Open
static parsePathData(data): PathSegment[] {
// Path Data Segment must begin with a moveTo
//m (x y)+ Relative moveTo (subsequent points are treated as lineTo)
//M (x y)+ Absolute moveTo (subsequent points are treated as lineTo)
//l (x y)+ Relative lineTo
Function _setTextData
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
_setTextData() {
var lines = this.text().split('\n'),
fontSize = +this.fontSize(),
textWidth = 0,
lineHeightPx = this.lineHeight() * fontSize,
- 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 Emboss
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
export const Emboss: Filter = function (imageData) {
// pixastic strength is between 0 and 10. I want it between 0 and 1
// pixastic greyLevel is between 0 and 255. I want it between 0 and 1. Also,
// a max value of greyLevel yields a white emboss, and the min value yields a black
// emboss. Therefore, I changed greyLevel to whiteLevel
- 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 _handleMouseMove
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
_handleMouseMove(e) {
var x, y, newHypotenuse;
var anchorNode = this.findOne('.' + this._movingAnchorName)!;
var stage = anchorNode.getStage()!;
- 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
File Tween.ts
has 586 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util } from './Util';
import { Animation } from './Animation';
import { Node, NodeConfig } from './Node';
import { Konva } from './Global';
import { Line } from './shapes/Line';
Function parsePathData
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
static parsePathData(data): PathSegment[] {
// Path Data Segment must begin with a moveTo
//m (x y)+ Relative moveTo (subsequent points are treated as lineTo)
//M (x y)+ Absolute moveTo (subsequent points are treated as lineTo)
//l (x y)+ Relative lineTo
- 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 filterGaussBlurRGBA
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filterGaussBlurRGBA(imageData, radius) {
var pixels = imageData.data,
width = imageData.width,
height = imageData.height;
File Text.ts
has 523 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util } from '../Util';
import { Context } from '../Context';
import { Factory } from '../Factory';
import { Shape, ShapeConfig } from '../Shape';
import { Konva } from '../Global';
Context
has 55 functions (exceeds 20 allowed). Consider refactoring. Open
export class Context {
canvas: Canvas;
_context: CanvasRenderingContext2D;
traceArr: Array<String>;
Function _handleMouseMove
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleMouseMove(e) {
var x, y, newHypotenuse;
var anchorNode = this.findOne('.' + this._movingAnchorName)!;
var stage = anchorNode.getStage()!;
Util
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
export const Util = {
/*
* cherry-picked utilities from underscore.js
*/
_isElement(obj: any): obj is Element {