enclose-io/compiler

View on GitHub
current/deps/v8/tools/heap-stats/trace-file-reader.js

Summary

Maintainability
F
1 wk
Test Coverage

File trace-file-reader.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2018 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: Minor
Found in current/deps/v8/tools/heap-stats/trace-file-reader.js - About 2 hrs to fix

    Function createModelFromV8TraceFile has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      createModelFromV8TraceFile(contents) {
        console.log('Processing log as V8 trace file.');
        contents = contents.map(function(line) {
          try {
            // Strip away a potentially present adb logcat prefix.
    Severity: Major
    Found in current/deps/v8/tools/heap-stats/trace-file-reader.js - About 2 hrs to fix

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

        createModelFromChromeTraceFile(contents) {
          const data = Object.create(null);  // Final data container.
          const parseOneGCEvent = (actual_data) => {
            Object.keys(actual_data).forEach(data_set => {
              const string_entry = actual_data[data_set];
      Severity: Major
      Found in current/deps/v8/tools/heap-stats/trace-file-reader.js - About 2 hrs to fix

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

          readFile(file) {
            if (!file) {
              this.updateLabel('Failed to load file.');
              return;
            }
        Severity: Minor
        Found in current/deps/v8/tools/heap-stats/trace-file-reader.js - About 1 hr to fix

          Function parseOneGCEvent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const parseOneGCEvent = (actual_data) => {
                Object.keys(actual_data).forEach(data_set => {
                  const string_entry = actual_data[data_set];
                  try {
                    const entry = JSON.parse(string_entry);
          Severity: Minor
          Found in current/deps/v8/tools/heap-stats/trace-file-reader.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                    if (entry.id in data[entry.isolate].gcs) {
                      this.createOrUpdateEntryIfNeeded(data, entry);
                      this.createDatasetIfNeeded(data, entry, entry.key);
                      data[entry.isolate].gcs[entry.id][entry.key].bucket_sizes =
                          entry.sizes;
            Severity: Major
            Found in current/deps/v8/tools/heap-stats/trace-file-reader.js - About 45 mins to fix

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

                createModelFromV8TraceFile(contents) {
                  console.log('Processing log as V8 trace file.');
                  contents = contents.map(function(line) {
                    try {
                      // Strip away a potentially present adb logcat prefix.
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 4 days to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 253..316

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

              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

                readFile(file) {
                  if (!file) {
                    this.updateLabel('Failed to load file.');
                    return;
                  }
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 2 days to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 58..96

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

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

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

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

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

              Refactorings

              Further Reading

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

                    Object.keys(actual_data).forEach(data_set => {
                      const string_entry = actual_data[data_set];
                      try {
                        const entry = JSON.parse(string_entry);
                        this.createOrUpdateEntryIfNeeded(data, entry);
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 1 day to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 211..245

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

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

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

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

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

              Refactorings

              Further Reading

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

                createOrUpdateEntryIfNeeded(data, entry) {
                  console.assert(entry.isolate, 'entry should have an isolate');
                  if (!(entry.isolate in data)) {
                    data[entry.isolate] = new Isolate(entry.isolate);
                  }
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 1 day to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 109..126

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

              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

                addInstanceTypeData(data, isolate, gc_id, data_set, instance_type, entry) {
                  data[isolate].gcs[gc_id][data_set].instance_type_data[instance_type] = {
                    overall: entry.overall,
                    count: entry.count,
                    histogram: entry.histogram,
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 1 day to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 153..168

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

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

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

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

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

              Refactorings

              Further Reading

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

                createDatasetIfNeeded(data, entry, data_set) {
                  if (!(data_set in data[entry.isolate].gcs[entry.id])) {
                    data[entry.isolate].gcs[entry.id][data_set] = {
                      instance_type_data: {},
                      non_empty_instance_types: new Set(),
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 4 hrs to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 128..137

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

              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

                addFieldTypeData(data, isolate, gc_id, data_set, tagged_fields,
                                 inobject_smi_fields, embedder_fields, unboxed_double_fields,
                                 boxed_double_fields, string_data, other_raw_fields) {
                  data[isolate].gcs[gc_id][data_set].field_data = {
                    tagged_fields,
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 2 hrs to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 139..151

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

              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

                extendAndSanitizeModel(data) {
                  const checkNonNegativeProperty = (obj, property) => {
                    console.assert(obj[property] >= 0, 'negative property', obj, property);
                  };
              
              
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 2 hrs to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 170..176

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

              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

                handleChange(event) {
                  // Used for drop and file change.
                  event.preventDefault();
                  var host = event.dataTransfer ? event.dataTransfer : event.target;
                  this.readFile(host.files[0]);
              Severity: Major
              Found in current/deps/v8/tools/heap-stats/trace-file-reader.js and 1 other location - About 1 hr to fix
              lts/deps/v8/tools/heap-stats/trace-file-reader.js on lines 43..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 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