Function addSetValidityMethod
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
function addSetValidityMethod(context) {
var clazz = context.clazz,
set = context.set,
unset = context.unset;
- 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 formDirectiveFactory
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
var formDirectiveFactory = function(isNgForm) {
return ['$timeout', '$parse', function($timeout, $parse) {
var formDirective = {
name: 'form',
restrict: isNgForm ? 'EAC' : 'E',
- 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
File form.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/* global -nullFormCtrl, -PENDING_CLASS, -SUBMITTED_CLASS
*/
var nullFormCtrl = {
Function addSetValidityMethod
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addSetValidityMethod(context) {
var clazz = context.clazz,
set = context.set,
unset = context.unset;
Function formDirectiveFactory
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
var formDirectiveFactory = function(isNgForm) {
return ['$timeout', '$parse', function($timeout, $parse) {
var formDirective = {
name: 'form',
restrict: isNgForm ? 'EAC' : 'E',
Function ngFormCompile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
compile: function ngFormCompile(formElement, attr) {
// Setup initial state of the control
formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
Function $setValidity
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
clazz.prototype.$setValidity = function(validationErrorKey, state, controller) {
if (isUndefined(state)) {
createAndSet(this, '$pending', validationErrorKey, controller);
} else {
unsetAndCleanup(this, '$pending', validationErrorKey, controller);
Function ngFormPreLink
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
pre: function ngFormPreLink(scope, formElement, attr, ctrls) {
var controller = ctrls[0];
// if `action` attr is not present on the form, prevent the default action (submission)
if (!('action' in attr)) {
Function FormController
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function FormController($element, $attrs, $scope, $animate, $interpolate) {
Function isObjectEmpty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function isObjectEmpty(obj) {
if (obj) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
return false;
- 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"