NateFerrero/amna

View on GitHub

Showing 93 of 93 total issues

File angular-animate.js has 1106 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license AngularJS v1.3.15
 * (c) 2010-2014 Google, Inc. http://angularjs.org
 * License: MIT
 */
Severity: Major
Found in examples/uploader/public/js/angular-animate.js - About 2 days to fix

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

    module.exports = function (amna) {
    
        amna.mongoId = function (param) {
            return ':' + param + '([0-9a-f]{24})';
        };
    Severity: Major
    Found in src/lib/collection.js - About 1 day to fix

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

      module.exports = function (amna) {
      
          amna.mongoId = function (param) {
              return ':' + param + '([0-9a-f]{24})';
          };
      Severity: Minor
      Found in src/lib/collection.js - About 1 day 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 performAnimation has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, options, doneCallback) {
              var noopCancel = noop;
              var runner = animationRunner(element, animationEvent, className, options);
              if (!runner) {
                fireDOMOperation();
      Severity: Major
      Found in examples/uploader/public/js/angular-animate.js - About 6 hrs to fix

        Function animationRunner has 144 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              function animationRunner(element, animationEvent, className, options) {
                //transcluded directives may sometimes fire an animation using only comment nodes
                //best to catch this early on to prevent any animation operations from occurring
                var node = element[0];
                if (!node) {
        Severity: Major
        Found in examples/uploader/public/js/angular-animate.js - About 5 hrs to fix

          Function phase_1 has 139 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function phase_1(amna, log) {
          
              var AMNACache = amna.thing.mongoose({
                  key: {
                      type: String,
          Severity: Major
          Found in src/lib/cache.js - About 5 hrs to fix

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

            module.exports = function (amna) {
            
                var MongooseThing = function MongooseThing(schema) {
                    schema.deleted = Boolean;
                    if (amna.createdByThing) {
            Severity: Major
            Found in src/lib/thing-mongoose.js - About 5 hrs to fix

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

              module.exports = function (amna, log) {
              
                  var queryJSON = function (data) {
                      return '?' + encodeURIComponent(JSON.stringify(data));
                  };
              Severity: Major
              Found in src/lib/authentication.js - About 5 hrs to fix

                Function animateRun has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function animateRun(animationEvent, element, className, activeAnimationComplete, styles) {
                        var node = extractElementNode(element);
                        var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);
                        if (node.getAttribute('class').indexOf(className) == -1 || !elementData) {
                          activeAnimationComplete();
                Severity: Major
                Found in examples/uploader/public/js/angular-animate.js - About 4 hrs to fix

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

                  module.exports = function (amna, log) {
                  
                      var queryJSON = function (data) {
                          return '?' + encodeURIComponent(JSON.stringify(data));
                      };
                  Severity: Minor
                  Found in src/lib/authentication.js - About 4 hrs 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 exports has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function (amna) {
                  
                      var MongooseThing = function MongooseThing(schema) {
                          schema.deleted = Boolean;
                          if (amna.createdByThing) {
                  Severity: Minor
                  Found in src/lib/thing-mongoose.js - About 4 hrs 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 link has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        link: function (scope, element, attrs) {
                          // Give each directive instance a new id
                          iframeID++;
                  
                          function setLoadingState(state) {
                  Severity: Major
                  Found in examples/uploader/public/js/ng-upload.js - About 4 hrs to fix

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

                    module.exports = function (amna, log) {
                    
                        var Interaction = function (req, res, next, done) {
                            this.req = req;
                            this.res = res;
                    Severity: Major
                    Found in src/lib/interaction.js - About 3 hrs to fix

                      Function $auth has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          amna.$auth = function (done) {
                              defaults();
                              setupAuth();
                      
                              amna.$passport = passport;
                      Severity: Major
                      Found in src/lib/authentication.js - About 3 hrs to fix

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

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

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

                          module.exports = function (amna, log) {
                          
                              var Interaction = function (req, res, next, done) {
                                  this.req = req;
                                  this.res = res;
                          Severity: Minor
                          Found in src/lib/interaction.js - About 2 hrs 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 exports has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function (amna, log) {
                              var app = express();
                              app.use(bodyParser.urlencoded({ extended: true }));
                              app.use(bodyParser.json());
                              app.use(methodOverride('_method'));
                          Severity: Major
                          Found in src/lib/$express.js - About 2 hrs to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                        doc.save(function (err) {
                                            if (err) {
                                                log('<fail> save key', this.key, err);
                                                return done(err);
                                            }
                            Severity: Major
                            Found in src/lib/cache.js and 1 other location - About 2 hrs to fix
                            src/lib/cache.js on lines 158..165

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 82.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 3 locations. Consider refactoring.
                            Open

                                var setupCollectionPut = function (collection, options) {
                                    /**
                                     * PUT /collection
                                     */
                                    if (!options.readOnly && options.collectionPut !== false) {
                            Severity: Major
                            Found in src/lib/collection.js and 2 other locations - About 2 hrs to fix
                            src/lib/collection.js on lines 205..214
                            src/lib/collection.js on lines 227..236

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 82.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 3 locations. Consider refactoring.
                            Open

                                var setupCollectionDelete = function (collection, options) {
                                    /**
                                     * DELETE /collection
                                     */
                                    if (!options.readOnly && options.collectionDelete !== false) {
                            Severity: Major
                            Found in src/lib/collection.js and 2 other locations - About 2 hrs to fix
                            src/lib/collection.js on lines 194..203
                            src/lib/collection.js on lines 227..236

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 82.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language