Showing 63 of 93 total issues
Function exports
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (amna, log) {
/**
* Ensure requests fail until mongo is available
*/
- 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 pageAndDeleteQuery
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
amna.pageAndDeleteQuery = function (self) {
var query = {};
var qOpts = self.req.jsonQueryOptions;
/**
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (amna, passport) {
if (typeof amna.authentication.facebook !== 'function') {
throw new Error('amna.authentication.facebook must be: function (profile, tokens, done)');
}
Function animateSetup
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function animateSetup(animationEvent, element, className, styles) {
var structural = ['ng-enter','ng-leave','ng-move'].indexOf(className) >= 0;
var cacheKey = getCacheKey(element);
var eventCacheKey = cacheKey + ' ' + className;
Function exports
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (amna, log) {
var Route = function Route(method, url, handler) {
this.method = method;
this.url = url;
Function encodeJsonSchema
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MongooseThing.encodeJsonSchema = function (schema) {
var json;
if (schema && schema.ref) {
return {type: 'reference', thing: schema.ref};
Function run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function run(fns, cancellations, allCompleteFn) {
var animations = [];
forEach(fns, function(animation) {
animation.fn && animations.push(animation);
});
Function exports
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (amna, log) {
amna.$MODULES_DIR = 'amna_modules';
amna.$modules = [];
Function uploadEnd
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function uploadEnd() {
// unbind load after uploadEnd to prevent another load triggering uploadEnd
iframe.unbind('load');
if (!scope.$$phase) {
scope.$apply(function() {
Function getElementAnimationDetails
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getElementAnimationDetails(element, cacheKey) {
var data = cacheKey ? lookupCache[cacheKey] : null;
if (!data) {
var transitionDuration = 0;
var transitionDelay = 0;
Function exports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (amna, log) {
var Controller = function () {
this.$routes = [];
};
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function () {
var Stack = function Stack() {
this.stack = [];
};
Function save
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
DecayingSetCacheRecord.prototype.save = function (value, done, full) {
/**
* Ensure value can be stored in JSON before continuing
*/
JSON.stringify(value);
Function exports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (amna, log) {
return function (config, done) {
/**
* Set settings
- 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 MongooseThing
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var MongooseThing = function MongooseThing(schema) {
schema.deleted = Boolean;
if (amna.createdByThing) {
schema.createdBy = amna.types.Ref(amna.createdByThing);
}
Function setupCollectionPost
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var setupCollectionPost = function (collection, options) {
/**
* POST /collection
*/
if (!options.readOnly && options.collectionPost !== false) {
Function animationsDisabled
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function animationsDisabled(element, parentElement) {
if (rootAnimateState.disabled) {
return true;
}
Function exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (amna, log) {
/**
* Ensure requests fail until mongo is available
*/
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (amna, passport) {
if (typeof amna.authentication.google !== 'function') {
throw new Error('amna.authentication.google must be: function (profile, tokens, done)');
}
Function read
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
DecayingSetCacheRecord.prototype.read = function (maxage, done, full) {
if (typeof maxage === 'function') {
done = maxage;
maxage = Infinity;
}