Showing 38 of 92 total issues
Function clinicalTimeline
has a Cognitive Complexity of 251 (exceeds 5 allowed). Consider refactoring. Open
var clinicalTimeline = (function(){
"use strict";
var allData,
colorCycle = d3.scale.category20(),
- 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 clinicalTimeline
has 954 lines of code (exceeds 25 allowed). Consider refactoring. Open
var clinicalTimeline = (function(){
"use strict";
var allData,
colorCycle = d3.scale.category20(),
File clinicalTimeline.js
has 959 lines of code (exceeds 250 allowed). Consider refactoring. Open
// vim: ts=2 sw=2
/* start-test-code-not-included-in-build */
d3 = require('d3');
/* end-test-code-not-included-in-build */
var clinicalTimeline = (function(){
Function run
has 171 lines of code (exceeds 25 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;
}
Function run
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
clinicalTimelineZoom.prototype.run = function(timeline, spec) {
var readOnlyVars = timeline.getReadOnlyVars(),
maxDays = readOnlyVars.maxDays,
minDays = readOnlyVars.minDays,
beginning = readOnlyVars.beginning,
Function run
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
clinicalTimelineZoom.prototype.run = function(timeline, spec) {
var readOnlyVars = timeline.getReadOnlyVars(),
maxDays = readOnlyVars.maxDays,
minDays = readOnlyVars.minDays,
beginning = readOnlyVars.beginning,
- 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 timeline
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
function timeline() {
var visibleData = allData.filter(function(x) {
return x.visible;
});
Function run
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
clinicalTimelineOverviewAxis.prototype.run = function(timeline, spec) {
var readOnlyVars = timeline.getReadOnlyVars(),
margin = readOnlyVars.margin,
overviewAxisWidth = timeline.overviewAxisWidth(),
chart = readOnlyVars.chart,
Function clinicalTimelineSanityChecker
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
var clinicalTimelineSanityChecker = (function() {
function validateData(data) {
for (var i=0; i < data.length; i++) {
validateTrack(data[i]);
}
- 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 run
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
clinicalTimelineExporter.prototype.run = function(timeline, spec) {
$(spec.exportDivId).css("visibility", "visible");
return {
/**
* Exports the clinical-timeline as SVG
Function addDataPointTooltip
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
timeline.addDataPointTooltip = function addDataPointTooltip(elem) {
function createDataTable(tooltip_table) {
var dataTable = {
"sDom": 't',
"bJQueryUI": true,
Function brushend
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
var brushend = function() {
var extentStart = parseInt(d3.select(divId + " .extent").attr("x"));
var extentEnd = extentStart + parseInt(d3.select(divId+" .extent").attr("width"));
var zoomFactor, translate;
// if the zoom region is tiny, the user clicked instead of clicking
Function run
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
clinicalTimelineVerticalLine.prototype.run = function(timeline, spec) {
var divId = timeline.divId(),
hoverLineGroup = d3.select(divId + " svg").append("g")
.attr("class", "hover-line"),
hoverLine = hoverLineGroup
Function addTrackTooltip
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addTrackTooltip(elem, data) {
function hideTrackClickHandler(trackName) {
return function() {
toggleTrackVisibility(trackName);
timeline();
Function run
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
clinicalTimelineHelperLines.prototype.run = function(timeline, spec) {
//enable helper lines only if no zoom and in advanced view
d3.selectAll(timeline.divId()+" [id^='timelineItem']").on("click", function(x) {
if (timeline.zoomFactor() === 1) {
var helperLineGroup = d3.select(timeline.divId() + " svg").append("g").attr("class", "helper-line-group"),
Function addClinicalAttributesTooltip
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addClinicalAttributesTooltip(elem, track, clickHandlerType) {
function colorClickHandler() {
colorByClinicalAttribute(track, $(this).prop("innerHTML"));
timeline();
}
Function clinicalTimelineSanityChecker
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var clinicalTimelineSanityChecker = (function() {
function validateData(data) {
for (var i=0; i < data.length; i++) {
validateTrack(data[i]);
}
Function clinicalTimelineParser
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
var clinicalTimelineParser = (function() {
function transformToTimelineJSON(clinical_timeline_data) {
var transformToTrack = function(clin_events) {
var track = {
"label":transformLabel(clin_events[0].eventType),
Function mergeTooltipTablesAtEqualTimepoint
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeTooltipTablesAtEqualTimepoint(trackData) {
if (!trackData || trackData.times.length === 0) return;
var collapsedTimes = [],
group = [],
Function orderTrackTooltipTables
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
timeline.orderTrackTooltipTables = function(track, rowkeys) {
var trackData = getTrack(allData, track);
if (trackData.times.length === 0) {
return timeline;
}