cBioPortal/clinical-timeline

View on GitHub

Showing 92 of 92 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        startAllowedOverview = overViewScale(clinicalTimelineUtil.roundDown(readOnlyVars.minDays, clinicalTimelineUtil.getDifferenceTicksDays(zoomLevel))) - overViewScale(clinicalTimelineUtil.roundDown(readOnlyVars.minDays, clinicalTimelineUtil.getDifferenceTicksDays(originalZoomLevel))),
    Severity: Major
    Found in js/plugins/overviewAxis.js and 1 other location - About 1 hr to fix
    js/plugins/overviewAxis.js on lines 33..33

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            x.size = scale(parseFloat(String(x.tooltip_tables[0].filter(function(x) {
              return x[0] === attr;})[0][1]).replace(/[^\d.-]/g, ''))) || minSize;
    Severity: Major
    Found in js/clinicalTimeline.js and 1 other location - About 1 hr to fix
    js/clinicalTimeline.js on lines 378..379

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            return parseFloat(String(x.tooltip_tables[0].filter(function(x) {
              return x[0] === attr;})[0][1]).replace(/[^\d.-]/g, ''));
    Severity: Major
    Found in js/clinicalTimeline.js and 1 other location - About 1 hr to fix
    js/clinicalTimeline.js on lines 389..390

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          for( var i=0 ; i<element.length ; i++)
          {
            element[i].setAttribute("stroke" , "black");
            element[i].setAttribute("fill" , "none");
              
    Severity: Major
    Found in js/plugins/exportTimeline.js and 1 other location - About 1 hr to fix
    js/plugins/exportTimeline.js on lines 28..33

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          for( var i=0 ; i<element.length ; i++)
          {
            element[i].setAttribute("stroke" , "black");
            element[i].setAttribute("fill" , "none");
              
    Severity: Major
    Found in js/plugins/exportTimeline.js and 1 other location - About 1 hr to fix
    js/plugins/exportTimeline.js on lines 66..71

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        endAllowedOverview = overViewScale(clinicalTimelineUtil.roundUp(readOnlyVars.maxDays, clinicalTimelineUtil.getDifferenceTicksDays(originalZoomLevel))) - overViewScale(clinicalTimelineUtil.roundUp(readOnlyVars.maxDays, clinicalTimelineUtil.getDifferenceTicksDays(zoomLevel)));
    Severity: Major
    Found in js/plugins/overviewAxis.js and 1 other location - About 1 hr to fix
    js/plugins/overviewAxis.js on lines 32..32

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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
    Severity: Minor
    Found in js/plugins/exportTimeline.js - About 1 hr 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 addNewTrackTooltip has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function addNewTrackTooltip(elem) {
        elem.qtip({
        content: {
          text: 'addtrack'
        },
    Severity: Minor
    Found in js/clinicalTimeline.js - About 1 hr to fix

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

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

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

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

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

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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    function validateTooltipTables(tooltip_tables) {
                      for (var i=0; i < tooltip_tables.length; i++) {
                        validateTooltipTable(tooltip_tables[i]);
                      }
                    }
                  Severity: Major
                  Found in js/sanity.js and 2 other locations - About 50 mins to fix
                  js/sanity.js on lines 6..10
                  js/sanity.js on lines 22..26

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 47.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    function validateTimes(times) {
                      for (var i=0; i < times.length; i++) {
                        validateTime(times[i]);
                      }
                    }
                  Severity: Major
                  Found in js/sanity.js and 2 other locations - About 50 mins to fix
                  js/sanity.js on lines 6..10
                  js/sanity.js on lines 32..36

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 47.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    function validateData(data) {
                      for (var i=0; i < data.length; i++) {
                        validateTrack(data[i]);
                      }
                    }
                  Severity: Major
                  Found in js/sanity.js and 2 other locations - About 50 mins to fix
                  js/sanity.js on lines 22..26
                  js/sanity.js on lines 32..36

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 47.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Avoid deeply nested control flow statements.
                  Open

                            for (i=minTime.toDays(); i <= maxTime.toDays(); i++) {
                                tickValues.push(i);
                            }
                  Severity: Major
                  Found in js/clinicalTimeline.js - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language