jakubrohleder/angular-jsonapi

View on GitHub

Showing 126 of 126 total issues

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

    function revertRemove(id) {
      var _this = this;

      if (_this.removed[id] !== undefined) {
        _this.data[id] = _this.removed[id];
Severity: Major
Found in src/resource/resource-cache/resource-cache.factory.js and 1 other location - About 3 hrs to fix
src/resource/resource-cache/resource-cache.factory.js on lines 211..221

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

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 remove(id) {
      var _this = this;

      if (_this.data[id] !== undefined) {
        _this.removed[id] = _this.data[id];
Severity: Major
Found in src/resource/resource-cache/resource-cache.factory.js and 1 other location - About 3 hrs to fix
src/resource/resource-cache/resource-cache.factory.js on lines 229..239

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

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

      if (target === undefined) {
        $log.error('Can\'t link non existing object', object, key, target, schema);
        $log.error('Object:', object.data.type, object);
        $log.error('Target:', target.data.type, target);
        $log.error('Key:', key);
Severity: Major
Found in src/model/model-linker/model-linker.js and 2 other locations - About 3 hrs to fix
src/model/model-linker/model-linker.js on lines 60..67
src/model/model-linker/model-linker.js on lines 116..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 96.

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

      if (schema === undefined) {
        $log.error('Can\'t add link not present in schema:', object, key, target, schema);
        $log.error('Object:', object.data.type, object);
        $log.error('Target:', target.data.type, target);
        $log.error('Key:', key);
Severity: Major
Found in src/model/model-linker/model-linker.js and 2 other locations - About 3 hrs to fix
src/model/model-linker/model-linker.js on lines 51..58
src/model/model-linker/model-linker.js on lines 116..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 96.

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

      if (schema === undefined) {
        $log.error('Can\'t remove link not present in schema:', object, key, target, schema);
        $log.error('Object:', object.data.type, object);
        $log.error('Target:', target.data.type, target);
        $log.error('Key:', key);
Severity: Major
Found in src/model/model-linker/model-linker.js and 2 other locations - About 3 hrs to fix
src/model/model-linker/model-linker.js on lines 51..58
src/model/model-linker/model-linker.js on lines 60..67

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

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

  function jsonapiProvider(validateJS) {
    var memory = {};
    var names = [];
    this.$get = jsonapiFactory;

Severity: Major
Found in src/jsonapi.provider.js - About 3 hrs to fix

    Function __setData has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function __setData(object, validatedData) {
    
          var $jsonapi = $injector.get('$jsonapi');
          var schema = object.schema;
    
    
    Severity: Major
    Found in src/model/abstract-model/abstract-model.js - About 2 hrs to fix

      Function synchronize has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function synchronize(config) {
            var _this = this;
            var promises = [];
            var deferred = $q.defer();
            var action = config.action;
      Severity: Major
      Found in src/synchronizers/synchronizer-simple.factory.js - About 2 hrs to fix

        File model-linker.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        (function() {
          'use strict';
        
          angular.module('angular-jsonapi')
          .service('AngularJsonAPIModelLinkerService', AngularJsonAPIModelLinkerService);
        Severity: Minor
        Found in src/model/model-linker/model-linker.js - About 2 hrs to fix

          Function jsonapiFactory has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function jsonapiFactory(
                $log,
                AngularJsonAPIResource,
                AngularJsonAPISynchronizerSimple
              ) {
          Severity: Major
          Found in src/jsonapi.provider.js - About 2 hrs to fix

            Function AngularJsonAPISourceLocalWrapper has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function AngularJsonAPISourceLocalWrapper(
                AngularJsonAPISourcePrototype,
                $window,
                $q
              ) {
            Severity: Major
            Found in src/sources/local/source-local.factory.js - About 2 hrs to fix

              Function AngularJsonAPISourcePrototypeWrapper has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function AngularJsonAPISourcePrototypeWrapper() {
                  AngularJsonAPISourcePrototype.prototype.before = beforeSynchro;
                  AngularJsonAPISourcePrototype.prototype.after = afterSynchro;
                  AngularJsonAPISourcePrototype.prototype.begin = begin;
                  AngularJsonAPISourcePrototype.prototype.finish = finish;
              Severity: Major
              Found in src/sources/source-prototype.js - About 2 hrs to fix

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

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

                  Function unlink has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function unlink(key, target) {
                        var deferred = $q.defer();
                        var _this = this;
                        var error;
                        var config = {
                  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

                          function reject(response) {
                            $rootScope.$emit('angularJsonAPI:' + _this.data.type + ':object:save', 'rejected', _this, response);
                    
                            response.finish();
                            _this.errors.synchronization.concat(response.errors);
                    Severity: Major
                    Found in src/model/abstract-model/abstract-model.js and 2 other locations - About 2 hrs to fix
                    src/model/abstract-model/abstract-model.js on lines 241..247
                    src/model/abstract-model/abstract-model.js on lines 395..401

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

                    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 reject(response) {
                            $rootScope.$emit('angularJsonAPI:' + _this.data.type + ':object:refresh', 'rejected', _this, response);
                    
                            response.finish();
                            _this.errors.synchronization.concat(response.errors);
                    Severity: Major
                    Found in src/model/abstract-model/abstract-model.js and 2 other locations - About 2 hrs to fix
                    src/model/abstract-model/abstract-model.js on lines 151..157
                    src/model/abstract-model/abstract-model.js on lines 395..401

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

                    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 reject(response) {
                              $rootScope.$emit('angularJsonAPI:' + _this.data.type + ':object:unlinkReflection', 'rejected', _this, response);
                    
                              response.finish();
                              _this.errors.synchronization.concat(response.errors);
                    Severity: Major
                    Found in src/model/abstract-model/abstract-model.js and 2 other locations - About 2 hrs to fix
                    src/model/abstract-model/abstract-model.js on lines 151..157
                    src/model/abstract-model/abstract-model.js on lines 241..247

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

                    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

                          if (object === undefined) {
                            $log.error('Can\'t add link to non existing object', object, key, target);
                            $log.error('Object:', object.data.type, object);
                            $log.error('Target:', target.data.type, target);
                            $log.error('Key:', key);
                    Severity: Major
                    Found in src/model/model-linker/model-linker.js and 1 other location - About 2 hrs to fix
                    src/model/model-linker/model-linker.js on lines 106..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 83.

                    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

                          if (object === undefined) {
                            $log.error('Can\'t remove link from non existing object', object, key, target);
                            $log.error('Object:', object.data.type, object);
                            $log.error('Target:', target.data.type, target);
                            $log.error('Key:', key);
                    Severity: Major
                    Found in src/model/model-linker/model-linker.js and 1 other location - About 2 hrs to fix
                    src/model/model-linker/model-linker.js on lines 41..47

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

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

                    Severity
                    Category
                    Status
                    Source
                    Language