Showing 19 of 23 total issues
File angular-mocks.js
has 658 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @license AngularJS v1.0.7
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*
Function createHttpBackendMock
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
function createHttpBackendMock($delegate, $browser) {
var definitions = [],
expectations = [],
responses = [],
responsesPush = angular.bind(responses, responses.push);
- 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 createHttpBackendMock
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createHttpBackendMock($delegate, $browser) {
var definitions = [],
expectations = [],
responses = [],
responsesPush = angular.bind(responses, responses.push);
Function TzDate
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
angular.mock.TzDate = function (offset, timestamp) {
var self = new Date(0);
if (angular.isString(timestamp)) {
var tsStr = timestamp;
Function MockHttpExpectation
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function MockHttpExpectation(method, url, data, headers) {
this.data = data;
this.headers = headers;
- 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 dump
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
angular.mock.dump = function(object) {
return serialize(object);
function serialize(object) {
var out;
- 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 $Browser
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
angular.mock.$Browser = function() {
var self = this;
this.isMock = true;
self.$$url = "http://server/";
Function $Browser
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
angular.mock.$Browser = function() {
var self = this;
this.isMock = true;
self.$$url = "http://server/";
- 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 $httpBackend
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $httpBackend(method, url, data, callback, headers) {
var xhr = new MockXhr(),
expectation = expectations[0],
wasExpected = false;
Function dump
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
angular.mock.dump = function(object) {
return serialize(object);
function serialize(object) {
var out;
Function $LogProvider
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
angular.mock.$LogProvider = function() {
function concat(array1, array2, index) {
return array1.concat(Array.prototype.slice.call(array2, index));
}
Function MockXhr
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MockXhr() {
// hack for testing $http, $httpBackend
MockXhr.$$lastInstance = this;
Function $get
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.$get = function () {
var $log = {
log: function() { $log.log.logs.push(concat([], arguments, 0)); },
warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
info: function() { $log.info.logs.push(concat([], arguments, 0)); },
Function MockHttpExpectation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MockHttpExpectation(method, url, data, headers) {
this.data = data;
this.headers = headers;
Function cookies
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
cookies: function(name, value) {
if (name) {
if (value == undefined) {
delete this.cookieHash[name];
} else {
- 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 $ExceptionHandlerProvider
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
angular.mock.$ExceptionHandlerProvider = function() {
var handler;
/**
* @ngdoc method
Function serialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serialize(object) {
var out;
if (angular.isElement(object)) {
object = angular.element(object);
Function $httpBackend
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function $httpBackend(method, url, data, callback, headers) {
Avoid too many return
statements within this function. Open
return true;