Kenspeckled/oomph

View on GitHub

Showing 11 of 11 total issues

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

          } else if (validationSetting.hasOwnProperty('minimum')) {
            if (!(attrValue.length >= validationSetting.minimum)) {
              validations.push(new ValidationError(attrName + " should have a minimum length of " + validationSetting.minimum, {
                attribute: attrName,
                actual: attrValue.length,
Severity: Major
Found in lib/validate.js and 1 other location - About 2 hrs to fix
lib/validate.js on lines 110..120

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

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 (validationSetting.hasOwnProperty('maximum')) {
            if (!(attrValue.length <= validationSetting.maximum)) {
              validations.push(new ValidationError(attrName + " should have a maximum length of " + validationSetting.maximum, {
                attribute: attrName,
                actual: attrValue.length,
Severity: Major
Found in lib/validate.js and 1 other location - About 2 hrs to fix
lib/validate.js on lines 102..120

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

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

    createClass: function(name, classAttributes) {
      var _class;
      _class = function(props) {
        var property;
        for (property in props) {
Severity: Minor
Found in lib/oomph.js - About 1 hr to fix

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

            case 'lessThan':
              if (!(attrValue < validationSetting)) {
                validations.push(new ValidationError(attrName + " should be less than " + validationSetting, {
                  attribute: attrName,
                  actual: attrValue,
    Severity: Major
    Found in lib/validate.js and 3 other locations - About 1 hr to fix
    lib/validate.js on lines 48..56
    lib/validate.js on lines 57..65
    lib/validate.js on lines 66..74

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

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

            case 'lessThanOrEqualTo':
              if (!(attrValue <= validationSetting)) {
                validations.push(new ValidationError(attrName + " should be less than or equal to " + validationSetting, {
                  attribute: attrName,
                  actual: attrValue,
    Severity: Major
    Found in lib/validate.js and 3 other locations - About 1 hr to fix
    lib/validate.js on lines 39..47
    lib/validate.js on lines 57..65
    lib/validate.js on lines 66..74

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

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

            case 'greaterThan':
              if (!(attrValue > validationSetting)) {
                validations.push(new ValidationError(attrName + " should be greater than " + validationSetting, {
                  attribute: attrName,
                  actual: attrValue,
    Severity: Major
    Found in lib/validate.js and 3 other locations - About 1 hr to fix
    lib/validate.js on lines 39..47
    lib/validate.js on lines 48..56
    lib/validate.js on lines 57..65

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

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

            case 'greaterThanOrEqualTo':
              if (!(attrValue >= validationSetting)) {
                validations.push(new ValidationError(attrName + " should be greater than or equal to " + validationSetting, {
                  attribute: attrName,
                  actual: attrValue,
    Severity: Major
    Found in lib/validate.js and 3 other locations - About 1 hr to fix
    lib/validate.js on lines 39..47
    lib/validate.js on lines 48..56
    lib/validate.js on lines 66..74

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

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

        createClass: function(name, args) {
          var _class, property;
          _class = function() {
            this.name = name;
            this.initialize.apply(this, arguments);
    Severity: Minor
    Found in lib/index.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                  if (!(attrValue.length >= validationSetting.minimum)) {
                    validations.push(new ValidationError(attrName + " should have a minimum length of " + validationSetting.minimum, {
                      attribute: attrName,
                      actual: attrValue.length,
                      expected: validationSetting.minimum
      Severity: Major
      Found in lib/validate.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (validationSetting.without.exec(attrValue) !== null) {
                      validations.push(new ValidationError(attrName + " should meet the format requirements", {
                        attribute: attrName,
                        actual: attrValue,
                        expected: validationSetting.without
        Severity: Major
        Found in lib/validate.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    } else if (validationSetting.hasOwnProperty('maximum')) {
                      if (!(attrValue.length <= validationSetting.maximum)) {
                        validations.push(new ValidationError(attrName + " should have a maximum length of " + validationSetting.maximum, {
                          attribute: attrName,
                          actual: attrValue.length,
          Severity: Major
          Found in lib/validate.js - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language