Showing 14 of 27 total issues
Function MoxBuilder
has 287 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MoxBuilder() {
var
moduleNames,
moduleFns,
File helpers-spec.js
has 566 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe('The helper functions', function () {
describe('Test helpers', function () {
beforeEach(function () {
angular.module('mox').value('x', 1).value('y', 2);
File mox-spec.js
has 556 lines of code (exceeds 250 allowed). Consider refactoring. Open
angular.extend(moxConfig, {
factory2: mox.createMock('factory2', ['methodA']),
factory3: function ($provide, mock) {
$provide.value('factory3', mock);
}
Function MoxBuilder
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
function MoxBuilder() {
var
moduleNames,
moduleFns,
- 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 requestTest
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function requestTest() {
var test = {
_httpMethod: 'GET',
_data: null
};
Function exports
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
var paths = {
src: 'src',
File mox.js
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
var moxConfig = {};
angular.module('mox', [])
.service('Mox', MoxBuilder);
var mox = angular.injector(['mox']).get('Mox');
Function requestTest
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function requestTest() {
var test = {
_httpMethod: 'GET',
_data: null
};
- 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 mockServices
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.mockServices = function mockServices() {
function getMethodNames(obj) {
var methodNames = [];
angular.forEach(obj, function (method, methodName) {
if (angular.isFunction(method)) {
Function addSelectors
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function addSelectors(element, selectors) {
function checkAndSetFn(obj, prop, fn) {
var property = obj[prop];
if (angular.isUndefined(property)) {
- 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 addSelectors
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addSelectors(element, selectors) {
function checkAndSetFn(obj, prop, fn) {
var property = obj[prop];
if (angular.isUndefined(property)) {
Function setupResults
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.setupResults = function setupResults(configFn) {
postInjectFns.push(function setupResultsFn() {
var config = configFn();
angular.forEach(config, function (mockConfig, mockName) {
var mock = mox.inject(mockName);
Function setupResultsFn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
postInjectFns.push(function setupResultsFn() {
var config = configFn();
angular.forEach(config, function (mockConfig, mockName) {
var mock = mox.inject(mockName);
if (!(mockName in mox.get)) {
Function run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
test.run = function run() {
test._response = test._response || {};
mox.inject('$httpBackend').expect(test._httpMethod, { test: validateUrl }, test._data).respond(test._response);
var response = test._method.apply(this, test._methodArguments);