Showing 225 of 356 total issues
Function _sceneFunc
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_sceneFunc(context: Context) {
const width = this.getWidth();
const height = this.getHeight();
const cornerRadius = this.cornerRadius();
const image = this.attrs.image;
- 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 _addListeners
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_addListeners() {
// start listeners
this.tween.onPlay = () => {
this.anim.start();
};
- 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 clone
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
clone(obj?: any) {
// instantiate new node
var attrs = Util.cloneObject(this.attrs),
key,
allListeners,
- 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 __getFillPattern
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
__getFillPattern() {
if (this.fillPatternImage()) {
var ctx = getDummyContext();
const pattern = ctx.createPattern(
this.fillPatternImage(),
Function _toKonvaCanvas
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_toKonvaCanvas(config) {
config = config || {};
var box = this.getClientRect();
Function _runFrames
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _runFrames() {
const layerHash = {};
const animations = this.animations;
/*
* loop through all animations and execute animation
Function _proxyDrag
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_proxyDrag(node: Node) {
let lastPos;
node.on(`dragstart.${this._getEventNamespace()}`, (e) => {
lastPos = node.getAbsolutePosition();
// actual dragging of Transformer doesn't make sense
Function _endDragBefore
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_endDragBefore(evt?) {
const drawNodes: Array<Container> = [];
DD._dragElements.forEach((elem) => {
const { node } = elem;
// we need to find pointer relative to that node
Function _fireAndBubble
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_fireAndBubble(eventType, evt, compareShape?) {
if (evt && this.nodeType === SHAPE) {
evt.target = this;
}
Function toObject
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
toObject() {
var attrs = this.getAttrs() as any,
key,
val,
getter,
Function _fill
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_fill(shape) {
const hasColor = shape.fill(),
fillPriority = shape.getFillPriority();
// priority fills
Function off
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
off(evtStr?: string, callback?: Function) {
var events = (evtStr || '').split(SPACE),
len = events.length,
n,
t,
Function HSL
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const HSL: Filter = function (imageData) {
var data = imageData.data,
nPixels = data.length,
v = 1,
s = Math.pow(2, this.saturation()),
Function _toKonvaCanvas
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_toKonvaCanvas(config) {
config = config || {};
config.x = config.x || 0;
config.y = config.y || 0;
Function getNumberArrayValidator
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getNumberArrayValidator() {
if (Konva.isUnminified) {
return function (val: any, attr: string) {
// Retrieve TypedArray constructor as found in MDN (if TypedArray is available)
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#description
Function getAbsoluteZIndex
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
getAbsoluteZIndex() {
var depth = this.getDepth(),
that = this,
index = 0,
nodes,
Function _handleMouseDown
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleMouseDown(e) {
// do nothing if we already transforming
// that is possible to trigger with multitouch
if (this._transforming) {
return;
Function HSV
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const HSV: Filter = function (imageData) {
var data = imageData.data,
nPixels = data.length,
v = Math.pow(2, this.value()),
s = Math.pow(2, this.saturation()),
Function _prepareToStringify
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_prepareToStringify<T>(obj: any): T | null {
var desc;
obj.visitedByCircularReferenceRemoval = true;
Function _getTransform
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getTransform(): Transform {
var m: Transform = this._cache.get(TRANSFORM) || new Transform();
m.reset();
// I was trying to use attributes directly here