enclose-io/compiler

View on GitHub
lts/deps/v8/tools/parse-processor.js

Summary

Maintainability
F
2 mos
Test Coverage

File parse-processor.js has 901 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 lts/deps/v8/tools/parse-processor.js - About 2 days to fix

    ParseProcessor has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ParseProcessor extends LogReader {
      constructor() {
        super();
        this.dispatchTable_ = {
          // Avoid accidental leaking of __proto__ properties and force this object
    Severity: Minor
    Found in lts/deps/v8/tools/parse-processor.js - About 3 hrs to fix

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

        getAccumulatedTimeMetrics(
            metrics, start, end, delta, cumulative = true, useDuration = false) {
          // Returns an array of the following format:
          // [ [start,         acc(metric0, start, start), acc(metric1, ...), ...],
          //   [start+delta,   acc(metric0, start, start+delta), ...],
      Severity: Minor
      Found in lts/deps/v8/tools/parse-processor.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 getAccumulatedTimeMetrics has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getAccumulatedTimeMetrics(
            metrics, start, end, delta, cumulative = true, useDuration = false) {
          // Returns an array of the following format:
          // [ [start,         acc(metric0, start, start), acc(metric1, ...), ...],
          //   [start+delta,   acc(metric0, start, start+delta), ...],
      Severity: Major
      Found in lts/deps/v8/tools/parse-processor.js - About 2 hrs to fix

        Function constructor has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor() {
            super();
            this.dispatchTable_ = {
              // Avoid accidental leaking of __proto__ properties and force this object
              // to be in dictionary-mode.
        Severity: Major
        Found in lts/deps/v8/tools/parse-processor.js - About 2 hrs to fix

          Function calculateMetrics has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            calculateMetrics(printSummary) {
              let log = (str) => this.summary += str + '\n';
              log("SCRIPT: " + this.id);
              let all = this.funktions;
              if (all.length === 0) return;
          Severity: Minor
          Found in lts/deps/v8/tools/parse-processor.js - About 2 hrs to fix

            Function finalize has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              finalize() {
                this.finalized = true;
                // Compact funktions as we no longer need access via start byte position.
                this.funktions = this.funktions.filter(each => true);
                let parent = null;
            Severity: Minor
            Found in lts/deps/v8/tools/parse-processor.js - About 1 hr to fix

              Function processScriptEvent has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                processScriptEvent(eventName, scriptId, timestamp) {
                  let script = this.idToScript.get(scriptId);
                  switch (eventName) {
                    case 'create':
                    case 'reserve-id':
              Severity: Minor
              Found in lts/deps/v8/tools/parse-processor.js - About 1 hr to fix

                Function constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  constructor(name, start, end, script) {
                    super();
                    if (start < 0) throw "invalid start position: " + start;
                    if (script.isEval) {
                      if (end < start) throw 'invalid start end positions';
                Severity: Minor
                Found in lts/deps/v8/tools/parse-processor.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  constructor() {
                    this.isEval = false;
                
                    // Lazily computed properties.
                    this.firstEventTimestamp = -1;
                Severity: Minor
                Found in lts/deps/v8/tools/parse-processor.js - About 1 hr to fix

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

                    postProcess() {
                      this.scripts = Array.from(this.idToScript.values())
                        .filter(each => !each.isNative);
                  
                      this.scripts.forEach(script => {
                  Severity: Minor
                  Found in lts/deps/v8/tools/parse-processor.js - About 1 hr to fix

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

                      finalize() {
                        this.finalized = true;
                        // Compact funktions as we no longer need access via start byte position.
                        this.funktions = this.funktions.filter(each => true);
                        let parent = null;
                    Severity: Minor
                    Found in lts/deps/v8/tools/parse-processor.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

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

                      processScriptEvent(eventName, scriptId, timestamp) {
                        let script = this.idToScript.get(scriptId);
                        switch (eventName) {
                          case 'create':
                          case 'reserve-id':
                    Severity: Minor
                    Found in lts/deps/v8/tools/parse-processor.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

                    Function processFirstExecution has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      processFirstExecution(
                          scriptId, startPosition, endPosition, duration, timestamp, functionName) {
                        let script = this.lookupScript(scriptId);
                        if (startPosition === 0) {
                          // undefined = eval fn execution
                    Severity: Minor
                    Found in lts/deps/v8/tools/parse-processor.js - About 35 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

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

                      rawTimestampMin(...timestamps) {
                        timestamps = timestamps.length == 1 ? timestamps[0] : timestamps;
                        let result = timestamps.reduce((min, item) => {
                          return item == -1 ? min : (min == -1 ? item : Math.min(item, item));
                        }, -1);
                    Severity: Minor
                    Found in lts/deps/v8/tools/parse-processor.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 Script extends CompilationUnit {
                      constructor(id) {
                        super();
                        if (id === void 0 || id <= 0) {
                          throw new Error(`Invalid id=${id} for script`);
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 2 wks to fix
                    current/deps/v8/tools/parse-processor.js on lines 161..511

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

                    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 ParseProcessor extends LogReader {
                      constructor() {
                        super();
                        this.dispatchTable_ = {
                          // Avoid accidental leaking of __proto__ properties and force this object
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 2 wks to fix
                    current/deps/v8/tools/parse-processor.js on lines 747..1130

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

                    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 Funktion extends CompilationUnit {
                      constructor(name, start, end, script) {
                        super();
                        if (start < 0) throw "invalid start position: " + start;
                        if (script.isEval) {
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 6 days to fix
                    current/deps/v8/tools/parse-processor.js on lines 621..728

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

                    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 CompilationUnit {
                      constructor() {
                        this.isEval = false;
                    
                        // Lazily computed properties.
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 5 days to fix
                    current/deps/v8/tools/parse-processor.js on lines 63..158

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

                    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 NestingDistribution {
                      constructor(funktions) {
                        // Stores the nof bytes per function nesting level.
                        this.accumulator = [0, 0, 0, 0, 0];
                        // Max nof bytes encountered at any nesting level.
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 3 days to fix
                    current/deps/v8/tools/parse-processor.js on lines 541..584

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

                    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 ExecutionCost {
                      constructor(prefix, funktions, time_fn) {
                        this.prefix = prefix;
                        // Time spent on executed functions.
                        this.executedCost = 0
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 1 day to fix
                    current/deps/v8/tools/parse-processor.js on lines 586..617

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

                    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 TotalScript extends Script {
                      constructor() {
                        super('all files', 'all files');
                        this.scripts = [];
                      }
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 6 hrs to fix
                    current/deps/v8/tools/parse-processor.js on lines 514..536

                    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 BYTES(bytes, total) {
                      let units = ['B ', 'kB', 'mB', 'gB'];
                      let unitIndex = 0;
                      let value = bytes;
                      while (value > 1000 && unitIndex < units.length) {
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 5 hrs to fix
                    current/deps/v8/tools/parse-processor.js on lines 34..47

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

                    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 readFile(fileName) {
                      try {
                        return read(fileName);
                      } catch (e) {
                        console.log(fileName + ': ' + (e.message || e));
                    Severity: Major
                    Found in lts/deps/v8/tools/parse-processor.js and 1 other location - About 1 hr to fix
                    current/deps/v8/tools/parse-processor.js on lines 10..17

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

                    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