autolab/Autolab

View on GitHub
app/assets/javascripts/tango_status.js

Summary

Maintainability
C
1 day
Test Coverage

Function plotEventDrops has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var plotEventDrops = function(data) {
  var minDates = jQuery.map(data, function(h) {
    return Math.min.apply(null, h['dates']);
  });
  var startTime = new Date(Math.min.apply(null, minDates));
Severity: Major
Found in app/assets/javascripts/tango_status.js - About 3 hrs to fix

    Function plotEventDrops has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    var plotEventDrops = function(data) {
      var minDates = jQuery.map(data, function(h) {
        return Math.min.apply(null, h['dates']);
      });
      var startTime = new Date(Math.min.apply(null, minDates));
    Severity: Minor
    Found in app/assets/javascripts/tango_status.js - About 2 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 plotTimeSeries has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var plotTimeSeries = function(data) {
      // Initialize Dataset
      var new_jobs = data[0];
      var eventarr = [];
      for (var i = 0; i < new_jobs.dates.length; i++) {
    Severity: Major
    Found in app/assets/javascripts/tango_status.js - About 2 hrs to fix

      Function plot_diagram has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var plot_diagram = function(pool) {
          current_plot = pool;
          var title = "Job Runtime History for ";
          title += pool == '' ? "Global" : pool;
          MG.data_graphic({
      Severity: Minor
      Found in app/assets/javascripts/tango_status.js - About 1 hr to fix

        Function plotTimeSeries has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        var plotTimeSeries = function(data) {
          // Initialize Dataset
          var new_jobs = data[0];
          var eventarr = [];
          for (var i = 0; i < new_jobs.dates.length; i++) {
        Severity: Minor
        Found in app/assets/javascripts/tango_status.js - About 55 mins 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

        There are no issues that match your filters.

        Category
        Status