angular/angular.js

View on GitHub
src/ng/directive/select.js

Summary

Maintainability
F
4 days
Test Coverage

Function SelectController has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

        ['$element', '$scope', /** @this */ function($element, $scope) {

  var self = this,
      optionsMap = new NgMap();

Severity: Minor
Found in src/ng/directive/select.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function SelectController has 201 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        ['$element', '$scope', /** @this */ function($element, $scope) {

  var self = this,
      optionsMap = new NgMap();

Severity: Major
Found in src/ng/directive/select.js - About 1 day to fix

    File select.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    /* exported selectDirective, optionDirective */
    
    var noopNgModelController = { $setViewValue: noop, $render: noop };
    Severity: Minor
    Found in src/ng/directive/select.js - About 3 hrs to fix

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

        self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
      
          if (optionAttrs.$attr.ngValue) {
            // The value attribute is set by ngValue
            var oldVal, hashedVal;
      Severity: Major
      Found in src/ng/directive/select.js - About 2 hrs to fix

        Function selectDirective has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var selectDirective = function() {
        
          return {
            restrict: 'E',
            require: ['select', '?ngModel'],
        Severity: Major
        Found in src/ng/directive/select.js - About 2 hrs to fix

          Function selectDirective has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          var selectDirective = function() {
          
            return {
              restrict: 'E',
              require: ['select', '?ngModel'],
          Severity: Minor
          Found in src/ng/directive/select.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function selectPreLink has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function selectPreLink(scope, element, attr, ctrls) {
          
                var selectCtrl = ctrls[0];
                var ngModelCtrl = ctrls[1];
          
          
          Severity: Minor
          Found in src/ng/directive/select.js - About 1 hr to fix

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

              self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
            Severity: Minor
            Found in src/ng/directive/select.js - About 35 mins to fix

              Function optionDirective has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              var optionDirective = ['$interpolate', function($interpolate) {
                return {
                  restrict: 'E',
                  priority: 100,
                  compile: function(element, attr) {
              Severity: Minor
              Found in src/ng/directive/select.js - About 35 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              There are no issues that match your filters.

              Category
              Status