jakubrohleder/angular-jsonapi

View on GitHub

Showing 126 of 126 total issues

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

(function() {
  'use strict';

  angular.module('angular-jsonapi-local')
  .config(provide);
Severity: Major
Found in src/sources/local/source-local.decorator.js and 2 other locations - About 2 hrs to fix
src/sources/parse/source-parse.decorator.js on lines 1..18
src/sources/rest/source-rest.decorator.js on lines 1..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 81.

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

(function() {
  'use strict';

  angular.module('angular-jsonapi-rest')
  .config(provide);
Severity: Major
Found in src/sources/rest/source-rest.decorator.js and 2 other locations - About 2 hrs to fix
src/sources/local/source-local.decorator.js on lines 1..18
src/sources/parse/source-parse.decorator.js on lines 1..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 81.

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

    function refresh(params) {
      var $jsonapi = $injector.get('$jsonapi');
      var deferred = $q.defer();
      var _this = this;
      params = params === undefined ? _this.schema.params.get : params;
Severity: Major
Found in src/model/abstract-model/abstract-model.js - About 2 hrs to fix

    Function unlinkAll has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function unlinkAll(key) {
          var _this = this;
          var deferred = $q.defer();
    
          __incrementLoadingCounter(_this);
    Severity: Major
    Found in src/model/abstract-model/abstract-model.js - About 2 hrs to fix

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

            angular.forEach(_this.sources, function(source) {
              angular.forEach(source.beforeHooks[action], function(hook) {
                deferred.notify({step: 'before', data: hook.call(_this, config)});
              });
            });
      Severity: Major
      Found in src/synchronizers/synchronizer-simple.factory.js and 2 other locations - About 2 hrs to fix
      src/synchronizers/synchronizer-simple.factory.js on lines 42..46
      src/synchronizers/synchronizer-simple.factory.js on lines 108..112

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

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

        function AngularJsonAPIModelErrorsManagerWrapper() {
          ErrorsManager.prototype.constructor = ErrorsManager;
          ErrorsManager.prototype.concat = concat;
          ErrorsManager.prototype.clear = clear;
          ErrorsManager.prototype.add = add;
      Severity: Major
      Found in src/errors/errors-manager/errors-manager.factory.js - About 2 hrs to fix

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

              angular.forEach(_this.sources, function(source) {
                angular.forEach(source.beginHooks[action], function(hook) {
                  deferred.notify({step: 'begin', data: hook.call(_this, config)});
                });
              });
        Severity: Major
        Found in src/synchronizers/synchronizer-simple.factory.js and 2 other locations - About 2 hrs to fix
        src/synchronizers/synchronizer-simple.factory.js on lines 48..52
        src/synchronizers/synchronizer-simple.factory.js on lines 108..112

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

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

                angular.forEach(_this.sources, function(source) {
                  angular.forEach(source.finishHooks[action], function(hook) {
                    deferred.notify({step: 'finish', errors: hook.call(_this, config)});
                  });
                });
        Severity: Major
        Found in src/synchronizers/synchronizer-simple.factory.js and 2 other locations - About 2 hrs to fix
        src/synchronizers/synchronizer-simple.factory.js on lines 42..46
        src/synchronizers/synchronizer-simple.factory.js on lines 48..52

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

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

            function fetch() {
              var _this = this;
              var deferred = $q.defer();
              var $jsonapi = $injector.get('$jsonapi');
              var config = {
        Severity: Major
        Found in src/collection/collection.factory.js - About 2 hrs to fix

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

                  function synchronize(result) {
                    __incrementLoadingCounter(target);
          
                    return target.synchronize({
                      action: 'unlinkReflection',
          Severity: Major
          Found in src/model/abstract-model/abstract-model.js and 1 other location - About 2 hrs to fix
          src/model/abstract-model/abstract-model.js on lines 460..469

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 77.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  function synchronize(result) {
                    __incrementLoadingCounter(target);
          
                    return target.synchronize({
                      action: 'linkReflection',
          Severity: Major
          Found in src/model/abstract-model/abstract-model.js and 1 other location - About 2 hrs to fix
          src/model/abstract-model/abstract-model.js on lines 547..556

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 77.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function AngularJsonAPISchemaWrapper has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function AngularJsonAPISchemaWrapper(
              $log,
              pluralize,
              uuid4,
              AngularJsonAPISchemaLink
          Severity: Major
          Found in src/schema/schema.factory.js - About 2 hrs to fix

            Function AngularJsonAPISourceLocal has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function AngularJsonAPISourceLocal(name, prefix) {
                  var _this = this;
            
                  prefix = prefix || 'AngularJsonAPI';
            
            
            Severity: Minor
            Found in src/sources/local/source-local.factory.js - About 1 hr to fix

              Function link has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function link(object, key, target, oneWay, form) {
                    var schema;
                    form = form === undefined ? false : form;
              
                    if (object === undefined) {
              Severity: Minor
              Found in src/model/model-linker/model-linker.js - About 1 hr to fix

                Function AngularJsonAPICollection has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function AngularJsonAPICollection(resource, params) {
                      var _this = this;
                
                      _this.resource = resource;
                      _this.type = resource.schema.type;
                Severity: Minor
                Found in src/collection/collection.factory.js - About 1 hr to fix

                  Function AngularJsonAPISchema has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function AngularJsonAPISchema(schema) {
                        var _this = this;
                        var include = schema.include || {};
                        schema.include = include;
                        include.get = schema.include.get || [];
                  Severity: Minor
                  Found in src/schema/schema.factory.js - About 1 hr to fix

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

                    (function() {
                      'use strict';
                    
                      describe('AngularJsonAPIModelValidationError', function() {
                    
                    
                    src/collection/collection.factory.spec.js on lines 2..13
                    src/errors/errors-manager/errors-manager.factory.spec.js on lines 2..13
                    src/errors/source-error/source-error.factory.spec.js on lines 2..13
                    src/jsonapi.provider.spec.js on lines 2..13
                    src/model/abstract-model/abstract-model.spec.js on lines 2..13
                    src/model/model-factory.factory.spec.js on lines 2..13
                    src/model/model-form/model-form.spec.js on lines 2..13
                    src/model/model-linker/model-linker.spec.js on lines 2..13
                    src/resource/resource.factory.spec.js on lines 2..13
                    src/schema/schema-link.factory.spec.js on lines 2..13
                    src/schema/schema.factory.spec.js on lines 2..13
                    src/synchronizers/synchronizer-simple.factory.spec.js on lines 2..13

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

                    (function() {
                      'use strict';
                    
                      describe('AngularJsonAPICollection', function() {
                    
                    
                    Severity: Major
                    Found in src/collection/collection.factory.spec.js and 12 other locations - About 1 hr to fix
                    src/errors/errors-manager/errors-manager.factory.spec.js on lines 2..13
                    src/errors/source-error/source-error.factory.spec.js on lines 2..13
                    src/errors/validation-error/validation-error.factory.spec.js on lines 2..13
                    src/jsonapi.provider.spec.js on lines 2..13
                    src/model/abstract-model/abstract-model.spec.js on lines 2..13
                    src/model/model-factory.factory.spec.js on lines 2..13
                    src/model/model-form/model-form.spec.js on lines 2..13
                    src/model/model-linker/model-linker.spec.js on lines 2..13
                    src/resource/resource.factory.spec.js on lines 2..13
                    src/schema/schema-link.factory.spec.js on lines 2..13
                    src/schema/schema.factory.spec.js on lines 2..13
                    src/synchronizers/synchronizer-simple.factory.spec.js on lines 2..13

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

                    (function() {
                      'use strict';
                    
                      describe('AngularJsonAPIResource', function() {
                    
                    
                    Severity: Major
                    Found in src/resource/resource.factory.spec.js and 12 other locations - About 1 hr to fix
                    src/collection/collection.factory.spec.js on lines 2..13
                    src/errors/errors-manager/errors-manager.factory.spec.js on lines 2..13
                    src/errors/source-error/source-error.factory.spec.js on lines 2..13
                    src/errors/validation-error/validation-error.factory.spec.js on lines 2..13
                    src/jsonapi.provider.spec.js on lines 2..13
                    src/model/abstract-model/abstract-model.spec.js on lines 2..13
                    src/model/model-factory.factory.spec.js on lines 2..13
                    src/model/model-form/model-form.spec.js on lines 2..13
                    src/model/model-linker/model-linker.spec.js on lines 2..13
                    src/schema/schema-link.factory.spec.js on lines 2..13
                    src/schema/schema.factory.spec.js on lines 2..13
                    src/synchronizers/synchronizer-simple.factory.spec.js on lines 2..13

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

                    (function() {
                      'use strict';
                    
                      describe('AngularJsonAPIAbstractModel', function() {
                    
                    
                    Severity: Major
                    Found in src/model/abstract-model/abstract-model.spec.js and 12 other locations - About 1 hr to fix
                    src/collection/collection.factory.spec.js on lines 2..13
                    src/errors/errors-manager/errors-manager.factory.spec.js on lines 2..13
                    src/errors/source-error/source-error.factory.spec.js on lines 2..13
                    src/errors/validation-error/validation-error.factory.spec.js on lines 2..13
                    src/jsonapi.provider.spec.js on lines 2..13
                    src/model/model-factory.factory.spec.js on lines 2..13
                    src/model/model-form/model-form.spec.js on lines 2..13
                    src/model/model-linker/model-linker.spec.js on lines 2..13
                    src/resource/resource.factory.spec.js on lines 2..13
                    src/schema/schema-link.factory.spec.js on lines 2..13
                    src/schema/schema.factory.spec.js on lines 2..13
                    src/synchronizers/synchronizer-simple.factory.spec.js on lines 2..13

                    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