Showing 10 of 17 total issues
Function validate
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Instance.prototype.validate = function() {
var validations = this.validations;
var validation_callback_queue = [];
if ( validations ) {
- 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 validate
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Instance.prototype.validate = function() {
var validations = this.validations;
var validation_callback_queue = [];
if ( validations ) {
Function send
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Instance.prototype.send = function( url, method, validation ) {
if ( validation !== false ) {
// Validate the model
if ( this.validate() === false ) {
// Woah. No way we're sending this off.
Function send
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Instance.prototype.send = function( url, method, validation ) {
if ( validation !== false ) {
// Validate the model
if ( this.validate() === false ) {
// Woah. No way we're sending this off.
- 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 exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
Function get
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Instance.prototype.get = function( attr ) {
var input,
element;
// Add the latest values of any HTML INPUT FIELDS specified
Avoid deeply nested control flow statements. Open
if ( pass_callback ) { validation_callback_queue.push( pass_callback ); }
Avoid deeply nested control flow statements. Open
if ( fail_callback ) { validation_callback_queue.push( fail_callback ); }
Function validates_instance_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function validates_instance_url( url, attr ) {
var xhr = new XMLHttpRequest();
xhr.open( "GET", url + "?value=" + encodeURIComponent(attr), true );
xhr.setRequestHeader( "Instance-Validation", attr );
xhr.onreadystatechange = function() {
- 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 validates_instance_presence
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function validates_instance_presence( type, attr ) {
if ( attr === undefined || attr === null || attr === "" || attr === 0 || attr === "0" ) {
var presence = false;
} else {
var presence = true;
- 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"