wbyoung/azul

View on GitHub

Showing 52 of 52 total issues

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

  configure: function() {
    /* jshint expr: true */

    // configure each of the properties that are calculated on a delay by
    // simply invoking the property once. configure the inverse first as some
Severity: Major
Found in lib/relations/has_many_config.js and 1 other location - About 2 hrs to fix
lib/relations/belongs_to_config.js on lines 43..57

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

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

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

  configure: function() {
    /* jshint expr: true */

    // configure each of the properties that are calculated on a delay by
    // simply invoking the property once. configure the inverse first as some
Severity: Major
Found in lib/relations/belongs_to_config.js and 1 other location - About 2 hrs to fix
lib/relations/has_many_config.js on lines 43..57

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

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

Function _execute has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _execute: Promise.method(function(fn, schema, options) {
    var opts = _.defaults({}, options, {
      changable: false,
      reverse: false,
    });
Severity: Minor
Found in lib/migration.js - About 1 hr to fix

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

    var override = function(fn) {
      return function() {
        if (this._model) { return fn.apply(this, arguments); }
        else { return this._super.apply(this, arguments); }
      };
    Severity: Major
    Found in lib/query/mixins/bound_transform.js and 1 other location - About 1 hr to fix
    lib/query/mixins/bound_auto_join.js on lines 19..24

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

    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 override = function(fn) {
      return function() {
        if (this._model) { return fn.apply(this, arguments); }
        else { return this._super.apply(this, arguments); }
      };
    Severity: Major
    Found in lib/query/mixins/bound_auto_join.js and 1 other location - About 1 hr to fix
    lib/query/mixins/bound_transform.js on lines 31..36

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

    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 (inverseRelation && primaryKey && primaryKey !== inversePrimaryKey) {
          throw new Error(util.format('%s.%s primary key must equal %j ' +
            'specified by %s.%s relation',
            this._modelClass.__identity__.__name__, this._name,
            inverseRelation.primaryKey,
    Severity: Major
    Found in lib/relations/belongs_to_config.js and 1 other location - About 1 hr to fix
    lib/relations/has_many_config.js on lines 174..181

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

    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 (foreignKey !== inverseForeignKey) {
            throw new Error(util.format('%s.%s foreign key must equal %j ' +
              'specified by %s.%s relation',
              this._modelClass.__identity__.__name__, this._name,
              inverseRelation.foreignKey,
    Severity: Major
    Found in lib/relations/has_many_config.js and 1 other location - About 1 hr to fix
    lib/relations/belongs_to_config.js on lines 142..149

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

    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

    Inflection.prototype.singular = function(rule, replacement) {
      this._singular.unshift({
        regex: this._regex(rule),
        replacement: replacement,
      });
    Severity: Major
    Found in lib/util/inflection.js and 1 other location - About 1 hr to fix
    lib/util/inflection.js on lines 28..33

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

    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

    Inflection.prototype.plural = function(rule, replacement) {
      this._plural.unshift({
        regex: this._regex(rule),
        replacement: replacement,
      });
    Severity: Major
    Found in lib/util/inflection.js and 1 other location - About 1 hr to fix
    lib/util/inflection.js on lines 44..49

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

    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

      init: function() {
        this._super.apply(this, arguments);
        this._objectsQueryCacheKey =
          '_' + _.camelCase(this._name + '_objectsQueryCache');
      },
    Severity: Major
    Found in lib/relations/has_many_query.js and 1 other location - About 1 hr to fix
    lib/relations/has_many_in_flight.js on lines 17..21

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

    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

      init: function() {
        this._super.apply(this, arguments);
        this._inFlightDataKey =
          '_' + _.camelCase(this._name + '_objectsInFlight');
      },
    Severity: Major
    Found in lib/relations/has_many_in_flight.js and 1 other location - About 1 hr to fix
    lib/relations/has_many_query.js on lines 35..39

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

    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

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

    module.exports = function(env) {
    
      var action = {};
    
      /**
    Severity: Minor
    Found in lib/cli/index.js - About 1 hr to fix

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

        _unionCollectionCache: function(instance, objects) {
          var value = instance[this._collectionCacheKey];
          if (value) {
            this._setCollectionCache(instance, _.union(value, objects));
          }
      Severity: Major
      Found in lib/relations/has_many_collection.js and 1 other location - About 1 hr to fix
      lib/relations/has_many_collection.js on lines 97..102

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

      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

        _differenceCollectionCache: function(instance, objects) {
          var value = instance[this._collectionCacheKey];
          if (value) {
            this._setCollectionCache(instance, _.difference(value, objects));
          }
      Severity: Major
      Found in lib/relations/has_many_collection.js and 1 other location - About 1 hr to fix
      lib/relations/has_many_collection.js on lines 82..87

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

      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

      Function _saveQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        _saveQuery: function(options) {
          if (this.inFlight) {
            throw new Error(util.format(
              'Cannot save %s while another save is in flight.',
              this.__identity__.__name__));
      Severity: Minor
      Found in lib/model/model.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 _saveQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _saveQuery: function(options) {
          if (this.inFlight) {
            throw new Error(util.format(
              'Cannot save %s while another save is in flight.',
              this.__identity__.__name__));
      Severity: Minor
      Found in lib/model/model.js - About 1 hr to fix

        Function prefetch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          prefetch: Promise.method(function(instances) {
            if (instances.length === 0) { return {}; }
        
            var self = this;
            var queryKey = this.primaryKey;
        Severity: Minor
        Found in lib/relations/belongs_to_prefetch.js - About 1 hr to fix

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

          module.exports.rollback = function(azulfile, options) {
            return runMigrator('rollback', azulfile, options, {
              intro: 'Rolling back',
              action: 'Rollback',
              none: 'Nothing to rollback, you are at the beginning',
          Severity: Minor
          Found in lib/cli/actions.js and 1 other location - About 50 mins to fix
          lib/cli/actions.js on lines 58..64

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

          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

          module.exports.migrate = function(azulfile, options) {
            return runMigrator('migrate', azulfile, options, {
              intro: 'Applying',
              action: 'Migration',
              none: 'Migrations are up-to-date',
          Severity: Minor
          Found in lib/cli/actions.js and 1 other location - About 50 mins to fix
          lib/cli/actions.js on lines 73..79

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

          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

          Function _execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            _execute: Promise.method(function(fn, schema, options) {
              var opts = _.defaults({}, options, {
                changable: false,
                reverse: false,
              });
          Severity: Minor
          Found in lib/migration.js - About 45 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