sahat/satellizer

View on GitHub
examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js

Summary

Maintainability
F
2 wks
Test Coverage

File angular-ui-router.js has 1637 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * State-based routing for AngularJS
 * @version v0.2.13
 * @link http://angular-ui.github.com/
 * @license MIT License, http://www.opensource.org/licenses/MIT
Severity: Major
Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 4 days to fix

    Function $StateProvider has 400 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function $StateProvider(   $urlRouterProvider,   $urlMatcherFactory) {
    
      var root, states = {}, $state, queue = {}, abstractKey = 'abstract';
    
      // Builds state properties from definition passed to registerState()
    Severity: Major
    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 2 days to fix

      Function $UrlMatcherFactory has 249 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function $UrlMatcherFactory() {
        $$UMFP = this;
      
        var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = false;
      
      
      Severity: Major
      Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 day to fix

        Function $get has 211 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $urlRouter,   $location,   $urlMatcherFactory) {
        
            var TransitionSuperseded = $q.reject(new Error('transition superseded'));
            var TransitionPrevented = $q.reject(new Error('transition prevented'));
            var TransitionAborted = $q.reject(new Error('transition aborted'));
        Severity: Major
        Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 day to fix

          Function $UrlRouterProvider has 143 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function $UrlRouterProvider(   $locationProvider,   $urlMatcherFactory) {
            var rules = [], otherwise = null, interceptDeferred = false, listener;
          
            // Returns a string that is a prefix of all strings matching the RegExp
            function regExpPrefix(re) {
          Severity: Major
          Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 5 hrs to fix

            Function $Resolve has 124 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function $Resolve(  $q,    $injector) {
              
              var VISIT_IN_PROGRESS = 1,
                  VISIT_DONE = 2,
                  NOTHING = {},
            Severity: Major
            Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 4 hrs to fix

              Function study has 113 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                this.study = function (invocables) {
                  if (!isObject(invocables)) throw new Error("'invocables' must be an object");
                  var invocableKeys = objectKeys(invocables || {});
                  
                  // Perform a topological sort of invocables to build an ordered plan
              Severity: Major
              Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 4 hrs to fix

                Function $ViewDirective has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function $ViewDirective(   $state,   $injector,   $uiViewScroll,   $interpolate) {
                
                  function getService() {
                    return ($injector.has) ? function(service) {
                      return $injector.has(service) ? $injector.get(service) : null;
                Severity: Major
                Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 4 hrs to fix

                  Function transitionTo has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      $state.transitionTo = function transitionTo(to, toParams, options) {
                        toParams = toParams || {};
                        options = extend({
                          location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false
                        }, options || {});
                  Severity: Major
                  Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 3 hrs to fix

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

                      this.Param = function Param(id, type, config, location) {
                        var self = this;
                        config = unwrapShorthand(config);
                        type = getType(config, type, location);
                        var arrayMode = getArrayMode();
                    Severity: Major
                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 2 hrs to fix

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

                        function $get(   $location,   $rootScope,   $injector,   $browser) {
                      
                          var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl;
                      
                          function appendBasePath(url, isHtml5, absolute) {
                      Severity: Major
                      Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 2 hrs to fix

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

                        function UrlMatcher(pattern, config, parentMatcher) {
                          config = extend({ params: {} }, isObject(config) ? config : {});
                        
                          // Find all placeholders and create a compiled pattern, using either classic or curly syntax:
                          //   '*' name
                        Severity: Major
                        Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 2 hrs to fix

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

                          function $StateRefDirective($state, $timeout) {
                            var allowedOptions = ['location', 'inherit', 'reload'];
                          
                            return {
                              restrict: 'A',
                          Severity: Major
                          Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 2 hrs to fix

                            Function compile has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                compile: function (tElement, tAttrs, $transclude) {
                                  return function (scope, $element, attrs) {
                                    var previousEl, currentEl, currentScope, latestLocals,
                                        onloadExp     = attrs.onload || '',
                                        autoScrollExp = attrs.autoscroll,
                            Severity: Major
                            Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 2 hrs to fix

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

                                  link: function(scope, element, attrs, uiSrefActive) {
                                    var ref = parseStateRef(attrs.uiSref, $state.current.name);
                                    var params = null, url = null, base = stateContext(element) || $state.$current;
                                    var newHref = null, isAnchor = element.prop("tagName") === "A";
                                    var isForm = element[0].nodeName === "FORM";
                              Severity: Minor
                              Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                Function $asArray has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                Type.prototype.$asArray = function(mode, isSearch) {
                                  if (!mode) return this;
                                  if (mode === "auto" && !isSearch) throw new Error("'auto' array mode is for query parameters only");
                                  return new ArrayType(this, mode);
                                
                                
                                Severity: Minor
                                Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                  Function format has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  UrlMatcher.prototype.format = function (values) {
                                    values = values || {};
                                    var segments = this.segments, params = this.parameters(), paramset = this.params;
                                    if (!this.validates(values)) return null;
                                  
                                  
                                  Severity: Minor
                                  Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                    Function ArrayType has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      function ArrayType(type, mode) {
                                        function bindTo(type, callbackName) {
                                          return function() {
                                            return type[callbackName].apply(type, arguments);
                                          };
                                    Severity: Minor
                                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

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

                                        this.when = function (what, handler) {
                                          var redirect, handlerIsString = isString(handler);
                                          if (isString(what)) what = $urlMatcherFactory.compile(what);
                                      
                                          if (!handlerIsString && !isFunction(handler) && !isArray(handler))
                                      Severity: Minor
                                      Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

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

                                              var transition = $state.transition = resolved.then(function () {
                                                var l, entering, exiting;
                                        
                                                if ($state.transition !== transition) return TransitionSuperseded;
                                        
                                        
                                        Severity: Minor
                                        Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                          Function $get has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                            function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $urlRouter,   $location,   $urlMatcherFactory) {
                                          Severity: Major
                                          Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                            Function exec has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                            UrlMatcher.prototype.exec = function (path, searchParams) {
                                              var m = this.regexp.exec(path);
                                              if (!m) return null;
                                              searchParams = searchParams || {};
                                            
                                            
                                            Severity: Minor
                                            Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                              Function invoke has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                    function invoke(key, invocable, params) {
                                                      // Create a deferred for this invocation. Failures will propagate to the resolution as well.
                                                      var invocation = $q.defer(), waitParams = 0;
                                                      function onfailure(reason) {
                                                        invocation.reject(reason);
                                              Severity: Minor
                                              Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                                Function registerState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                  function registerState(state) {
                                                    // Wrap a new object around the state so we can store our private details easily.
                                                    state = inherit(state, {
                                                      self: state,
                                                      resolve: state.resolve || {},
                                                Severity: Minor
                                                Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                                  Function findState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                    function findState(stateOrName, base) {
                                                      if (!stateOrName) return undefined;
                                                  
                                                      var isStr = isString(stateOrName),
                                                          name  = isStr ? stateOrName : stateOrName.name,
                                                  Severity: Minor
                                                  Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                                    Function $ViewDirectiveFill has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                    function $ViewDirectiveFill (  $compile,   $controller,   $state,   $interpolate) {
                                                      return {
                                                        restrict: 'ECA',
                                                        priority: -400,
                                                        compile: function (tElement) {
                                                    Severity: Minor
                                                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

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

                                                          function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {
                                                            // Make a restricted $stateParams with only the parameters that apply to this state if
                                                            // necessary. In addition to being available to the controller and onEnter/onExit callbacks,
                                                            // we also need $stateParams to be available for any $injector calls we make during the
                                                            // dependency resolution process.
                                                      Severity: Minor
                                                      Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

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

                                                        function $StateRefActiveDirective($state, $stateParams, $interpolate) {
                                                          return  {
                                                            restrict: "A",
                                                            controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
                                                              var state, params, activeClass;
                                                        Severity: Minor
                                                        Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

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

                                                            function getRenderer(attrs, scope) {
                                                              var statics = function() {
                                                                return {
                                                                  enter: function (element, target, cb) { target.after(element); cb(); },
                                                                  leave: function (element, cb) { element.remove(); cb(); }
                                                          Severity: Minor
                                                          Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 1 hr to fix

                                                            Function resolveState has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                                function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {
                                                            Severity: Minor
                                                            Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                        if (isArray(encoded)) {
                                                                          result += map(encoded, encodeDashes).join("-");
                                                                        } else {
                                                                          result += encodeURIComponent(encoded);
                                                                        }
                                                              Severity: Major
                                                              Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 45 mins to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {
                                                                          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:
                                                                          var transition = $timeout(function() {
                                                                            $state.go(ref.state, params, options);
                                                                          });
                                                                Severity: Major
                                                                Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 40 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                        return transition;
                                                                  Severity: Major
                                                                  Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js - About 30 mins to fix

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

                                                                              if (entering.self.onEnter) {
                                                                                $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);
                                                                              }
                                                                    Severity: Minor
                                                                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js and 1 other location - About 40 mins to fix
                                                                    examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js on lines 3172..3174

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

                                                                    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 (exiting.self.onExit) {
                                                                                $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);
                                                                              }
                                                                    Severity: Minor
                                                                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js and 1 other location - About 40 mins to fix
                                                                    examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js on lines 3182..3184

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

                                                                    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

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

                                                                      var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
                                                                    Severity: Minor
                                                                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js and 1 other location - About 30 mins to fix
                                                                    examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js on lines 177..177

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

                                                                    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

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

                                                                      var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
                                                                    Severity: Minor
                                                                    Found in examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js and 1 other location - About 30 mins to fix
                                                                    examples/ionic/www/lib/ionic/js/angular-ui/angular-ui-router.js on lines 188..188

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

                                                                    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