Showing 22 of 52 total issues
RegistrationBase
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
export class RegistrationBase implements IRegistrationBase {
private _id: string
private _factory?: Factory<{}>
private _factoryType?: {}
private _factoryValue?: {}
File internal-container.ts
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IRegistrationBase, IDynamicDependency } from '../registration'
import { ResolutionError, CircularDependencyError } from '../exceptions/index.js'
import { owner, scope } from '../common/index.js'
import {
IRegistrationStorageService,
Function container
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const container = (_container: IInternalContainer) => {
const result: IContainer = {
get cache(): ICache {
return _container.cache
},
InternalContainer
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export class InternalContainer implements IInternalContainer {
private _parent: InternalContainer | undefined
private _children: InternalContainer [] = []
private _pendingResolutions: IndexedCollection<boolean>
Function instantiateByDependencies
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private instantiateByDependencies(type: {}, dependencies: {}[]) {
const params = dependencies
.map((dependency, index) => {
const depParams =
- 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 defineWrapStrategies
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private defineWrapStrategies(): IStrategy {
const result = <IStrategy>{}
const createCallChainFromList = this.createCallChainFromList.bind(this)
const defineWrapGetter = this.defineWrapGetter.bind(this)
const defineWrapSetter = this.defineWrapSetter.bind(this)
Function container
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const container = (_container: IInternalContainer) => {
const result: IContainer = {
get cache(): ICache {
return _container.cache
},
- 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 defineNonWrapStrategies
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private defineNonWrapStrategies(): IStrategy {
const result = <IStrategy>{}
result[propertyType.method] = (strategyInfo: IStrategyInfo) => {
Function instantiateByDependencies
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private instantiateByDependencies(type: {}, dependencies: {}[]) {
const params = dependencies
.map((dependency, index) => {
const depParams =
Function internalContainerService
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private internalContainerService(): IInternalContainerService {
const dependencies = () => {
const registrationStorageService = this.registrationStorageService()
const disposableStorageService = this.disposableStorageService()
Function createRegister
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createRegister<R>(builder: IContainerBuilder, isSelf = false) {
return (api: IDecoratorRegistrationApi<R>): ClassDecorator => (target) => {
if (!isPrototype(target)) {
throw new DecoratorError(
Function params
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((dependency, index) => {
const depParams =
this._resolutionDetails ? this._resolutionDetails.tryGet(type) : null
const depParamsValue = depParams ? depParams[index] : null
Function createDependenciesRegistration
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createDependenciesRegistration<R>(api: IContainerApi<R>): IRegistrationBase[] {
const items = api.dependenciesValue.map(dependency => {
if (!dependency.service) {
Function getSubstitutes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getSubstitutes(name: string, types: CallInfoType[]): ISubstitute | null {
const unknown = this._unknown.head ?
this.copyList(
this._unknown,
- 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 instantiateByParams
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private instantiateByParams(
type: {}, registration: IRegistrationBase, throwIfNotFound: boolean) {
const params = registration.params
.map(item => {
- 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
Consider simplifying this complex logical expression. Open
if ((dependency.factory && dependency.factoryType) ||
(dependency.factory && factoryValueKey in dependency) ||
(dependency.factoryType && factoryValueKey in dependency)) {
throw new ApplicationError({ message: 'Unknown registration type' })
}
Function getPropertyType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getPropertyType = (descriptor?: PropertyDescriptor): PropertyType => {
if (!descriptor) {
return propertyType.field
}
- 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 createTrackable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private createTrackable(
registration: IRegistrationBase, throwIfNotFound : boolean, args?: {}[]): {} {
try {
let instance = this._invoker.invoke(registration, throwIfNotFound, args) as {}
- 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
if (descriptor.get && descriptor.set) return propertyType.fullProperty
Avoid too many return
statements within this function. Open
return propertyType.field