File model.js
has 447 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as utils from "base/utils";
import EventSource, { DefaultEvent, ChangeEvent } from "base/events";
import Intervals from "base/intervals";
const ModelLeaf = EventSource.extend({
Model
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
const Model = EventSource.extend({
getClassDefaults: () => ({}),
/**
Function set
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
set(attr, val, force, persistent, caller) {
const setting = this._setting;
let attrs;
let freezeCall = false; // boolean, indicates if this .set()-call froze the modelTree
- 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 set
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
set(attr, val, force, persistent, caller) {
const setting = this._setting;
let attrs;
let freezeCall = false; // boolean, indicates if this .set()-call froze the modelTree
Function initSubmodel
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function initSubmodel(attr, val, ctx, persistent) {
let submodel;
// if value is a value -> leaf
- 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 initSubmodel
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initSubmodel(attr, val, ctx, persistent) {
let submodel;
// if value is a value -> leaf
Function init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
init(name, value, parent, binds, persistent) {
Function set
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
set(attr, val, force, persistent, caller) {
Function setReady
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
setReady(value) {
if (value === false) {
this._ready = false;
if (this._parent && this._parent.setReady) {
this._parent.setReady(false);
- 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"