enclose-io/compiler

View on GitHub
lts/lib/perf_hooks.js

Summary

Maintainability
F
2 wks
Test Coverage

File perf_hooks.js has 518 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const {
  ArrayIsArray,
  Boolean,
Severity: Major
Found in lts/lib/perf_hooks.js - About 1 day to fix

    Function collectHttp2Stats has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function collectHttp2Stats(entry) {
      if (http2 === undefined) http2 = internalBinding('http2');
      switch (entry.name) {
        case 'Http2Stream':
          if (streamStats === undefined)
    Severity: Minor
    Found in lts/lib/perf_hooks.js - About 1 hr to fix

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

        constructor(callback) {
          if (typeof callback !== 'function') {
            throw new ERR_INVALID_CALLBACK(callback);
          }
          super('PerformanceObserver');
      Severity: Minor
      Found in lts/lib/perf_hooks.js - About 1 hr to fix

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

          observe(options) {
            if (typeof options !== 'object' || options === null) {
              throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
            }
            const { entryTypes } = options;
        Severity: Minor
        Found in lts/lib/perf_hooks.js - About 1 hr to fix

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

            [kGetEntries](name, type) {
              const ret = [];
              const list = this[kEntries];
              if (!L.isEmpty(list)) {
                let item = L.peek(list);
          Severity: Minor
          Found in lts/lib/perf_hooks.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 timerify has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            timerify(fn) {
              if (typeof fn !== 'function') {
                throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
              }
              if (fn[kTimerified])
          Severity: Minor
          Found in lts/lib/perf_hooks.js - About 1 hr to fix

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

              observe(options) {
                if (typeof options !== 'object' || options === null) {
                  throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
                }
                const { entryTypes } = options;
            Severity: Minor
            Found in lts/lib/perf_hooks.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 observersCallback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function observersCallback(entry) {
              const type = mapTypes(entry.entryType);
            
              if (type === NODE_PERFORMANCE_ENTRY_TYPE_HTTP2)
                collectHttp2Stats(entry);
            Severity: Minor
            Found in lts/lib/perf_hooks.js - About 45 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 collectHttp2Stats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function collectHttp2Stats(entry) {
              if (http2 === undefined) http2 = internalBinding('http2');
              switch (entry.name) {
                case 'Http2Stream':
                  if (streamStats === undefined)
            Severity: Minor
            Found in lts/lib/perf_hooks.js - About 45 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 PerformanceObserver extends AsyncResource {
              constructor(callback) {
                if (typeof callback !== 'function') {
                  throw new ERR_INVALID_CALLBACK(callback);
                }
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 3 days to fix
            current/lib/perf_hooks.js on lines 288..370

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

            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 Performance {
              constructor() {
                this[kIndex] = {
                  [kMarks]: new Set()
                };
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 3 days to fix
            current/lib/perf_hooks.js on lines 372..457

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

            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 PerformanceObserverEntryList {
              constructor() {
                ObjectDefineProperties(this, {
                  [kEntries]: {
                    writable: true,
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 2 days to fix
            current/lib/perf_hooks.js on lines 227..286

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

            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 collectHttp2Stats(entry) {
              if (http2 === undefined) http2 = internalBinding('http2');
              switch (entry.name) {
                case 'Http2Stream':
                  if (streamStats === undefined)
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 1 day to fix
            current/lib/perf_hooks.js on lines 111..153

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

            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 PerformanceNodeTiming extends PerformanceEntry {
              get name() {
                return 'node';
              }
            
            
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 1 day to fix
            current/lib/perf_hooks.js on lines 167..222

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

            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 observersCallback(entry) {
              const type = mapTypes(entry.entryType);
            
              if (type === NODE_PERFORMANCE_ENTRY_TYPE_HTTP2)
                collectHttp2Stats(entry);
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 1 day to fix
            current/lib/perf_hooks.js on lines 481..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 198.

            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 sortedInsert(list, entry) {
              const entryStartTime = entry.startTime;
              if (list.length === 0 ||
                  (list[list.length - 1].startTime < entryStartTime)) {
                list.push(entry);
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 5 hrs to fix
            current/lib/perf_hooks.js on lines 549..562

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

            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 monitorEventLoopDelay(options = {}) {
              if (typeof options !== 'object' || options === null) {
                throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
              }
              const { resolution = 10 } = options;
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 4 hrs to fix
            current/lib/perf_hooks.js on lines 569..582

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

            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 getInsertLocation(list, entryStartTime) {
              let start = 0;
              let end = list.length;
              while (start < end) {
                const pivot = (end + start) >>> 1;
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 4 hrs to fix
            current/lib/perf_hooks.js on lines 534..547

            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

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

            const {
              ELDHistogram: _ELDHistogram,
              PerformanceEntry,
              mark: _mark,
              clearMark: _clearMark,
            Severity: Major
            Found in lts/lib/perf_hooks.js and 3 other locations - About 2 hrs to fix
            current/lib/buffer.js on lines 45..60
            current/lib/perf_hooks.js on lines 14..29
            lts/lib/buffer.js on lines 45..60

            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

            function doNotify(observer) {
              observer[kQueued] = false;
              observer.runInAsyncScope(observer[kCallback],
                                       observer,
                                       observer[kBuffer],
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 2 hrs to fix
            current/lib/perf_hooks.js on lines 470..478

            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

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

            const {
              NODE_PERFORMANCE_ENTRY_TYPE_NODE,
              NODE_PERFORMANCE_ENTRY_TYPE_MARK,
              NODE_PERFORMANCE_ENTRY_TYPE_MEASURE,
              NODE_PERFORMANCE_ENTRY_TYPE_GC,
            Severity: Major
            Found in lts/lib/perf_hooks.js and 6 other locations - About 1 hr to fix
            current/lib/_tls_wrap.js on lines 59..73
            current/lib/internal/error_serdes.js on lines 4..18
            current/lib/internal/url.js on lines 3..17
            current/lib/perf_hooks.js on lines 31..46
            lts/lib/_tls_wrap.js on lines 56..70
            lts/lib/internal/url.js on lines 3..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 73.

            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 mapTypes(i) {
              switch (i) {
                case 'node': return NODE_PERFORMANCE_ENTRY_TYPE_NODE;
                case 'mark': return NODE_PERFORMANCE_ENTRY_TYPE_MARK;
                case 'measure': return NODE_PERFORMANCE_ENTRY_TYPE_MEASURE;
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 1 hr to fix
            current/lib/perf_hooks.js on lines 518..528

            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 getObserversList(type) {
              let list = observers[type];
              if (list === undefined) {
                list = observers[type] = {};
                L.init(list);
            Severity: Major
            Found in lts/lib/perf_hooks.js and 1 other location - About 1 hr to fix
            current/lib/perf_hooks.js on lines 461..468

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

            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 ELDHistogram extends Histogram {
              enable() { return this[kHandle].enable(); }
              disable() { return this[kHandle].disable(); }
            }
            Severity: Minor
            Found in lts/lib/perf_hooks.js and 1 other location - About 50 mins to fix
            current/lib/perf_hooks.js on lines 564..567

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

            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 16 locations. Consider refactoring.
            Open

            const {
              ArrayIsArray,
              Boolean,
              NumberIsSafeInteger,
              ObjectDefineProperties,
            Severity: Major
            Found in lts/lib/perf_hooks.js and 15 other locations - About 40 mins to fix
            current/lib/internal/http2/compat.js on lines 3..12
            current/lib/internal/http2/util.js on lines 3..12
            lts/lib/internal/http2/compat.js on lines 3..12
            lts/lib/internal/http2/util.js on lines 3..12
            current/lib/_http_client.js on lines 24..33
            current/lib/_http_outgoing.js on lines 24..33
            current/lib/_stream_readable.js on lines 24..33
            current/lib/assert.js on lines 23..32
            current/lib/fs.js on lines 31..40
            current/lib/internal/async_hooks.js on lines 3..12
            current/lib/net.js on lines 24..33
            current/lib/perf_hooks.js on lines 3..12
            lts/lib/_stream_readable.js on lines 24..33
            lts/lib/fs.js on lines 27..36
            lts/lib/net.js on lines 24..33

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

            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 now() {
              const hr = process.hrtime();
              return hr[0] * 1000 + hr[1] / 1e6;
            }
            Severity: Minor
            Found in lts/lib/perf_hooks.js and 1 other location - About 30 mins to fix
            current/lib/perf_hooks.js on lines 155..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 45.

            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