superdesk/superdesk-client-core

View on GitHub
scripts/libs/angular-history/history.js

Summary

Maintainability
F
6 days
Test Coverage

File history.js has 797 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*global angular*/

/**
 * @ngdoc overview
 * @name decipher.history
Severity: Major
Found in scripts/libs/angular-history/history.js - About 1 day to fix

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

            function deepWatch(exp, scope, description, lazyOptions) {
              var match,
                targetName,
                valueFn,
                keyName,
    Severity: Major
    Found in scripts/libs/angular-history/history.js - About 2 hrs to fix

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

            this.rollback = function rollback(t) {
      
              var _do = bind(this, this._do),
                parent = t.$parent,
                packets = {},
      Severity: Major
      Found in scripts/libs/angular-history/history.js - About 2 hrs to fix

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

              this._clear = function _clear(scope, exps) {
                var id = scope.$id,
                  i,
                  nextSibling,
                  exp,
        Severity: Major
        Found in scripts/libs/angular-history/history.js - About 2 hrs to fix

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

                this.batch = function batch(fn, scope, description) {
                  var _clear = bind(this, this._clear),
                    _initStores = this._initStores,
                    listener,
                    watchObj,
          Severity: Minor
          Found in scripts/libs/angular-history/history.js - About 1 hr to fix

            Function _rollback has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function _rollback(scope, comparisonScope) {
                      var id = scope.$id,
                        comparisonScopeId = comparisonScope.$id,
                        stack = history[id],
                        pointer,
            Severity: Minor
            Found in scripts/libs/angular-history/history.js - About 1 hr to fix

              Function undo has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    this.undo = function undo(exp, scope) {
                      scope = scope || $rootScope;
                      if (isUndefined(exp)) {
                        throw new Error('expression required');
                      }
              Severity: Minor
              Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                Function createDeepWatch has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            createDeepWatch = function createDeepWatch(targetName, valueName,
                              keyName, watchObj) {
                              return function (values) {
                                forEach(values, function (v, k) {
                
                
                Severity: Minor
                Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                  Function _archive has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        this._archive = function (exp, id, locals, pass, description) {
                          var _initStores = this._initStores;
                          return function (newVal, oldVal) {
                            var watchObj;
                            _initStores(id);
                  Severity: Minor
                  Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                    Function keys has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Object.keys = (function () {
                          var hasOwnProperty = Object.prototype.hasOwnProperty,
                            hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
                            dontEnums = [
                              'toString',
                    Severity: Minor
                    Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                      Function watch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            this.watch = function watch(exps, scope, description, lazyOptions) {
                              if (isUndefined(exps)) {
                                throw new Error('expression required');
                              }
                              scope = scope || $rootScope;
                      Severity: Minor
                      Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                        Function redo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              this.redo = function redo(exp, scope) {
                                scope = scope || $rootScope;
                                var id = scope.$id,
                                  stack = history[id][exp],
                                  values,
                        Severity: Minor
                        Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                          Function clear has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    clear = function clear(id, key) {
                                      var zap = function zap(what) {
                                        if (isDefined(what[id][key])) {
                                          delete what[id][key];
                                          if (Object.keys(what[id]).length === 0) {
                          Severity: Minor
                          Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                            Function revert has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  this.revert = function (exp, scope, pointer) {
                                    scope = scope || $rootScope;
                                    pointer = pointer || 0;
                                    var id = scope.$id,
                                      stack = history[id][exp],
                            Severity: Minor
                            Found in scripts/libs/angular-history/history.js - About 1 hr to fix

                              Function _archive has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                    this._archive = function (exp, id, locals, pass, description) {
                              Severity: Minor
                              Found in scripts/libs/angular-history/history.js - About 35 mins to fix

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

                                      Watch.prototype.addUndoHandler =
                                        function addUndoHandler(name, fn, resolve) {
                                          if (!name || !fn) {
                                            throw new Error('invalid parameters');
                                          }
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 4 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 191..197
                                scripts/libs/angular-history/history.js on lines 231..237
                                scripts/libs/angular-history/history.js on lines 251..257
                                scripts/libs/angular-history/history.js on lines 271..277

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

                                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

                                      Watch.prototype.addRevertHandler =
                                        function addRevertHandler(name, fn, resolve) {
                                          if (!name || !fn) {
                                            throw new Error('invalid parameters');
                                          }
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 4 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 191..197
                                scripts/libs/angular-history/history.js on lines 211..217
                                scripts/libs/angular-history/history.js on lines 231..237
                                scripts/libs/angular-history/history.js on lines 271..277

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

                                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

                                      Watch.prototype.addChangeHandler =
                                        function addChangeHandler(name, fn, resolve) {
                                          if (!name || !fn) {
                                            throw new Error('invalid parameters');
                                          }
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 4 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 211..217
                                scripts/libs/angular-history/history.js on lines 231..237
                                scripts/libs/angular-history/history.js on lines 251..257
                                scripts/libs/angular-history/history.js on lines 271..277

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

                                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

                                      Watch.prototype.addRedoHandler =
                                        function addRedoHandler(name, fn, resolve) {
                                          if (!name || !fn) {
                                            throw new Error('invalid parameters');
                                          }
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 4 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 191..197
                                scripts/libs/angular-history/history.js on lines 211..217
                                scripts/libs/angular-history/history.js on lines 251..257
                                scripts/libs/angular-history/history.js on lines 271..277

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

                                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

                                      Watch.prototype.addRollbackHandler =
                                        function addRollbackHandler(name, fn, resolve) {
                                          if (!name || !fn) {
                                            throw new Error('invalid parameters');
                                          }
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 4 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 191..197
                                scripts/libs/angular-history/history.js on lines 211..217
                                scripts/libs/angular-history/history.js on lines 231..237
                                scripts/libs/angular-history/history.js on lines 251..257

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

                                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

                                      Watch.prototype.canUndo = function canUndo() {
                                        return this.exp === null ? false :
                                               service.canUndo(this.exp, this.scope);
                                      };
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 1 other location - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 539..542

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

                                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

                                      Watch.prototype.canRedo = function canRedo() {
                                        return this.exp === null ? false :
                                               service.canRedo(this.exp, this.scope);
                                      };
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 1 other location - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 530..533

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

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

                                      Watch.prototype.removeRevertHandler = function removeRevertHandler(name) {
                                        if (!name) {
                                          throw new Error('invalid parameters');
                                        }
                                        return this._removeHandler('$revert', name);
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 3 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 305..310
                                scripts/libs/angular-history/history.js on lines 321..326
                                scripts/libs/angular-history/history.js on lines 353..359

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

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

                                      Watch.prototype.removeChangeHandler = function removeChangeHandler(name) {
                                        if (!name) {
                                          throw new Error('invalid parameters');
                                        }
                                        return this._removeHandler('$change', name);
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 3 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 289..294
                                scripts/libs/angular-history/history.js on lines 321..326
                                scripts/libs/angular-history/history.js on lines 353..359

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

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

                                      Watch.prototype.removeRedoHandler =
                                        function removeRedoHandler(name) {
                                          if (!name) {
                                            throw new Error('invalid parameters');
                                          }
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 3 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 289..294
                                scripts/libs/angular-history/history.js on lines 305..310
                                scripts/libs/angular-history/history.js on lines 321..326

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

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

                                      Watch.prototype.removeUndoHandler = function removeUndoHandler(name) {
                                        if (!name) {
                                          throw new Error('invalid parameters');
                                        }
                                        return this._removeHandler('$undo', name);
                                Severity: Major
                                Found in scripts/libs/angular-history/history.js and 3 other locations - About 1 hr to fix
                                scripts/libs/angular-history/history.js on lines 289..294
                                scripts/libs/angular-history/history.js on lines 305..310
                                scripts/libs/angular-history/history.js on lines 353..359

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

                                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

                                There are no issues that match your filters.

                                Category
                                Status