deps/v8/tools/profviz/composer.js

Summary

Maintainability
F
1 wk
Test Coverage

Function PlotScriptComposer has a Cognitive Complexity of 162 (exceeds 5 allowed). Consider refactoring.
Open

function PlotScriptComposer(kResX, kResY, error_output) {
  // Constants.
  var kV8BinarySuffixes = ["/d8", "/libv8.so"];
  var kStackFrames = 8;             // Stack frames to display in the plot.

Severity: Minor
Found in deps/v8/tools/profviz/composer.js - About 3 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 PlotScriptComposer has 427 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function PlotScriptComposer(kResX, kResY, error_output) {
  // Constants.
  var kV8BinarySuffixes = ["/d8", "/libv8.so"];
  var kStackFrames = 8;             // Stack frames to display in the plot.

Severity: Major
Found in deps/v8/tools/profviz/composer.js - About 2 days to fix

    File composer.js has 433 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2013 the V8 project authors. All rights reserved.
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions are
    // met:
    //
    Severity: Minor
    Found in deps/v8/tools/profviz/composer.js - About 6 hrs to fix

      Function assembleOutput has 132 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.assembleOutput = function(output) {
          output("set yrange [0:" + (num_timer_event + 1) + "]");
          output("set xlabel \"execution time in ms\"");
          output("set xrange [" + range_start + ":" + range_end + "]");
          output("set style fill pattern 2 bo 1");
      Severity: Major
      Found in deps/v8/tools/profviz/composer.js - About 5 hrs to fix

        Function collectData has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          this.collectData = function(input, distortion_per_entry) {
        
            var last_timestamp = 0;
        
            // Parse functions.
        Severity: Major
        Found in deps/v8/tools/profviz/composer.js - About 4 hrs to fix

          Function findPlotRange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.findPlotRange = function(
              range_start_override, range_end_override, result_callback) {
              var start_found = (range_start_override || range_start_override == 0);
              var end_found = (range_end_override || range_end_override == 0);
              range_start = start_found ? range_start_override : Infinity;
          Severity: Minor
          Found in deps/v8/tools/profviz/composer.js - About 1 hr to fix

            Function DrawBarBase has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function DrawBarBase(color, start, end, top, bottom, transparency) {
            Severity: Minor
            Found in deps/v8/tools/profviz/composer.js - About 45 mins to fix

              Function processTickEvent has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      pc, timer, unused_x, unused_y, vmstate, stack) {
              Severity: Minor
              Found in deps/v8/tools/profviz/composer.js - About 45 mins to fix

                Function processCodeCreateEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    var processCodeCreateEvent = function(type, kind, address, size, name) {
                Severity: Minor
                Found in deps/v8/tools/profviz/composer.js - About 35 mins to fix

                  Function DrawHalfBar has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      function DrawHalfBar(row, color, start, end, width) {
                  Severity: Minor
                  Found in deps/v8/tools/profviz/composer.js - About 35 mins to fix

                    Function DrawBar has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        function DrawBar(row, color, start, end, width) {
                    Severity: Minor
                    Found in deps/v8/tools/profviz/composer.js - About 35 mins to fix

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

                            for (codekind in CodeKinds) {
                              var ticks = CodeKinds[codekind].in_execution;
                              for (var i = 0; i < ticks.length; i++) {
                                if (ticks[i].tick < range_start && !start_found) {
                                  range_start = ticks[i].tick;
                      Severity: Major
                      Found in deps/v8/tools/profviz/composer.js and 1 other location - About 4 hrs to fix
                      deps/v8/tools/profviz/composer.js on lines 356..366

                      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 131.

                      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

                            for (name in TimerEvents) {
                              var ranges = TimerEvents[name].ranges;
                              for (var i = 0; i < ranges.length; i++) {
                                if (ranges[i].start < range_start && !start_found) {
                                  range_start = ranges[i].start;
                      Severity: Major
                      Found in deps/v8/tools/profviz/composer.js and 1 other location - About 4 hrs to fix
                      deps/v8/tools/profviz/composer.js on lines 368..378

                      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 131.

                      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

                              for (var j = 0; j < row.length; j++) {
                                DrawBar(offset, code_kind.color,
                                        row[j].start, row[j].end, kStackFrameWidth);
                              }
                      Severity: Major
                      Found in deps/v8/tools/profviz/composer.js and 1 other location - About 1 hr to fix
                      deps/v8/tools/profviz/composer.js on lines 484..487

                      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 58.

                      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

                            for (var j = 0; j < row.length; j++) {
                              DrawBar(offset, code_kind.color,
                                      row[j].start, row[j].end, kExecutionFrameWidth);
                            }
                      Severity: Major
                      Found in deps/v8/tools/profviz/composer.js and 1 other location - About 1 hr to fix
                      deps/v8/tools/profviz/composer.js on lines 493..496

                      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 58.

                      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

                      There are no issues that match your filters.

                      Category
                      Status