Showing 225 of 354 total issues
Function _sceneFunc
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
_sceneFunc(context: Context) {
var textArr = this.textArr,
textArrLen = textArr.length;
if (!this.text()) {
- 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
Stage
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
export class Stage extends Container<Layer> {
content: HTMLDivElement;
pointerPos: Vector2d | null;
_pointerPositions: (Vector2d & { id?: number })[] = [];
_changedPointerPositions: (Vector2d & { id: number })[] = [];
Function filterGaussBlurRGBA
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
function filterGaussBlurRGBA(imageData, radius) {
var pixels = imageData.data,
width = imageData.width,
height = imageData.height;
- 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 Pixelate
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export const Pixelate: Filter = function (imageData) {
var pixelSize = Math.ceil(this.pixelSize()),
width = imageData.width,
height = imageData.height,
x,
- 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 _fitNodesInto
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
_fitNodesInto(newAttrs, evt?) {
var oldAttrs = this._getNodeRect();
const minSize = 1;
File Container.ts
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Factory } from './Factory';
import { Node, NodeConfig } from './Node';
import { getNumberValidator } from './Validators';
import { GetSet, IRect } from './types';
Function _sceneFunc
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
_sceneFunc(context: Context) {
var textArr = this.textArr,
textArrLen = textArr.length;
if (!this.text()) {
Transformer
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
export class Transformer extends Group {
_nodes: Array<Node>;
_movingAnchorName: string | null = null;
_transforming = false;
_anchorDragOffset: Vector2d;
Layer
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
export class Layer extends Container<Group | Shape> {
canvas = new SceneCanvas();
hitCanvas = new HitCanvas({
pixelRatio: 1,
});
File Layer.ts
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Util } from './Util';
import { Container, ContainerConfig } from './Container';
import { Node } from './Node';
import { Factory } from './Factory';
import { SceneCanvas, HitCanvas } from './Canvas';
Function Emboss
has 100 lines of code (exceeds 25 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
Function _setTextData
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setTextData() {
var lines = this.text().split('\n'),
fontSize = +this.fontSize(),
textWidth = 0,
lineHeightPx = this.lineHeight() * fontSize,
Shape
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
export class Shape<
Config extends ShapeConfig = ShapeConfig
> extends Node<Config> {
_centroid: boolean;
colorKey: string;
Function update
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
update() {
var attrs = this._getNodeRect();
this.rotation(Util._getRotation(attrs.rotation));
var width = attrs.width;
var height = attrs.height;
Function cache
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
cache(config?: {
x?: number;
y?: number;
width?: number;
height?: number;
Function _addAttr
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
_addAttr(key, end) {
var node = this.node,
nodeId = node._id,
start,
diff,
- 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 _tweenFunc
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
_tweenFunc(i) {
var node = this.node,
attrs = Tween.attrs[node._id][this._id],
key,
attr,
- 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 Enhance
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Enhance: Filter = function (imageData) {
var data = imageData.data,
nSubPixels = data.length,
rMin = data[0],
rMax = rMin,
Function _pointerup
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
_pointerup(evt) {
const events = getEventsMap(evt.type);
const eventType = getEventType(evt.type);
if (!events) {
Function getSelfRect
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
getSelfRect() {
var points: Array<number> = [];
this.dataArray.forEach(function (data) {
if (data.command === 'A') {
// Approximates by breaking curve into line segments