balderdashy/waterline

View on GitHub
lib/waterline/utils/query/get-query-modifier-methods.js

Summary

Maintainability
F
6 days
Test Coverage

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 paginate has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      paginate: function(pageNumOrOpts, pageSize) {
    
        if (!this._alreadyInitiallyExpandedCriteria) {
          this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
          this._alreadyInitiallyExpandedCriteria = true;
    Severity: Major
    Found in lib/waterline/utils/query/get-query-modifier-methods.js - About 2 hrs to fix

      Function paginate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        paginate: function(pageNumOrOpts, pageSize) {
      
          if (!this._alreadyInitiallyExpandedCriteria) {
            this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
            this._alreadyInitiallyExpandedCriteria = true;
      Severity: Minor
      Found in lib/waterline/utils/query/get-query-modifier-methods.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 populate has 31 lines of code (exceeds 25 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 1 hr to fix

        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

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

        var DECRYPT_Q_METHODS = {
        
        
          /**
           * Add `decrypt: true` to the query's `meta`.
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 1 other location - About 4 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 517..544

        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 116.

        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 2 locations. Consider refactoring.
        Open

        var FETCH_Q_METHODS = {
        
        
          /**
           * Add `fetch: true` to the query's `meta`.
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 1 other location - About 4 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 548..576

        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 116.

        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 5 locations. Consider refactoring.
        Open

          sum: function() {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 4 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 623..633
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 644..654
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 664..674
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 682..692

        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 93.

        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 5 locations. Consider refactoring.
        Open

          min: function() {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 4 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 603..613
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 623..633
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 664..674
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 682..692

        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 93.

        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 5 locations. Consider refactoring.
        Open

          max: function() {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 4 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 603..613
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 623..633
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 644..654
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 682..692

        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 93.

        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 5 locations. Consider refactoring.
        Open

          avg: function() {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 4 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 603..613
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 644..654
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 664..674
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 682..692

        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 93.

        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 5 locations. Consider refactoring.
        Open

          groupBy: function() {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 4 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 603..613
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 623..633
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 644..654
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 664..674

        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 93.

        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 6 locations. Consider refactoring.
        Open

          where: function(whereCriteria) {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 5 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 274..284
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 293..303
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 432..442
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 457..467
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 475..485

        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 90.

        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 6 locations. Consider refactoring.
        Open

          skip: function(skip) {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 5 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 274..284
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 432..442
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 457..467
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 475..485
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 501..511

        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 90.

        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 6 locations. Consider refactoring.
        Open

          limit: function(limit) {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 5 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 293..303
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 432..442
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 457..467
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 475..485
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 501..511

        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 90.

        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 6 locations. Consider refactoring.
        Open

          select: function(selectAttributes) {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 5 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 274..284
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 293..303
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 432..442
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 475..485
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 501..511

        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 90.

        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 6 locations. Consider refactoring.
        Open

          omit: function(omitAttributes) {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 5 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 274..284
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 293..303
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 432..442
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 457..467
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 501..511

        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 90.

        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 6 locations. Consider refactoring.
        Open

          sort: function(sortClause) {
        
            if (!this._alreadyInitiallyExpandedCriteria) {
              this._wlQueryInfo.criteria = expandWhereShorthand(this._wlQueryInfo.criteria);
              this._alreadyInitiallyExpandedCriteria = true;
        Severity: Major
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 5 other locations - About 2 hrs to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 274..284
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 293..303
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 457..467
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 475..485
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 501..511

        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 90.

        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 2 locations. Consider refactoring.
        Open

            if (this._wlQueryInfo.method === 'create') {
              console.warn(
                'Deprecation warning: In future versions of Waterline, the use of .set() with .create()\n'+
                'will no longer be supported.  In the past, you could use .set() to provide the initial\n'+
                'skeleton of a new record to create (like `.create().set({})`)-- but really .set() should\n'+
        Severity: Minor
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 1 other location - About 35 mins to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 132..144

        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 46.

        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 2 locations. Consider refactoring.
        Open

            else if (this._wlQueryInfo.method === 'createEach') {
              console.warn(
                'Deprecation warning: In future versions of Waterline, the use of .set() with .createEach()\n'+
                'will no longer be supported.  In the past, you could use .set() to provide an array of\n'+
                'new records to create (like `.createEach().set([{}, {}])`)-- but really .set() was designed\n'+
        Severity: Minor
        Found in lib/waterline/utils/query/get-query-modifier-methods.js and 1 other location - About 35 mins to fix
        lib/waterline/utils/query/get-query-modifier-methods.js on lines 122..144

        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 46.

        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

        There are no issues that match your filters.

        Category
        Status