File form-explainer.js
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var $ = jQuery = require('jquery');
var sticky = require('../../vendor/sticky/jquery.sticky.js');
require('../../vendor/jquery.easing/jquery.easing.js');
Function loadPage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadPage( lastPage, pageNum ) {
formExplainer.currentPage = pageNum;
$( '.form-explainer_page-link' ).removeClass( 'current-page' );
$( '.form-explainer_page-link[data-page=' + pageNum + ']' ).addClass( 'current-page' );
Function resizeImage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
formExplainer.resizeImage = function( els, $window, windowResize ) {
var pageWidth = els.$page.width();
var $image = els.$imageMapImage;
var currentHeight = $image.height();
- 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 loadPage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function loadPage( lastPage, pageNum ) {
formExplainer.currentPage = pageNum;
$( '.form-explainer_page-link' ).removeClass( 'current-page' );
$( '.form-explainer_page-link[data-page=' + pageNum + ']' ).addClass( 'current-page' );
- 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 fitAndStickToWindow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
formExplainer.fitAndStickToWindow = function( els, pageNum ) {
// http://stackoverflow.com/questions/318630/get-real-image-width-and-height-with-javascript-in-safari-chrome
$( '<img/>' )
.load( function() {
// store image width for use in calculations on window resize
- 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"