Webfreshener/datamatic

View on GitHub

Showing 111 of 111 total issues

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

            it("should initialize a schema and a schema object", () => {
                expect(_owner.model.$model).toBeDefined();
                expect(_owner.model.$model instanceof PropertiesModel).toBe(true);
                expect(_owner.model.$model).toBeDefined();
                expect(_owner.model.$model instanceof PropertiesModel).toBe(true);
Severity: Major
Found in src/Model/propertiesModel.test.js and 2 other locations - About 3 hrs to fix
src/Model/itemsModel.test.js on lines 77..82
src/Model/propertiesModel.test.js on lines 92..97

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

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

        it("should not reset if it would invalidate model", () => {
            _owner = new Model({schemas: [stringsMinMaxCollection]});
            _owner.model = ["Item A", "Item B", "Item C"];
            expect(_owner.model.length).toBe(3);
            _owner.model.$model.reset();
Severity: Major
Found in src/Model/itemsModel.test.js and 1 other location - About 3 hrs to fix
src/Model/itemsModel.test.js on lines 329..335

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

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

    get handler() {
        return Object.assign(super.handler, {
            get: (t, idx) => {
                // TODO: review for removal
                // if (typeof idx === "symbol") {
Severity: Minor
Found in src/Model/itemsModel.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

File itemsModel.test.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {Model} from "./index";
import {default as deepEqual} from "deep-equal";
import {
    stringsCollection,
    stringsMinMaxCollection,
Severity: Minor
Found in src/Model/itemsModel.test.js - About 3 hrs to fix

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

            it("should shift with validation", () => {
                _owner.model.shift();
                _owner.model.shift();
                _owner.model.shift();
                expect(typeof _owner.errors).toBe("object");
    Severity: Major
    Found in src/Model/itemsModel.test.js and 1 other location - About 3 hrs to fix
    src/Model/itemsModel.test.js on lines 269..275

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

    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

            it("should pop with validation", () => {
                _owner.model.pop();
                _owner.model.pop();
                _owner.model.pop();
                expect(typeof _owner.errors).toBe("object");
    Severity: Major
    Found in src/Model/itemsModel.test.js and 1 other location - About 3 hrs to fix
    src/Model/itemsModel.test.js on lines 284..290

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

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

        next(data) {
            // enforces JSON formatting if feature is present
            data = data && data.toJSON ? data.toJSON() : data;
            const _targetProps = _pipes.get(this.target);
            // tests for presence of rate-limit timeout
    Severity: Minor
    Found in src/Pipeline/Pipeline.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 init has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        static init(pipe, properties) {
            const {callbacks, pipesOrVOsOrSchemas, pipes} = properties;
            const _txP = {};
    
            const _inPipe = (
    Severity: Minor
    Found in src/Pipeline/Properties.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 constructor has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        constructor(owner, schemas, options = {}) {
            // ensures that we are given something that represents a Model object
            if ((!owner) || !(owner instanceof Model)) {
                throw "Model is required at arguments[0]";
            }
    Severity: Minor
    Found in src/Model/_ajvWrapper.js - About 2 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

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

            it("should allow pattern properties", () => {
                _owner.model["test"] = "foo";
                expect(`${_owner}`).toEqual("{}");
                _owner.model["name"] = "foo";
                expect(`${_owner}`).toEqual("{\"name\":\"foo\"}");
    Severity: Major
    Found in src/Model/propertiesModel.test.js and 1 other location - About 2 hrs to fix
    src/Model/propertiesModel.test.js on lines 220..225

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

    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

            it("should accept multiple uses of patternProperty", () => {
                _owner.model["name"] = "foo";
                expect(`${_owner}`).toEqual("{\"name\":\"foo\"}");
                _owner.model["name"] = "bar";
                expect(`${_owner}`).toEqual("{\"name\":\"bar\"}");
    Severity: Major
    Found in src/Model/propertiesModel.test.js and 1 other location - About 2 hrs to fix
    src/Model/propertiesModel.test.js on lines 213..218

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

    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

        "properties": {
            "name": {
                "type": "string",
            },
            "topScores": {
    Severity: Major
    Found in fixtures/PropertiesModel.schemas.js and 1 other location - About 2 hrs to fix
    examples/model-example.js on lines 7..29

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

    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

        "properties": {
            "name": {
                "type": "string",
            },
            "topScores": {
    Severity: Major
    Found in examples/model-example.js and 1 other location - About 2 hrs to fix
    fixtures/PropertiesModel.schemas.js on lines 101..123

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

    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

    BaseModel has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class BaseModel {
        constructor() {
            createMetaDataRef(this, ...arguments);
        }
    
    
    Severity: Minor
    Found in src/Model/base-model.js - About 2 hrs to fix

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

              oauthFlows: {
                  type: "object",
                  description: "Allows configuration of the supported OAuth Flows.",
                  additionalProperties: false,
                  patternProperties: {
      Severity: Major
      Found in fixtures/OpenAPIv3.js and 1 other location - About 2 hrs to fix
      fixtures/OpenAPIv3.js on lines 463..486

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

      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

              mediaType: {
                  type: "object",
                  description: "Each Media Type Object provides schema and examples for the media type identified by its key.",
                  additionalProperties: false,
                  patternProperties: {
      Severity: Major
      Found in fixtures/OpenAPIv3.js and 1 other location - About 2 hrs to fix
      fixtures/OpenAPIv3.js on lines 945..968

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

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

      const createAjv = (inst, schemas, opts) => {
          const _ajv = new Ajv(opts);
          addFormats(_ajv);
      
          if (schemas) {
      Severity: Minor
      Found in src/Model/_ajvWrapper.js - About 2 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 next has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          next(data) {
              // enforces JSON formatting if feature is present
              data = data && data.toJSON ? data.toJSON() : data;
              const _targetProps = _pipes.get(this.target);
              // tests for presence of rate-limit timeout
      Severity: Major
      Found in src/Pipeline/Pipeline.js - About 2 hrs to fix

        Pipeline has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class Pipeline {
            static getExecs(..._pvs) {
                return _pvs.map((_p) => {
                    _p = Array.isArray(_p) ? _p[0] : _p;
                    return (d) => {
        Severity: Minor
        Found in src/Pipeline/Pipeline.js - About 2 hrs to fix

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

                  server: {
                      type: "object",
                      description: "An object representing a Server.",
                      required: [
                          "url"
          Severity: Major
          Found in fixtures/OpenAPIv3.js and 1 other location - About 2 hrs to fix
          fixtures/OpenAPIv3.js on lines 671..694

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

          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

          Severity
          Category
          Status
          Source
          Language