Showing 38 of 92 total issues
Function run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
clinicalTimelineExporter.prototype.run = function(timeline, spec) {
$(spec.exportDivId).css("visibility", "visible");
return {
/**
* Exports the clinical-timeline as SVG
- 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 addNewTrackTooltip
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addNewTrackTooltip(elem) {
elem.qtip({
content: {
text: 'addtrack'
},
Function generatePNG
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
generatePNG : function(download) {
$("#addtrack").css("visibility","hidden");
var element = document.getElementsByTagName('path')[0];
element.setAttribute("stroke" , "black");
element.setAttribute("fill" , "none");
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function(event, api) {
var trackTooltip = $.parseHTML("<div class='track-toolip'></div>");
var a = $.parseHTML("<a href='#' onClick='return false' class='hide-track'>Hide " +
elem.prop("innerHTML") + "</a>");
$(a).on("click", hideTrackClickHandler(elem.prop("innerHTML")));
Function getTickValues
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
timeline.getTickValues = function (minDays, maxDays, zoomLevel) {
var tickValues = [],
maxTime = timeline.daysToTimeObject(parseInt(maxDays)),
minTime = timeline.daysToTimeObject(parseInt(minDays)),
roundDown = clinicalTimelineUtil.roundDown,
Function run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
trimClinicalTimeline.prototype.run = function (timeline, spec) {
// skip when zoomed in, because trimming behaves oddly in those cases
if (timeline.zoomFactor() !== 1) {
return;
}
- 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 render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function(event, api) {
var tooltipDiv = $.parseHTML("<div></div>"),
d = elem.prop("__data__"), table;
if ("tooltip_tables" in d) {
for (var i=0; i < d.tooltip_tables.length; i++) {
Function transformToTimelineJSON
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transformToTimelineJSON(clinical_timeline_data) {
var transformToTrack = function(clin_events) {
var track = {
"label":transformLabel(clin_events[0].eventType),
visible:true,
Function generateSVG
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateSVG : function () {
$("#addtrack").css("visibility","hidden");
var element = document.getElementsByTagName('path')[0];
element.setAttribute("stroke" , "black");
element.setAttribute("fill" , "none");
Avoid deeply nested control flow statements. Open
for (i=minTime.toDays(); i <= maxTime.toDays(); i++) {
tickValues.push(i);
}
Avoid deeply nested control flow statements. Open
for (i=roundDown(minTime.toDays(), 3); i <= roundUp(maxTime.toDays(), 3); i+=3) {
tickValues.push(i);
}
Function zoomExplanation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function zoomExplanation(divId, svg, text, visibility, pos) {
Avoid too many return
statements within this function. Open
return time.m + "m" + Math.abs(time.d) + "d";
Avoid too many return
statements within this function. Open
return time.d + "d";
Avoid too many return
statements within this function. Open
return "days";
Avoid too many return
statements within this function. Open
return time.m + "m";
Function roundDown
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
roundDown : function(numToRound, multiple) {
var remainder = numToRound % multiple;
if (multiple === 0 || remainder === 0) {
return numToRound;
} 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 roundUp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
roundUp : function(numToRound, multiple) {
var remainder = numToRound % multiple;
if (multiple === 0 || remainder === 0) {
return numToRound;
} 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"