cBioPortal/clinical-timeline

View on GitHub

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(),
Severity: Minor
Found in js/clinicalTimeline.js - About 5 days to fix

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(),
Severity: Major
Found in js/clinicalTimeline.js - About 4 days to fix

    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(){
    Severity: Major
    Found in js/clinicalTimeline.js - About 2 days to fix

      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;
        }
      Severity: Major
      Found in js/plugins/trimTimeline.js - About 6 hrs to fix

        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,
        Severity: Major
        Found in js/plugins/zoom.js - About 5 hrs to fix

          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,
          Severity: Minor
          Found in js/plugins/zoom.js - About 4 hrs to fix

          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;
              });
          
          
          Severity: Major
          Found in js/clinicalTimeline.js - About 4 hrs to fix

            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,
            Severity: Major
            Found in js/plugins/overviewAxis.js - About 3 hrs to fix

              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]);
                  }
              Severity: Minor
              Found in js/sanity.js - About 3 hrs to fix

              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
              Severity: Major
              Found in js/plugins/exportTimeline.js - About 3 hrs to fix

                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,
                Severity: Major
                Found in js/clinicalTimeline.js - About 3 hrs to fix

                  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
                  Severity: Major
                  Found in js/plugins/zoom.js - About 2 hrs to fix

                    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
                    Severity: Major
                    Found in js/plugins/verticalLine.js - About 2 hrs to fix

                      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();
                      Severity: Major
                      Found in js/clinicalTimeline.js - About 2 hrs to fix

                        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"),
                        Severity: Minor
                        Found in js/plugins/helperLines.js - About 1 hr to fix

                          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();
                              }
                          Severity: Minor
                          Found in js/clinicalTimeline.js - About 1 hr to fix

                            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]);
                                }
                            Severity: Minor
                            Found in js/sanity.js - About 1 hr to fix

                              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),
                              Severity: Minor
                              Found in js/parser.js - About 1 hr to fix

                                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 = [],
                                Severity: Minor
                                Found in js/clinicalTimeline.js - About 1 hr to fix

                                  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;
                                      }
                                  Severity: Minor
                                  Found in js/clinicalTimeline.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language