FreeAllMedia/dovima

View on GitHub

Showing 148 of 148 total issues

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

            it("should accept a custom error message", () => {
                truck.hasMany("wheels", Wheel);
                truck.ensure("wheels", isPresent, "must be there.");
                truck.invalidAttributes((invalidAttributeList) => {
                    invalidAttributeList.should.eql({
Severity: Major
Found in es6/spec/model.spec.js and 1 other location - About 2 hrs to fix
es6/spec/model.spec.js on lines 422..432

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

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 still call .afterSave", () => {
    user.constructor.prototype.afterSave = sinon.spy();

    user.save(() => {
      user.afterSave.called.should.be.true;
Severity: Major
Found in es6/spec/model/mock.instance.spec.js and 1 other location - About 2 hrs to fix
es6/spec/model/mock.instance.spec.js on lines 49..55

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

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 still call .beforeSave", () => {
    user.constructor.prototype.afterSave = sinon.spy();

    user.save(() => {
      user.beforeSave.called.should.be.true;
Severity: Major
Found in es6/spec/model/mock.instance.spec.js and 1 other location - About 2 hrs to fix
es6/spec/model/mock.instance.spec.js on lines 57..63

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

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

export default function addAssociation (associationDetails) {
  const association = {
    parent: this,
    type: associationDetails.type,
    constructor: associationDetails.constructor
Severity: Major
Found in es6/lib/model/addAssociation.js - About 2 hrs to fix

    Function invalidAttributes has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        invalidAttributes(callback) {
            const _ = privateData(this);
            const attributeNamesWithValidators = Object.keys(_.validations);
    
            const compileInvalidAttributeList = (errors, validatorMessages) => {
    Severity: Major
    Found in es6/lib/model/index.js - About 2 hrs to fix

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

        it("should return false on comparisons with arguments", () => {
          const queryA = User.find.where("id", 1);
          const queryB = User.find.where("id", 2);
      
          queryA.equalTo(queryB).should.be.false;
      Severity: Major
      Found in es6/spec/model/equalTo.spec.js and 1 other location - About 2 hrs to fix
      es6/spec/model/equalTo.spec.js on lines 21..26

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

      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 return true on comparisons with arguments", () => {
          const queryA = User.find.where("id", 1);
          const queryB = User.find.where("id", 1);
      
          queryA.equalTo(queryB).should.be.true;
      Severity: Major
      Found in es6/spec/model/equalTo.spec.js and 1 other location - About 2 hrs to fix
      es6/spec/model/equalTo.spec.js on lines 28..33

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

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

      function fetchFromDatabase(fields = [this.primaryKey], callback = undefined) {
        let database = this.database;
        if (!database) { throw new Error("Cannot fetch without Model.database set."); }
      
        let chain = database
      Severity: Major
      Found in es6/lib/model/fetch.js - About 2 hrs to fix

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

        gulp.task("build-spec", () => {
            return gulp.src(paths.source.spec)
                .pipe(babel())
                .pipe(gulp.dest(paths.build.directories.spec));
        });
        Severity: Major
        Found in tasks/build-spec.js and 1 other location - About 2 hrs to fix
        tasks/build-lib.js on lines 6..10

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

        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

        gulp.task("build-lib", () => {
            return gulp.src(paths.source.lib)
                .pipe(babel())
                .pipe(gulp.dest(paths.build.directories.lib));
        });
        Severity: Major
        Found in tasks/build-lib.js and 1 other location - About 2 hrs to fix
        tasks/build-spec.js on lines 6..10

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

        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

                                    Model.database.mock({
                                        "select * from `users` where `id` = 1 limit 1": [{id: 1}],
                                        "select * from `photos` where `user_id` = 1 and (`is_favorite` = true and `is_face_photo` = true)": [
                                            { id: 1, name: "Favorite Face Photo" },
                                            { id: 2, name: "Another Favorite Face Photo" },
        Severity: Major
        Found in es6/spec/model.spec.js and 1 other location - About 1 hr to fix
        es6/spec/model.spec.js on lines 543..550

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

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

        function saveOrUpdate(callback) {
          let now = new Datetime();
        
          const _ = privateData(this);
        
        
        Severity: Minor
        Found in es6/lib/model/save.js - About 1 hr to fix

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

                                      Model.database.mock({
                                          "select * from `users` where `id` = 1 limit 1": [{id: 1}],
                                          "select * from `photos` where `user_id` = 1 and (`is_favorite` = true)": [
                                              { id: 1, name: "Favorite Photo" },
                                              { id: 2, name: "Another Favorite Photo" },
          Severity: Major
          Found in es6/spec/model.spec.js and 1 other location - About 1 hr to fix
          es6/spec/model.spec.js on lines 569..576

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

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

              [symbols.callDeep] (methodName, predicate, callback) {
                  const associationNames = Object.keys(this.associations);
          
                  Async.mapParallel(
                      associationNames,
          Severity: Minor
          Found in es6/lib/model/index.js - About 1 hr to fix

            Function fetch has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fetch(callback) {
                    function processWhereCondition(value) {
                        if (typeof value === "string") {
                            const snakeCasedValue = inflect(value).snake.toString();
                            return snakeCasedValue;
            Severity: Minor
            Found in es6/lib/collection.js - About 1 hr to fix

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

                          describe("(hasMany)", () => {
                              it("should return true if collections has elements", done => {
                                  isPresent.call(truck, "wheels", (error, result) => {
                                      result.should.eql(trueValue);
                                      done();
              Severity: Major
              Found in es6/spec/validation/isPresent.spec.js and 4 other locations - About 1 hr to fix
              es6/spec/validation/isPresent.spec.js on lines 90..97
              es6/spec/validation/isPresent.spec.js on lines 108..115
              es6/spec/validation/isPresent.spec.js on lines 178..185
              es6/spec/validation/isPresent.spec.js on lines 199..206

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

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

                          describe("(hasOne)", () => {
                              it("should return true", done => {
                                  isPresent.call(truck, "steeringWheel", (error, result) => {
                                      result.should.eql(trueValue);
                                      done();
              Severity: Major
              Found in es6/spec/validation/isPresent.spec.js and 4 other locations - About 1 hr to fix
              es6/spec/validation/isPresent.spec.js on lines 99..106
              es6/spec/validation/isPresent.spec.js on lines 108..115
              es6/spec/validation/isPresent.spec.js on lines 178..185
              es6/spec/validation/isPresent.spec.js on lines 199..206

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

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

                          describe("(belongsTo)", () => {
                              it("should return true", done => {
                                  isPresent.call(truck, "street", (error, result) => {
                                      result.should.eql(trueValue);
                                      done();
              Severity: Major
              Found in es6/spec/validation/isPresent.spec.js and 4 other locations - About 1 hr to fix
              es6/spec/validation/isPresent.spec.js on lines 90..97
              es6/spec/validation/isPresent.spec.js on lines 99..106
              es6/spec/validation/isPresent.spec.js on lines 178..185
              es6/spec/validation/isPresent.spec.js on lines 199..206

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

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

                          describe("(hasOne)", () => {
                              it("should return false", done => {
                                  isPresent.call(truck, "steeringWheel", (error, result) => {
                                      result.should.eql(falseValue);
                                      done();
              Severity: Major
              Found in es6/spec/validation/isPresent.spec.js and 4 other locations - About 1 hr to fix
              es6/spec/validation/isPresent.spec.js on lines 90..97
              es6/spec/validation/isPresent.spec.js on lines 99..106
              es6/spec/validation/isPresent.spec.js on lines 108..115
              es6/spec/validation/isPresent.spec.js on lines 199..206

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

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

                              describe("(association id not present)", () => {
                                  it("should return false", done => {
                                      isPresent.call(truck, "street", (error, result) => {
                                          result.should.eql(falseValue);
                                          done();
              Severity: Major
              Found in es6/spec/validation/isPresent.spec.js and 4 other locations - About 1 hr to fix
              es6/spec/validation/isPresent.spec.js on lines 90..97
              es6/spec/validation/isPresent.spec.js on lines 99..106
              es6/spec/validation/isPresent.spec.js on lines 108..115
              es6/spec/validation/isPresent.spec.js on lines 178..185

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

              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