Showing 7 of 7 total issues
Function model
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
model(modelName, options, ExtendedInfinityModel) {
if (typeOf(ExtendedInfinityModel) === "class") {
if (!(ExtendedInfinityModel.prototype instanceof InfinityModel)) {
throw new EmberError("Ember Infinity: You must pass an Infinity Model instance as the third argument");
}
Function model
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
model(modelName, options, ExtendedInfinityModel) {
if (typeOf(ExtendedInfinityModel) === "class") {
if (!(ExtendedInfinityModel.prototype instanceof InfinityModel)) {
throw new EmberError("Ember Infinity: You must pass an Infinity Model instance as the third argument");
}
- 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 infinity.js
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Service from '@ember/service';
import InfinityModel from 'ember-infinity/lib/infinity-model';
import InfinityPromiseArray from 'ember-infinity/lib/infinity-promise-array';
import EmberError from '@ember/error';
import { getOwner } from '@ember/application';
Function canLoadMore
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
get canLoadMore() {
if (typeof this._canLoadMore === 'boolean') {
return this._canLoadMore;
}
- 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 loadNextPage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadNextPage(infinityModel, increment = 1) {
set(infinityModel, 'isLoaded', false);
set(infinityModel, 'loadingMore', true);
set(this, '_previousScrollHeight', this._calculateHeight(infinityModel));
Function objectAssign
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export let objectAssign = Object.assign || function objectAssign(target) {
'use strict';
if (target == null) {
throw new TypeError('Cannot convert undefined or null to object');
}
- 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
Avoid too many return
statements within this function. Open
return false;