Showing 5 of 7 total issues
Function loaded
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function loaded(image, callback) {
var src;
if (!image.nodeName) {
return callback(new Error('First argument must be an image element'));
- 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 findImageInElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
findImageInElement: function(element) {
var urlType = this.determineUrlAndType(element);
//skip if gradient
if (!this.hasGradient(urlType.url)) {
- 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 getImageSrcs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getImageSrcs: function(element) {
this.sources = [];
if (typeof element !== 'undefined') {
this.findImageInElement(element);
- 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 loaded
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loaded(image, callback) {
var src;
if (!image.nodeName) {
return callback(new Error('First argument must be an image element'));
Function bind
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Function.prototype.bind = function(oThis) {
'use strict';
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable 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"