FreeAllMedia/dovima

View on GitHub

Showing 148 of 148 total issues

File model.spec.js has 854 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Testing Dependencies */
import sinon from "sinon";
import Database from "almaden";
import Collection from "../lib/collection.js";
import Model from "../../";
Severity: Major
Found in es6/spec/model.spec.js - About 2 days to fix

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

    describe(".softDelete(callback)", () => {
      class User extends Model {
        static useSoftDelete() {}
      }
    
    
    Severity: Major
    Found in es6/spec/model/softDelete.spec.js and 1 other location - About 1 day to fix
    es6/spec/model/delete.spec.js on lines 6..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 329.

    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

      describe("(when useSoftDelete is set)", () => {
        class User extends Model {
          static useSoftDelete() {}
        }
    
    
    Severity: Major
    Found in es6/spec/model/delete.spec.js and 1 other location - About 1 day to fix
    es6/spec/model/softDelete.spec.js on lines 4..34

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

    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

    describe("Model.find.whereNotNull(...options)", () => {
    
      class User extends Model {}
    
      before(() => {
    Severity: Major
    Found in es6/spec/model/find.whereNotNull.spec.js and 1 other location - About 1 day to fix
    es6/spec/model/find.whereNull.spec.js on lines 5..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 326.

    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

    describe("Model.find.whereNull(...options)", () => {
    
      class User extends Model {}
    
      before(() => {
    Severity: Major
    Found in es6/spec/model/find.whereNull.spec.js and 1 other location - About 1 day to fix
    es6/spec/model/find.whereNotNull.spec.js on lines 5..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 326.

    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

    describe("Model.find.orWhere(...options)", () => {
    
      class User extends Model {}
    
      before(() => {
    Severity: Major
    Found in es6/spec/model/find.orWhere.spec.js and 1 other location - About 6 hrs to fix
    es6/spec/model/find.andWhere.spec.js on lines 5..27

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

    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

    describe("Model.find.andWhere(...options)", () => {
    
      class User extends Model {}
    
      before(() => {
    Severity: Major
    Found in es6/spec/model/find.andWhere.spec.js and 1 other location - About 6 hrs to fix
    es6/spec/model/find.orWhere.spec.js on lines 5..27

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

    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

    Model has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class Model {
        /**
         * @param {Object.<String,*>} [initialAttributes] Provide default values for attributes by passing a Key-Value Object.
         * @constructor
         */
    Severity: Minor
    Found in es6/lib/model/index.js - About 4 hrs to fix

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

        describe(".afterSave(done)", () => {
          describe("(With Callback)", () => {
            it("should be called after .save", done => {
              // throw util.inspect(model.afterSave, true, 4);
              model.save((error) => {
      Severity: Major
      Found in es6/spec/model/afterSave.spec.js and 1 other location - About 4 hrs to fix
      es6/spec/model/beforeSave.spec.js on lines 37..56

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

      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

        describe(".beforeSave(done)", () => {
          describe("(With Callback)", () => {
            it("should be called before .save", done => {
              // throw util.inspect(model.afterSave, true, 4);
              model.save((error) => {
      Severity: Major
      Found in es6/spec/model/beforeSave.spec.js and 1 other location - About 4 hrs to fix
      es6/spec/model/afterSave.spec.js on lines 37..56

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

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

          [argumentsEqual](argumentsA, argumentsB) {
              if (argumentsA === argumentsB) {
                  return true;
              } else {
                  if (argumentsA.length === argumentsB.length) {
      Severity: Minor
      Found in es6/lib/modelFinder.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

      File modelFinder.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* Dependencies */
      import inflect from "jargon";
      import privateData from "incognito";
      
      /* Private Symbols */
      Severity: Minor
      Found in es6/lib/modelFinder.js - About 4 hrs to fix

        Function isPresent has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function isPresent(associationName, callback) {
            const model = this;
            const defaultErrorMessage = "must be present on " + model.constructor.name;
        
          //apiKey
        Severity: Minor
        Found in es6/lib/validation/isPresent.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

        File index.js has 320 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* Component Dependencies */
        import Async from "flowsync";
        import inflect from "jargon";
        import privateData from "incognito";
        
        
        Severity: Minor
        Found in es6/lib/model/index.js - About 3 hrs to fix

          ModelQuery has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class ModelQuery {
              constructor(ModelConstructor, options) {
                  const _ = privateData(this);
          
                  _.ModelConstructor = ModelConstructor;
          Severity: Minor
          Found in es6/lib/modelFinder.js - About 3 hrs to fix

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

                    describe(".tableName", () => {
                        it("should return the model's table name", () => {
                            user.tableName.should.eql("users");
                        });
                        it("should allow overriding of the model's table name", () => {
            Severity: Major
            Found in es6/spec/model.spec.js and 1 other location - About 3 hrs to fix
            es6/spec/model.spec.js on lines 109..118

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

            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

                    describe(".primaryKey", () => {
                        it("should return the model's primary key", () => {
                            user.primaryKey.should.eql("id");
                        });
                        it("should allow overriding of the model's primaryKey", () => {
            Severity: Major
            Found in es6/spec/model.spec.js and 1 other location - About 3 hrs to fix
            es6/spec/model.spec.js on lines 97..106

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

            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 add multiple group by clauses to the query", done => {
                const query = "select * from `users` group by `age`, `last_name`";
                const querySpy = User.database.spy(query);
            
                User
            Severity: Major
            Found in es6/spec/model/find.groupBy.spec.js and 1 other location - About 2 hrs to fix
            es6/spec/model/find.orderBy.spec.js on lines 14..25

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

            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 automatically add a where deleted_at = null clause to all select queries", done => {
                const query = "select * from `users` where `deleted_at` is null and `id` = 1";
                const querySpy = User.database.spy(query);
            
                User
            Severity: Major
            Found in es6/spec/model/useSoftDelete.spec.js and 1 other location - About 2 hrs to fix
            es6/spec/model/constructor.database.spec.js on lines 13..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 94.

            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 add an and clause to the query conditionals", done => {
                const query = "select * from `users` where `id` = 1";
                const querySpy = User.database.spy(query);
            
                User
            Severity: Major
            Found in es6/spec/model/constructor.database.spec.js and 1 other location - About 2 hrs to fix
            es6/spec/model/useSoftDelete.spec.js on lines 16..27

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

            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