Showing 36 of 36 total issues

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

module.exports = function(priv, opts) {
  return function *save() {
    if (this.id && utils.empty(this.json(true))) {
      // nothing to update
      return this;
Severity: Minor
Found in lib/yamb/proto/methods/save.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

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

module.exports = function(priv) {
  var setter = function(title) {
    if (!utils.is.str(title)) {
      return;
    }
Severity: Major
Found in lib/yamb/proto/props/title.js and 1 other location - About 6 hrs to fix
lib/yamb/proto/props/cover.js on lines 11..31

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

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 = function(priv) {
  var setter = function(image) {
    if (!utils.is.str(image)) {
      return;
    }
Severity: Major
Found in lib/yamb/proto/props/cover.js and 1 other location - About 6 hrs to fix
lib/yamb/proto/props/title.js on lines 11..31

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

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 a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(priv, options) {
  var getter = function() {
    if (!utils.is.obj(this[priv.cache][options.name])) {
      this[priv.cache][options.name] = Object.defineProperties({}, descriptors(priv, this, options));
    }
Severity: Minor
Found in lib/yamb/proto/virtual.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 25 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(priv) {
  var facility = function(relate) {
    return utils.is.yamb(relate) && relate[priv.symbl].id;
  };

Severity: Minor
Found in lib/yamb/proto/props/related.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 exports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(opts) {
  var props = require('./proto/props')(priv, opts);

  var yamb = function Yamb(params) {
    this[priv.shado] = utils.clone(schema);
Severity: Minor
Found in lib/yamb/index.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 exports has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(priv, opts) {
  return function *save() {
    if (this.id && utils.empty(this.json(true))) {
      // nothing to update
      return this;
Severity: Major
Found in lib/yamb/proto/methods/save.js - About 3 hrs to fix

    Function save has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      return function *save() {
        if (this.id && utils.empty(this.json(true))) {
          // nothing to update
          return this;
        }
    Severity: Major
    Found in lib/yamb/proto/methods/save.js - About 3 hrs to fix

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

      module.exports = function(priv, options) {
        var getter = function() {
          if (!utils.is.obj(this[priv.cache][options.name])) {
            this[priv.cache][options.name] = Object.defineProperties({}, descriptors(priv, this, options));
          }
      Severity: Major
      Found in lib/yamb/proto/virtual.js - About 2 hrs to fix

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

        module.exports = function(priv) {
          var getter = function() {
            if (!utils.is.obj(this[priv.cache].stats)) {
              this[priv.cache].stats = Object.defineProperties({}, descriptors(priv, this));
            }
        Severity: Minor
        Found in lib/yamb/proto/props/stats.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 exports has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(opts) {
          if (!opts.storage) {
            // TODO: fix error message
            throw new Error('error with storage');
          }
        Severity: Minor
        Found in lib/index.js - About 1 hr to fix

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

          module.exports = function(priv) {
            var facility = function(relate) {
              return utils.is.yamb(relate) && relate[priv.symbl].id;
            };
          
          
          Severity: Minor
          Found in lib/yamb/proto/props/related.js - About 1 hr to fix

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

            module.exports = function(opts) {
              if (!opts.storage) {
                // TODO: fix error message
                throw new Error('error with storage');
              }
            Severity: Minor
            Found in lib/index.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

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

            var validate = function(value) {
              return utils.is.date(value) || (utils.is.str(value) && utils.is.date(new Date(value)));
            };
            Severity: Major
            Found in lib/yamb/proto/props/created.js and 1 other location - About 1 hr to fix
            lib/yamb/proto/props/publish.js on lines 19..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 66.

            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 validate = function(value) {
              return utils.is.date(value) || (utils.is.str(value) && utils.is.date(new Date(value)));
            };
            Severity: Major
            Found in lib/yamb/proto/props/publish.js and 1 other location - About 1 hr to fix
            lib/yamb/proto/props/created.js on lines 7..9

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

            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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function(priv, opts) {
              return function *similar(all) {
                if (!this.id || utils.empty(this.related)) {
                  return [];
                }
            Severity: Minor
            Found in lib/yamb/proto/methods/similar.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 exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(opts) {
              var props = require('./proto/props')(priv, opts);
            
              var yamb = function Yamb(params) {
                this[priv.shado] = utils.clone(schema);
            Severity: Minor
            Found in lib/yamb/index.js - About 1 hr to fix

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

              module.exports = function(priv) {
                var getter = function() {
                  if (!utils.is.obj(this[priv.cache].stats)) {
                    this[priv.cache].stats = Object.defineProperties({}, descriptors(priv, this));
                  }
              Severity: Minor
              Found in lib/yamb/proto/props/stats.js - About 1 hr to fix

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

                module.exports = function(priv) {
                  var getter = function() {
                    return utils.clone(this[priv.symbl].tags);
                  };
                
                
                Severity: Minor
                Found in lib/yamb/proto/props/tags.js - About 1 hr to fix

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

                  module.exports = function(priv) {
                    var getter = function() {
                      return utils.clone(this[priv.symbl].tags);
                    };
                  
                  
                  Severity: Minor
                  Found in lib/yamb/proto/props/tags.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

                  Severity
                  Category
                  Status
                  Source
                  Language