Showing 58 of 67 total issues
Function compareAB
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export function compareAB(a, b, func, getArgs) {
if (arguments.length === 2) {
if (a < b) return -1;
if (a > b) return 1;
- 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 _initializePromise
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initializePromise(options) {
if (!this.getOption('promiseEnabled')) return;
this.mergeOptions(options, ['mapResult']);
Function enableStateModel
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
enableStateModel() {
if (!this.stateModel) {
this.stateModel = this.buildStateModel();
}
let state = this.stateModel;
Function normalizeArgs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function normalizeArgs(ownArgs, cmnArgs, cmnArgsIndex = 0, ownArgsIndex = 0) {
if (cmnArgs == null && ownArgs == null) {
return;
- 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 compareAB
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function compareAB(a, b, func, getArgs) {
if (arguments.length === 2) {
if (a < b) return -1;
if (a > b) return 1;
Function validateAsync
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async validateAsync(value, options = {}) {
if (!arguments.length) {
value = this.getValue();
}
let children = this.hasChildren();
Function _createRoutes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_createRoutes() {
if (this._routes) return;
let routes = this.getOption('routes');
if (routes == null) return;
if (_.isString(routes)) {
- 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 ModelSchemas
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function ModelSchemas(type, schema, opts = {}) {
if (typeof type !== 'string' && typeof type !== 'function') {
throw new Error('Type must be a string or a function');
}
if (arguments.length === 1) {
- 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 _buildRoute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_buildRoute(routeKey, arg) {
if (_.isString(arg)) {
return this._buildRoute(routeKey, { route: arg })
} else if (_.isFunction(arg)) {
return this._buildRoute(routeKey, arg.call(this, routeKey));
- 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 camelCase
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function camelCase(...args) {
let text;
let first;
- 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 _initProps
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_initProps(properties) {
let keys;
let get;
if (Array.isArray(properties)) {
keys = new Array(properties.length);
- 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 buildRouteUrl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function buildRouteUrl(route, data = {}, search = '', hash = '') {
// normalizing search and hash;
search = search && search.toString() || ''; // if its a URLSearchParams
if (search && search[0] !== '?') {
- 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 createRawContext
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function createRawContext(arg, store) {
if (isInstance(arg, ActorApi)) {
return { action: arg };
} else if (_.isString(arg) && isInstance(store[arg], ActorApi)) {
return { action: store[arg] };
- 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 validateAsync
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async validateAsync(value, options = {}) {
if (!arguments.length) {
value = this.getValue();
}
let children = this.hasChildren();
- 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 hasFlags
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function hasFlags(allflags, expected, options = {}) {
if (allflags == null || expected == null) return false;
if (_.isNumber(expected)) {
if (_.isNumber(allflags)) {
return options.any ? ((allflags & expected) > 0) : ((allflags & expected) == expected); /* eslint-disable-line */
- 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 constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options = {}) {
if (options.http == null) {
throw new Error('http not provided');
}
Api.apply(this, arguments);
Function ModelSchemas
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ModelSchemas(type, schema, opts = {}) {
if (typeof type !== 'string' && typeof type !== 'function') {
throw new Error('Type must be a string or a function');
}
if (arguments.length === 1) {
Function buildInstanceByKey
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function buildInstanceByKey(context, key, buildOptions = {}) {
if (!buildOptions.ctorArgs) {
let { keyToCamelCase, defaultOptions, options, optionsKey } = buildOptions;
if (!optionsKey) {
optionsKey = keyToCamelCase ? camelCase(key, 'options') : key + 'Options';
- 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 buildItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function buildItem(arg, buildOptions = {}) {
if (arg == null) return;
let { BaseClass, ctorArgs, ctorArgsIndex, context } = buildOptions;
- 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 normalizeActionContext
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function normalizeActionContext(callContext, ac) {
if (ac && ac._normalized) {
return ac;
}
if (ac && isInstance(ac.action, ActorApi)) {
- 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"