angular/angular.js

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

Summary

Maintainability
F
6 days
Test Coverage

Function ngOptionsDirective has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring.
Open

var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {

  function parseOptionsExpression(optionsExp, selectElement, scope) {

    var match = optionsExp.match(NG_OPTIONS_REGEXP);
Severity: Minor
Found in src/ng/directive/ngOptions.js - About 3 days 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 ngOptionsDirective has 296 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {

  function parseOptionsExpression(optionsExp, selectElement, scope) {

    var match = optionsExp.match(NG_OPTIONS_REGEXP);
Severity: Major
Found in src/ng/directive/ngOptions.js - About 1 day to fix

    Function ngOptionsPostLink has 167 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
    
          var selectCtrl = ctrls[0];
          var ngModelCtrl = ctrls[1];
          var multiple = attr.multiple;
    Severity: Major
    Found in src/ng/directive/ngOptions.js - About 6 hrs to fix

      Function parseOptionsExpression has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function parseOptionsExpression(optionsExp, selectElement, scope) {
      
          var match = optionsExp.match(NG_OPTIONS_REGEXP);
          if (!(match)) {
            throw ngOptionsMinErr('iexp',
      Severity: Major
      Found in src/ng/directive/ngOptions.js - About 4 hrs to fix

        File ngOptions.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        /* exported ngOptionsDirective */
        
        /* global jqLiteRemove */
        Severity: Minor
        Found in src/ng/directive/ngOptions.js - About 3 hrs to fix

          Function updateOptions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function updateOptions() {
                  var previousValue = options && selectCtrl.readValue();
          
                  // We must remove all current options, but cannot simply set innerHTML = null
                  // since the providedEmptyOption might have an ngIf on it that inserts comments which we
          Severity: Minor
          Found in src/ng/directive/ngOptions.js - About 1 hr to fix

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

                  getOptions: function() {
            
                    var optionItems = [];
                    var selectValueMap = {};
            
            
            Severity: Minor
            Found in src/ng/directive/ngOptions.js - About 1 hr to fix

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

                  function Option(selectValue, viewValue, label, group, disabled) {
              Severity: Minor
              Found in src/ng/directive/ngOptions.js - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status