AlexeyGrishin/schemasaurus

View on GitHub

Showing 95 of 95 total issues

Function 12 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./compiler":1,"./normalizer":13,"./v4validator":14,"./validator_extend":15}],12:[function(require,module,exports){
"use strict";

module.exports = function messages(gettext) {
    return {
Severity: Minor
Found in schemasaurus.js - About 1 hr to fix

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

    module.exports = function (expr) {
        if (expr.indexOf(":") !== -1 || expr.indexOf("[") !== -1) {
            return createMatcher(expr);
        }
    };
    Severity: Major
    Found in schemasaurus.js and 1 other location - About 1 hr to fix
    src/int/matchers.js on lines 65..69

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

    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

    module.exports = function (expr) {
        if (expr.indexOf(":") !== -1 || expr.indexOf("[") !== -1) {
            return createMatcher(expr);
        }
    };
    Severity: Major
    Found in src/int/matchers.js and 1 other location - About 1 hr to fix
    schemasaurus.js on lines 464..468

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

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

    module.exports = function messages(gettext) {
        return {
            "string": gettext("shall be a string"),
            "null": gettext("shall be null"),
            "minLength": gettext("shall have length at least %d"),
    Severity: Minor
    Found in schemasaurus.js - About 1 hr to fix

      Function messages has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function messages(gettext) {
          return {
              "string": gettext("shall be a string"),
              "null": gettext("shall be null"),
              "minLength": gettext("shall have length at least %d"),
      Severity: Minor
      Found in src/messages.js - About 1 hr to fix

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

        suite.add("non-compiled", function () {
            gen({firstname: "frodo", lastname: "baggins", gender: "male", favouriteBooks: [
                {name: "Lord of the Rings", genre: "Epic story"},
                {name: "Silmarrilion", genre: "More epic story"}
            ]});
        Severity: Major
        Found in examples/compare.js and 1 other location - About 1 hr to fix
        examples/compare.js on lines 8..18

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

        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

            console.log(genCompiled({
                firstname: "frodo", lastname: "baggins", gender: "male", favouriteBooks: [
                    {name: "Lord of the Rings", genre: "Epic story"},
                    {name: "Silmarrilion", genre: "More epic story"}
                ]
        Severity: Major
        Found in examples/formgen_compiled.js and 1 other location - About 1 hr to fix
        examples/formgen.js on lines 88..93

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

        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

            console.log(gen({
                firstname: "frodo", lastname: "baggins", gender: "male", favouriteBooks: [
                    {name: "Lord of the Rings", genre: "Epic story"},
                    {name: "Silmarrilion", genre: "More epic story"}
                ]
        Severity: Major
        Found in examples/formgen.js and 1 other location - About 1 hr to fix
        examples/formgen_compiled.js on lines 55..60

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

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

            processRequired: function (reqs) {
                if (Array.isArray(reqs)) {
                    return function (s, o, ctx) {
                        if (!isObject(o)) {
                            return;
        Severity: Minor
        Found in src/v4validator.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 processItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        SchemaPartProcessor.prototype.processItems = function (step) {
            if (!step.schema.items && !step.schema.additionalItems) {
                return;
            }
            var idxvar, newvar, k;
        Severity: Minor
        Found in src/int/processor.js - About 1 hr to fix

          Function processItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          SchemaPartProcessor.prototype.processItems = function (step) {
              if (!step.schema.items && !step.schema.additionalItems) {
                  return;
              }
              var idxvar, newvar, k;
          Severity: Minor
          Found in schemasaurus.js - About 1 hr to fix

            Function [type] has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                "[type]": function (schema, object, ctx) {
                    var isTrue, isFalse;
                    if (notDefined(object)) {
                        return;
                    }
            Severity: Minor
            Found in schemasaurus.js - About 1 hr to fix

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

              function SchemaPartProcessor(vargen, codeComposer, options) {
                  this.vargen = vargen;
                  this.labelgen = new Generator('label');
                  this.codeComposer = codeComposer;
                  this.options = options;
              Severity: Major
              Found in schemasaurus.js and 1 other location - About 1 hr to fix
              src/int/processor.js on lines 4..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 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 createMatcher has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createMatcher(expr) {
                  var ma = modRe.exec(expr), props = [], attr, not, i;
                  if (ma) {
                      attr = ma[1];
                  }
              Severity: Minor
              Found in src/int/matchers.js - About 1 hr to fix

                Function [type] has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    "[type]": function (schema, object, ctx) {
                        var isTrue, isFalse;
                        if (notDefined(object)) {
                            return;
                        }
                Severity: Minor
                Found in src/normalizer.js - About 1 hr to fix

                  Function createMatcher has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function createMatcher(expr) {
                      var ma = modRe.exec(expr), props = [], attr, not, i;
                      if (ma) {
                          attr = ma[1];
                      }
                  Severity: Minor
                  Found in schemasaurus.js - About 1 hr to fix

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

                    function SchemaPartProcessor(vargen, codeComposer, options) {
                        this.vargen = vargen;
                        this.labelgen = new Generator('label');
                        this.codeComposer = codeComposer;
                        this.options = options;
                    Severity: Major
                    Found in src/int/processor.js and 1 other location - About 1 hr to fix
                    schemasaurus.js on lines 473..478

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

                    SchemaPartProcessor.prototype.processItems = function (step) {
                        if (!step.schema.items && !step.schema.additionalItems) {
                            return;
                        }
                        var idxvar, newvar, k;
                    Severity: Minor
                    Found in src/int/processor.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 processProperties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    SchemaPartProcessor.prototype.processProperties = function (step) {
                        if (!step.schema.properties && !step.schema.additionalProperties && !step.schema.patternProperties) {
                            return;
                        }
                        var propsVar, newvar, k;
                    Severity: Minor
                    Found in src/int/processor.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 [type] has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        "[type]": function (schema, object, ctx) {
                            var isTrue, isFalse;
                            if (notDefined(object)) {
                                return;
                            }
                    Severity: Minor
                    Found in src/normalizer.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