Showing 9 of 9 total issues
File Model.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
action, computed, extendObservable,
IArrayChange, IArraySplice, IComputedValue,
intercept, IObservableArray, IObservableObject,
isObservableArray, observable, toJS,
Model
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
export class Model implements IModel {
/**
* The attribute that should be used as the unique identifier
*
Collection
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class Collection implements ICollection {
/**
* List of custom model types
*
Function insert
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@action public insert(data: Array<object>|object): Array<IModel> {
const items = [].concat(data)
.map((item) => {
const type: IType = item[TYPE_PROP];
if (!type) {
Function constructor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor(initialData: object = {}, opts?: IOpts|Collection, collection?: Collection) {
const data = assign({}, this.static.defaults, this.static.preprocess(initialData));
let collectionInstance = collection;
const idAttribute = this.static.idAttribute;
- 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 __setRef
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private __setRef<T>(ref: string, val: T|Array<T>): IModel|Array<IModel> {
const isArray = val instanceof Array || isObservableArray(val);
const hasModelInstances = isArray
? (val as Array<T>).some((item) => item instanceof Model)
: val instanceof Model;
- 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 __ensureId
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private __ensureId(data: IDictionary, collection?: ICollection) {
const idAttribute = this.static.idAttribute;
const id = getProp<string|number>(data, idAttribute);
if (!id) {
if (!this.static.enableAutoId) {
- 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
TODO found Open
// TODO: Could be optimised based on __initializedProps?
- Exclude checks
TODO found Open
// TODO: Could be optimised based on __initializedProps?
- Exclude checks