enclose-io/compiler

View on GitHub
current/deps/v8/tools/profview/profview.js

Summary

Maintainability
F
3 mos
Test Coverage

File profview.js has 1292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

"use strict"
Severity: Major
Found in current/deps/v8/tools/profview/profview.js - About 3 days to fix

    Function render has 194 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render(newState) {
        let oldState = this.currentState;
    
        if (!newState.file) {
          this.element.style.display = "none";
    Severity: Major
    Found in current/deps/v8/tools/profview/profview.js - About 7 hrs to fix

      Function render has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

        render(newState) {
          let oldState = this.currentState;
      
          if (!newState.file) {
            this.element.style.display = "none";
      Severity: Minor
      Found in current/deps/v8/tools/profview/profview.js - About 7 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 render has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render(newState) {
          let oldState = this.currentState;
      
          if (!newState.file || newState.mode !== "summary") {
            this.element.style.display = "none";
      Severity: Major
      Found in current/deps/v8/tools/profview/profview.js - About 5 hrs to fix

        Function render has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

          render(newState) {
            let oldState = this.currentState;
        
            if (!newState.file || newState.mode !== "summary") {
              this.element.style.display = "none";
        Severity: Minor
        Found in current/deps/v8/tools/profview/profview.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 expandTree has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          expandTree(tree, indent) {
            let index = 0;
            let id = "R/";
            let row = tree.row;
        
        
        Severity: Major
        Found in current/deps/v8/tools/profview/profview.js - About 2 hrs to fix

          Function expandTree has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            expandTree(tree, indent) {
              let index = 0;
              let id = "R/";
              let row = tree.row;
          
          
          Severity: Minor
          Found in current/deps/v8/tools/profview/profview.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 constructor has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor(file) {
              this.scripts = new Map();
              for (let i = 0; i < file.scripts.length; i++) {
                const scriptBlock = file.scripts[i];
                if (scriptBlock === null) continue; // Array may be sparse.
          Severity: Minor
          Found in current/deps/v8/tools/profview/profview.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 render has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render(newState) {
              let oldState = this.currentState;
              if (!newState.file || !CallTreeView.isCallTreeMode(newState.mode)) {
                this.element.style.display = "none";
                this.currentState = null;
          Severity: Major
          Found in current/deps/v8/tools/profview/profview.js - About 2 hrs to fix

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

              render(newState) {
                let oldState = this.currentState;
                if (!newState.file || !CallTreeView.isCallTreeMode(newState.mode)) {
                  this.element.style.display = "none";
                  this.currentState = null;
            Severity: Minor
            Found in current/deps/v8/tools/profview/profview.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 fillSelects has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              fillSelects(mode, calltree) {
                function addOptions(e, values, current) {
                  while (e.options.length > 0) {
                    e.remove(0);
                  }
            Severity: Major
            Found in current/deps/v8/tools/profview/profview.js - About 2 hrs to fix

              Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                render(newState) {
                  let oldState = this.currentState;
                  if (!newState.file || !newState.viewingSource) {
                    this.table.style.display = "none";
                    this.hideButton.style.display = "none";
              Severity: Minor
              Found in current/deps/v8/tools/profview/profview.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 render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render(newState) {
                  let oldState = this.currentState;
                  if (!newState.file || !newState.viewingSource) {
                    this.table.style.display = "none";
                    this.hideButton.style.display = "none";
              Severity: Major
              Found in current/deps/v8/tools/profview/profview.js - About 2 hrs to fix

                Function drawSelection has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  drawSelection() {
                    let ctx = this.canvas.getContext("2d");
                
                    // Draw the timeline image.
                    ctx.drawImage(this.buffer, 0, this.imageOffset);
                Severity: Minor
                Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                  Function onMouseUp has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    onMouseUp(e) {
                      if (this.selectionStart !== null) {
                        let x = e.clientX - this.canvas.getBoundingClientRect().left;
                        if (Math.abs(x - this.selectionStart) < 10) {
                          this.selectionStart = null;
                  Severity: Minor
                  Found in current/deps/v8/tools/profview/profview.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 drawSelection has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    drawSelection() {
                      let ctx = this.canvas.getContext("2d");
                  
                      // Draw the timeline image.
                      ctx.drawImage(this.buffer, 0, this.imageOffset);
                  Severity: Minor
                  Found in current/deps/v8/tools/profview/profview.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 constructor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    constructor(file) {
                      this.scripts = new Map();
                      for (let i = 0; i < file.scripts.length; i++) {
                        const scriptBlock = file.scripts[i];
                        if (scriptBlock === null) continue; // Array may be sparse.
                  Severity: Minor
                  Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                    Function codeTypeToText has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function codeTypeToText(type) {
                      switch (type) {
                        case "UNKNOWN":
                          return "Unknown";
                        case "CPPPARSE":
                    Severity: Minor
                    Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                      Function onMouseUp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        onMouseUp(e) {
                          if (this.selectionStart !== null) {
                            let x = e.clientX - this.canvas.getBoundingClientRect().left;
                            if (Math.abs(x - this.selectionStart) < 10) {
                              this.selectionStart = null;
                      Severity: Minor
                      Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                        Function generateSourceView has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          generateSourceView(functionId) {
                            console.assert(this.hasSource(functionId));
                            let data = this.functions.get(functionId);
                            let scriptId = data.scriptId;
                            let script = this.getScript(scriptId);
                        Severity: Minor
                        Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                          Function addExpandableRow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function addExpandableRow(text, list, indent, kind) {
                                let row = rows.insertRow(-1);
                          
                                row.id = "opt-table/" + kind + "/";
                                row.style.backgroundColor = CATEGORY_COLOR;
                          Severity: Minor
                          Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                            Function setMode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              setMode(mode) {
                                if (mode !== main.currentState.mode) {
                            
                                  function setCallTreeModifiers(attribution, categories, sort) {
                                    let callTreeState = Object.assign({}, main.currentState.callTree);
                            Severity: Minor
                            Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                              Function sortFromId has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                sortFromId(id) {
                                  switch (id) {
                                    case "time":
                                      return (c1, c2) => {
                                        if (c1.ticks < c2.ticks) return 1;
                              Severity: Minor
                              Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                      if (newState.file === oldState.file &&
                                          newState.start === oldState.start &&
                                          newState.end === oldState.end &&
                                          newState.mode === oldState.mode &&
                                          newState.callTree.attribution === oldState.callTree.attribution &&
                                Severity: Major
                                Found in current/deps/v8/tools/profview/profview.js - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                        if (width === oldState.timelineSize.width &&
                                            height === oldState.timelineSize.height &&
                                            newState.file === oldState.file &&
                                            newState.currentCodeId === oldState.currentCodeId &&
                                            newState.start === oldState.start &&
                                  Severity: Major
                                  Found in current/deps/v8/tools/profview/profview.js - About 40 mins to fix

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

                                        function expandDeoptFunctionList(row, arrow, list, indent, kind) {
                                    Severity: Minor
                                    Found in current/deps/v8/tools/profview/profview.js - About 35 mins to fix

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

                                          function expandOptimizedFunctionList(row, arrow, list, indent, kind) {
                                      Severity: Minor
                                      Found in current/deps/v8/tools/profview/profview.js - About 35 mins to fix

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

                                            function expandDeoptInstances(row, arrow, instances, indent, kind) {
                                        Severity: Minor
                                        Found in current/deps/v8/tools/profview/profview.js - About 35 mins to fix

                                          Function bucketFromKind has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                          function bucketFromKind(kind) {
                                            for (let i = 0; i < bucketDescriptors.length; i++) {
                                              let bucket = bucketDescriptors[i];
                                              for (let j = 0; j < bucket.kinds.length; j++) {
                                                if (bucket.kinds[j] === kind) {
                                          Severity: Minor
                                          Found in current/deps/v8/tools/profview/profview.js - About 25 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

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

                                          class TimelineView {
                                            constructor() {
                                              this.element = $("timeline");
                                              this.canvas = $("timeline-canvas");
                                              this.legend = $("timeline-legend");
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 3 wks to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 707..1079

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

                                          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

                                          class CallTreeView {
                                            constructor() {
                                              this.element = $("calltree");
                                              this.treeElement = $("calltree-table");
                                              this.selectAttribution = $("calltree-attribution");
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 2 wks to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 386..705

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

                                          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

                                          class SummaryView {
                                            constructor() {
                                              this.element = $("summary");
                                              this.currentState = null;
                                            }
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 wk to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1116..1291

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

                                          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

                                          let main = {
                                            currentState : emptyState(),
                                            renderPending : false,
                                          
                                            setMode(mode) {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 wk to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 56..211

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

                                          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

                                          class SourceData {
                                            constructor(file) {
                                              this.scripts = new Map();
                                              for (let i = 0; i < file.scripts.length; i++) {
                                                const scriptBlock = file.scripts[i];
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 5 days to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1366..1455

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

                                          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

                                          class ScriptSourceView {
                                            constructor() {
                                              this.table = $("source-viewer");
                                              this.hideButton = $("source-viewer-hide-button");
                                              this.hideButton.onclick = () => {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 4 days to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1293..1364

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

                                          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

                                          class ModeBarView {
                                            constructor() {
                                              let modeBar = this.element = $("mode-bar");
                                          
                                              function addMode(id, text, active) {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 day to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1081..1114

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

                                          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

                                          const bucketDescriptors =
                                              [ { kinds : [ "JSOPT" ],
                                                  color : "#64dd17",
                                                  backgroundColor : "#80e27e",
                                                  text : "JS Optimized" },
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 day to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 214..259

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

                                          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

                                          class SourcePositionTable {
                                            constructor(encodedTable) {
                                              this.offsetTable = [];
                                              let offsetPairRegex = /C([0-9]+)O([0-9]+)/g;
                                              while (true) {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 day to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1479..1502

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

                                          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

                                          class FunctionSourceData {
                                            constructor(scriptId, startScriptOffset, endScriptOffset) {
                                              this.scriptId = scriptId;
                                              this.startScriptOffset = startScriptOffset;
                                              this.endScriptOffset = endScriptOffset;
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 6 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1457..1477

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

                                          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

                                          function createFunctionNode(name, codeId) {
                                            let nameElement = document.createElement("span");
                                            nameElement.appendChild(document.createTextNode(name));
                                            nameElement.classList.add("tree-row-name");
                                            if (codeId !== -1) {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 4 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 353..367

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

                                          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

                                          function codeTypeToText(type) {
                                            switch (type) {
                                              case "UNKNOWN":
                                                return "Unknown";
                                              case "CPPPARSE":
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 4 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 281..315

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

                                          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

                                          function createViewSourceNode(codeId) {
                                            let linkElement = document.createElement("span");
                                            linkElement.appendChild(document.createTextNode("View source"));
                                            linkElement.classList.add("view-source-link");
                                            linkElement.onclick = (event) => {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 4 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 369..381

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

                                          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

                                          function bucketFromKind(kind) {
                                            for (let i = 0; i < bucketDescriptors.length; i++) {
                                              let bucket = bucketDescriptors[i];
                                              for (let j = 0; j < bucket.kinds.length; j++) {
                                                if (bucket.kinds[j] === kind) {
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 3 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 269..279

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

                                          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 (let i = 0; i < bucketDescriptors.length; i++) {
                                            let bucket = bucketDescriptors[i];
                                            for (let j = 0; j < bucket.kinds.length; j++) {
                                              kindToBucketDescriptor[bucket.kinds[j]] = bucket;
                                            }
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 2 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 262..267

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

                                          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

                                          function emptyState() {
                                            return {
                                              file : null,
                                              mode : null,
                                              currentCodeId : null,
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 2 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 29..48

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

                                          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

                                          function createTypeNode(type) {
                                            if (type === "CAT") {
                                              return document.createTextNode("");
                                            }
                                            let span = document.createElement("span");
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 2 hrs to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 317..326

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

                                          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

                                          class HelpView {
                                            constructor() {
                                              this.element = $("help");
                                            }
                                          
                                          
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 hr to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 1504..1512

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

                                          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

                                          function filterFromFilterId(id) {
                                            switch (id) {
                                              case "full-tree":
                                                return (type, kind) => true;
                                              case "js-funs":
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 hr to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 328..338

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

                                          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

                                          function createIndentNode(indent) {
                                            let div = document.createElement("div");
                                            div.style.display = "inline-block";
                                            div.style.width = (indent + 0.5) + "em";
                                            return div;
                                          Severity: Major
                                          Found in current/deps/v8/tools/profview/profview.js and 1 other location - About 1 hr to fix
                                          lts/deps/v8/tools/profview/profview.js on lines 340..345

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

                                          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