src/ng/directive/ngOptions.js
Function ngOptionsDirective
has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring. Open
Open
var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {
function parseOptionsExpression(optionsExp, selectElement, scope) {
var match = optionsExp.match(NG_OPTIONS_REGEXP);
- Read upRead up
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
Open
var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {
function parseOptionsExpression(optionsExp, selectElement, scope) {
var match = optionsExp.match(NG_OPTIONS_REGEXP);
Function ngOptionsPostLink
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
var selectCtrl = ctrls[0];
var ngModelCtrl = ctrls[1];
var multiple = attr.multiple;
Function parseOptionsExpression
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseOptionsExpression(optionsExp, selectElement, scope) {
var match = optionsExp.match(NG_OPTIONS_REGEXP);
if (!(match)) {
throw ngOptionsMinErr('iexp',
File ngOptions.js
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
/* exported ngOptionsDirective */
/* global jqLiteRemove */
Function updateOptions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function getOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getOptions: function() {
var optionItems = [];
var selectValueMap = {};
Function Option
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function Option(selectValue, viewValue, label, group, disabled) {