Showing 11 of 33 total issues
exports
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = class MindPlatform {
/**
* @param {{
* platformProvidersOverride: Provider|Injectable[], list of providers that should be overridden. Any of platform provider can be overridden by providing it in application module
File core.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
const { flatten, isFunction, every, get } = require('lodash');
const {
ReflectiveInjector,
} = require('@mindjs/common/DI');
Function initModuleDI
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async initModuleDI(moduleDI, platform = undefined) {
if (!(moduleDI && moduleDI.module)) {
return;
}
Function initRoutingModulesDI
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async initRoutingModulesDI(moduleDI) {
const { rootInjector, injector: parentModuleInjector, module: parentModule } = moduleDI;
const routingModules = await Mind.extractRoutingModules({
rootInjector,
Function _prepareRouteDescriptor
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _prepareRouteDescriptor(routeDescriptor, prefix = '') {
if (!(this.moduleInjector && routeDescriptor)) {
throw new Error('Invalid input.');
}
Function initAndStart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async initAndStart() {
if (!this.rootModuleDI || this.isAppMindInitiated) {
return this;
}
Function invokeInitializers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async invokeInitializers(rootDI = {}, platform) {
const { rootInjector, injector } = rootDI;
if (!rootInjector) {
throw new Error(('injector was not provided'));
Function _prepareRouteDescriptor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async _prepareRouteDescriptor(routeDescriptor, prefix = '') {
if (!(this.moduleInjector && routeDescriptor)) {
throw new Error('Invalid input.');
}
- 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 initModuleDI
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static async initModuleDI(moduleDI, platform = undefined) {
if (!(moduleDI && moduleDI.module)) {
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
Avoid too many return
statements within this function. Open
return result;
Function invokeAll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function invokeAll(...args) {
if (!args.length) {
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"