NateFerrero/amna

View on GitHub

Showing 63 of 93 total issues

Function exports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (amna, log) {

    /**
     * Ensure requests fail until mongo is available
     */
Severity: Minor
Found in src/lib/mongo.js - About 1 hr to fix

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

    amna.pageAndDeleteQuery = function (self) {
        var query = {};
        var qOpts = self.req.jsonQueryOptions;

        /**
Severity: Minor
Found in src/lib/collection.js - About 1 hr to fix

    Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (amna, passport) {
        if (typeof amna.authentication.facebook !== 'function') {
            throw new Error('amna.authentication.facebook must be: function  (profile, tokens, done)');
        }
    
    
    Severity: Minor
    Found in src/lib/authentication-facebook.js - About 1 hr to fix

      Function animateSetup has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      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;
      Severity: Minor
      Found in examples/uploader/public/js/angular-animate.js - About 1 hr to fix

        Function exports has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function (amna, log) {
        
            var Route = function Route(method, url, handler) {
                this.method = method;
                this.url = url;
        Severity: Minor
        Found in src/lib/route.js - About 1 hr to fix

          Function encodeJsonSchema has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              MongooseThing.encodeJsonSchema = function (schema) {
                  var json;
          
                  if (schema && schema.ref) {
                      return {type: 'reference', thing: schema.ref};
          Severity: Minor
          Found in src/lib/thing-mongoose.js - About 1 hr to fix

            Function run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function run(fns, cancellations, allCompleteFn) {
                      var animations = [];
                      forEach(fns, function(animation) {
                        animation.fn && animations.push(animation);
                      });
            Severity: Minor
            Found in examples/uploader/public/js/angular-animate.js - About 1 hr to fix

              Function exports has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function (amna, log) {
              
                  amna.$MODULES_DIR = 'amna_modules';
              
                  amna.$modules = [];
              Severity: Minor
              Found in src/lib/registerModules.js - About 1 hr to fix

                Function uploadEnd has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                       function uploadEnd() {
                          // unbind load after uploadEnd to prevent another load triggering uploadEnd
                          iframe.unbind('load');
                          if (!scope.$$phase) {
                            scope.$apply(function() {
                Severity: Minor
                Found in examples/uploader/public/js/ng-upload.js - About 1 hr to fix

                  Function getElementAnimationDetails has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        function getElementAnimationDetails(element, cacheKey) {
                          var data = cacheKey ? lookupCache[cacheKey] : null;
                          if (!data) {
                            var transitionDuration = 0;
                            var transitionDelay = 0;
                  Severity: Minor
                  Found in examples/uploader/public/js/angular-animate.js - About 1 hr to fix

                    Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function (amna, log) {
                    
                        var Controller = function () {
                            this.$routes = [];
                        };
                    Severity: Minor
                    Found in src/lib/controller.js - About 1 hr to fix

                      Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function () {
                      
                          var Stack = function Stack() {
                              this.stack = [];
                          };
                      Severity: Minor
                      Found in src/lib/stack.js - About 1 hr to fix

                        Function save has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            DecayingSetCacheRecord.prototype.save = function (value, done, full) {
                                /**
                                 * Ensure value can be stored in JSON before continuing
                                 */
                                JSON.stringify(value);
                        Severity: Minor
                        Found in src/lib/cache.js - About 1 hr to fix

                          Function exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = function (amna, log) {
                              return function (config, done) {
                          
                                  /**
                                   * Set settings
                          Severity: Minor
                          Found in src/lib/start.js - About 1 hr to fix

                          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

                              var MongooseThing = function MongooseThing(schema) {
                                  schema.deleted = Boolean;
                                  if (amna.createdByThing) {
                                      schema.createdBy = amna.types.Ref(amna.createdByThing);
                                  }
                          Severity: Minor
                          Found in src/lib/thing-mongoose.js - About 1 hr to fix

                            Function setupCollectionPost has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var setupCollectionPost = function (collection, options) {
                                    /**
                                     * POST /collection
                                     */
                                    if (!options.readOnly && options.collectionPost !== false) {
                            Severity: Minor
                            Found in src/lib/collection.js - About 1 hr to fix

                              Function animationsDisabled has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    function animationsDisabled(element, parentElement) {
                                      if (rootAnimateState.disabled) {
                                        return true;
                                      }
                              
                              
                              Severity: Minor
                              Found in examples/uploader/public/js/angular-animate.js - About 1 hr to fix

                                Function exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                module.exports = function (amna, log) {
                                
                                    /**
                                     * Ensure requests fail until mongo is available
                                     */
                                Severity: Minor
                                Found in src/lib/mongo.js - About 1 hr to fix

                                  Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  module.exports = function (amna, passport) {
                                      if (typeof amna.authentication.google !== 'function') {
                                          throw new Error('amna.authentication.google must be: function (profile, tokens, done)');
                                      }
                                  
                                  
                                  Severity: Minor
                                  Found in src/lib/authentication-google.js - About 1 hr to fix

                                    Function read has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        DecayingSetCacheRecord.prototype.read = function (maxage, done, full) {
                                            if (typeof maxage === 'function') {
                                                done = maxage;
                                                maxage = Infinity;
                                            }
                                    Severity: Minor
                                    Found in src/lib/cache.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language