balderdashy/waterline

View on GitHub

Showing 156 of 357 total issues

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

module.exports = function findOne( /* criteria?, populates?, explicitCbMaybe?, meta? */ ) {

  // Verify `this` refers to an actual Sails/Waterline model.
  verifyModelMethodContext(this);

Severity: Major
Found in lib/waterline/methods/find-one.js - About 4 hrs to fix

    Function _afterPotentiallyLookingUpRecordsToCascade has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            })(function _afterPotentiallyLookingUpRecordsToCascade(err, idsOfRecordsBeingDestroyedMaybe) {
              if (err) { return done(err); }
    
    
              // Now we'll actually perform the `destroy`.
    Severity: Major
    Found in lib/waterline/methods/destroy.js - About 4 hrs to fix

      Function _beginBatchMaybe has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function _beginBatchMaybe(next) {
      
              // 0   => 15
              // 15  => 15
              // 30  => 15
      Severity: Major
      Found in lib/waterline/methods/stream.js - About 4 hrs to fix

        Function _afterTalkingToAdapter has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  adapter.destroy(WLModel.datastore, query, function _afterTalkingToAdapter(err, rawAdapterResult) {
                    if (err) {
                      err = forgeAdapterError(err, omen, 'destroy', modelIdentity, orm);
                      return done(err);
                    }//-•
        Severity: Major
        Found in lib/waterline/methods/destroy.js - About 4 hrs to fix

          File get-query-modifier-methods.js has 348 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * Module dependencies
           */
          
          var assert = require('assert');
          Severity: Minor
          Found in lib/waterline/utils/query/get-query-modifier-methods.js - About 4 hrs to fix

            Function avg has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function avg( /* numericAttrName?, criteria?, explicitCbMaybe?, meta?, moreQueryKeys? */ ) {
            
              // Verify `this` refers to an actual Sails/Waterline model.
              verifyModelMethodContext(this);
            
            
            Severity: Major
            Found in lib/waterline/methods/avg.js - About 4 hrs to fix

              File help-find.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * Module dependencies
               */
              
              var util = require('util');
              Severity: Minor
              Found in lib/waterline/utils/query/help-find.js - About 4 hrs to fix

                Function customizations has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var customizations = (function(){
                
                      //  ███╗   ██╗ ██████╗ ████████╗     █████╗ ███╗   ██╗    ███████╗██████╗ ██████╗  ██████╗ ██████╗
                      //  ████╗  ██║██╔═══██╗╚══██╔══╝    ██╔══██╗████╗  ██║    ██╔════╝██╔══██╗██╔══██╗██╔═══██╗██╔══██╗
                      //  ██╔██╗ ██║██║   ██║   ██║       ███████║██╔██╗ ██║    █████╗  ██████╔╝██████╔╝██║   ██║██████╔╝
                Severity: Major
                Found in lib/waterline/utils/query/forge-adapter-error.js - About 4 hrs to fix

                  Function find has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function find( /* criteria?, populates?, explicitCbMaybe?, meta? */ ) {
                  
                    // Verify `this` refers to an actual Sails/Waterline model.
                    verifyModelMethodContext(this);
                  
                  
                  Severity: Major
                  Found in lib/waterline/methods/find.js - About 3 hrs to fix

                    Function normalizeComparisonValue has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function normalizeComparisonValue (value, attrName, modelIdentity, orm){
                      if (!_.isString(attrName)) { throw new Error('Consistency violation: This internal utility must always be called with a valid second argument (the attribute name).  But instead, got: '+util.inspect(attrName, {depth:5})+''); }
                      if (!_.isString(modelIdentity)) { throw new Error('Consistency violation: This internal utility must always be called with a valid third argument (the model identity).  But instead, got: '+util.inspect(modelIdentity, {depth:5})+''); }
                      if (!_.isObject(orm)) { throw new Error('Consistency violation: This internal utility must always be called with a valid fourth argument (the orm instance).  But instead, got: '+util.inspect(orm, {depth:5})+''); }
                    
                    
                    Severity: Minor
                    Found in lib/waterline/utils/query/private/normalize-comparison-value.js - About 3 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 sum has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function sum( /* numericAttrName?, criteria?, explicitCbMaybe?, meta?, moreQueryKeys? */ ) {
                    
                      // Verify `this` refers to an actual Sails/Waterline model.
                      verifyModelMethodContext(this);
                    
                    
                    Severity: Major
                    Found in lib/waterline/methods/sum.js - About 3 hrs to fix

                      Function archive has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function archive(/* criteria, explicitCbMaybe, metaContainer */) {
                      
                        // Verify `this` refers to an actual Sails/Waterline model.
                        verifyModelMethodContext(this);
                      
                      
                      Severity: Major
                      Found in lib/waterline/methods/archive.js - About 3 hrs to fix

                        Function _afterPotentiallyRunningBeforeLC has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              })(function _afterPotentiallyRunningBeforeLC(err, query) {
                                if (err) {
                                  return done(err);
                                }
                        
                        
                        Severity: Major
                        Found in lib/waterline/methods/create.js - About 3 hrs to fix

                          Function helpFind has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = function helpFind(WLModel, s2q, omen, done) {
                          
                            if (!_.isFunction(done)) {
                              throw new Error('Consistency violation: `done` (4th argument) should be a function');
                            }
                          Severity: Minor
                          Found in lib/waterline/utils/query/help-find.js - About 3 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 findOrCreate has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function findOrCreate( /* criteria?, newRecord?, explicitCbMaybe?, meta? */ ) {
                          
                            // Verify `this` refers to an actual Sails/Waterline model.
                            verifyModelMethodContext(this);
                          
                          
                          Severity: Major
                          Found in lib/waterline/methods/find-or-create.js - About 3 hrs to fix

                            File normalize-value-to-set.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /**
                             * Module dependencies
                             */
                            
                            var util = require('util');
                            Severity: Minor
                            Found in lib/waterline/utils/query/private/normalize-value-to-set.js - About 3 hrs to fix

                              Function updateOne has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = function updateOne(criteria, valuesToSet, explicitCbMaybe, metaContainer) {
                              
                                // Verify `this` refers to an actual Sails/Waterline model.
                                verifyModelMethodContext(this);
                              
                              
                              Severity: Major
                              Found in lib/waterline/methods/update-one.js - About 3 hrs to fix

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

                                  }) (function _afterGettingPopulatedPhysicalRecords (err, populatedRecords){
                                
                                    if (err) { return done(err); }
                                
                                    //
                                Severity: Major
                                Found in lib/waterline/utils/query/help-find.js - About 3 hrs to fix

                                  Function _makeCallOrCallsToAppropriateIteratee has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                            (function _makeCallOrCallsToAppropriateIteratee(proceed){
                                  
                                              // Check if the iteratee declares a callback parameter
                                              var seemsToExpectCallback = (function(){
                                                var fn = query.eachBatchFn || query.eachRecordFn;
                                  Severity: Major
                                  Found in lib/waterline/methods/stream.js - About 3 hrs to fix

                                    Function normalizeComparisonValue has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    module.exports = function normalizeComparisonValue (value, attrName, modelIdentity, orm){
                                      if (!_.isString(attrName)) { throw new Error('Consistency violation: This internal utility must always be called with a valid second argument (the attribute name).  But instead, got: '+util.inspect(attrName, {depth:5})+''); }
                                      if (!_.isString(modelIdentity)) { throw new Error('Consistency violation: This internal utility must always be called with a valid third argument (the model identity).  But instead, got: '+util.inspect(modelIdentity, {depth:5})+''); }
                                      if (!_.isObject(orm)) { throw new Error('Consistency violation: This internal utility must always be called with a valid fourth argument (the orm instance).  But instead, got: '+util.inspect(orm, {depth:5})+''); }
                                    
                                    
                                    Severity: Major
                                    Found in lib/waterline/utils/query/private/normalize-comparison-value.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language