src/auto/injector.js
Function createInjector
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
Open
function createInjector(modulesToLoad, strictDi) {
strictDi = (strictDi === true);
var INSTANTIATING = {},
providerSuffix = 'Provider',
path = [],
- 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 createInjector
has 212 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createInjector(modulesToLoad, strictDi) {
strictDi = (strictDi === true);
var INSTANTIATING = {},
providerSuffix = 'Provider',
path = [],
Function createInternalInjector
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createInternalInjector(cache, factory) {
function getService(serviceName, caller) {
if (cache.hasOwnProperty(serviceName)) {
if (cache[serviceName] === INSTANTIATING) {
File injector.js
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
/**
* @ngdoc function
* @module ng
Function annotate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
function annotate(fn, strictDi, name) {
var $inject,
argDecl,
last;
- 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 loadModules
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function loadModules(modulesToLoad) {
assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
var runBlocks = [], moduleFn;
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return;
Function annotate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function annotate(fn, strictDi, name) {
var $inject,
argDecl,
last;
Avoid deeply nested control flow statements. Open
Open
if (!isString(name) || !name) {
name = fn.name || anonFn(fn);
}