balderdashy/waterline

View on GitHub

Showing 156 of 357 total issues

Avoid too many return statements within this function.
Open

    return true;
Severity: Major
Found in lib/waterline/utils/system/has-schema-check.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              } catch (e) { return done(e); }
    Severity: Major
    Found in lib/waterline/methods/update.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return res.status(200).json(updatedUsers[0]);
      Severity: Major
      Found in example/express/express-example.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        } catch (e) { return proceed(e); }
        Severity: Major
        Found in lib/waterline/methods/destroy.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return connection.adapter.schema;
          Severity: Major
          Found in lib/waterline/utils/system/has-schema-check.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    } catch (e) { return done(e); }
            Severity: Major
            Found in lib/waterline/methods/destroy.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return proceed(undefined, transformedRecords);
              Severity: Major
              Found in lib/waterline/methods/destroy.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return done(undefined, populatedRecords);
                Severity: Major
                Found in lib/waterline/utils/query/help-find.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return true;
                  Severity: Major
                  Found in lib/waterline/utils/ontology/is-exclusive.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              } catch (e) { return done(e); }
                    Severity: Major
                    Found in lib/waterline/methods/update.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                } catch (e) { return done(e); }
                      Severity: Major
                      Found in lib/waterline/methods/create.js - About 30 mins to fix

                        Function find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = function find( /* criteria?, populates?, explicitCbMaybe?, meta? */ ) {
                        
                          // Verify `this` refers to an actual Sails/Waterline model.
                          verifyModelMethodContext(this);
                        
                        
                        Severity: Minor
                        Found in lib/waterline/methods/find.js - About 25 mins 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 eachBatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          eachBatch: function(batchSizeOrIteratee, iteratee) {
                            assert(this._wlQueryInfo.method === 'stream', 'Cannot chain `.eachBatch()` onto the `.'+this._wlQueryInfo.method+'()` method.  The `.eachBatch()` method is only chainable to `.stream()`.  (In fact, this shouldn\'t even be possible!  So the fact that you are seeing this message at all is, itself, likely due to a bug in Waterline.)');
                        
                            if (arguments.length > 2) {
                              throw new Error('Invalid usage for `.eachBatch()` -- no more than 2 arguments should be passed in.');
                        Severity: Minor
                        Found in lib/waterline/utils/query/get-query-modifier-methods.js - About 25 mins 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 populate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          populate: function(keyName, subcriteria) {
                        
                            assert(this._wlQueryInfo.method === 'find' || this._wlQueryInfo.method === 'findOne' || this._wlQueryInfo.method === 'stream', 'Cannot chain `.populate()` onto the `.'+this._wlQueryInfo.method+'()` method.  (In fact, this shouldn\'t even be possible!  So the fact that you are seeing this message at all is, itself, likely due to a bug in Waterline.)');
                        
                            // Backwards compatibility for arrays passed in as `keyName`.
                        Severity: Minor
                        Found in lib/waterline/utils/query/get-query-modifier-methods.js - About 25 mins 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 findOne has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = function findOne( /* criteria?, populates?, explicitCbMaybe?, meta? */ ) {
                        
                          // Verify `this` refers to an actual Sails/Waterline model.
                          verifyModelMethodContext(this);
                        
                        
                        Severity: Minor
                        Found in lib/waterline/methods/find-one.js - About 25 mins 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 normalizePkValueOrValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = function normalizePkValueOrValues (pkValueOrPkValues, expectedPkType){
                        
                          // Check usage
                          if (expectedPkType !== 'string' && expectedPkType !== 'number') {
                            throw new Error('Consistency violation: The internal normalizePkValueOrValues() utility must always be called with a valid second argument ("string" or "number").  But instead, got: '+util.inspect(expectedPkType, {depth:5})+'');
                        Severity: Minor
                        Found in lib/waterline/utils/query/private/normalize-pk-value-or-values.js - About 25 mins 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

                        Severity
                        Category
                        Status
                        Source
                        Language