File rest.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
function initShowsHides(untilPanelId) {
Quby.panels.find(function (bbPanel) {
bbPanel.initShowsHides(Quby.questions);
return bbPanel.get('panelId') == untilPanelId;
});
Function assignValue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function assignValue(qkey, val){
var inputs;
if(val instanceof Object){//checkbox vals are passed as an object hash
inputs = $("[name^='answer["+qkey+"_'][type!='hidden']");
} else {
- 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 setAllCheckboxes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function setAllCheckboxes(checked, allKey, nothingKey, question, checkValue){
if(checked){
// Setting all other checkboxes to checkValue
check_boxes = $("#answer_"+question+"_input").find("input[type=checkbox]:not(:disabled)");
if(check_boxes.length == 0){
- 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 handleAjaxFormRequests
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleAjaxFormRequests(prepareDisplayModeCallback) {
$(document).on('ajax:success', "form", function(event, data, status, xhr) {
content_type = (xhr.getResponseHeader("content-type")||"").split(';')[0];
if (content_type == 'text/html') { // not json response
$('#content').replaceWith(data);
Function assignValue
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function assignValue(qkey, val){
var inputs;
if(val instanceof Object){//checkbox vals are passed as an object hash
inputs = $("[name^='answer["+qkey+"_'][type!='hidden']");
} else {
Function setAllCheckboxes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setAllCheckboxes(checked, allKey, nothingKey, question, checkValue){
Function activatePanel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function activatePanel(panel, forward) {
if (shownFlash) {
$('.flash').hide();
}
shownFlash = 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"