enclose-io/compiler

View on GitHub
lts/lib/internal/util.js

Summary

Maintainability
F
2 wks
Test Coverage

Function slowCases has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

function slowCases(enc) {
  switch (enc.length) {
    case 4:
      if (enc === 'UTF8') return 'utf8';
      if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le';
Severity: Minor
Found in lts/lib/internal/util.js - About 6 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

File util.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const {
  ArrayFrom,
  ArrayIsArray,
Severity: Minor
Found in lts/lib/internal/util.js - About 4 hrs to fix

    Function deprecate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function deprecate(fn, msg, code) {
      if (process.noDeprecation === true) {
        return fn;
      }
    
    
    Severity: Minor
    Found in lts/lib/internal/util.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 slowCases has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function slowCases(enc) {
      switch (enc.length) {
        case 4:
          if (enc === 'UTF8') return 'utf8';
          if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le';
    Severity: Minor
    Found in lts/lib/internal/util.js - About 1 hr to fix

      Function promisify has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function promisify(original) {
        if (typeof original !== 'function')
          throw new ERR_INVALID_ARG_TYPE('original', 'Function', original);
      
        if (original[kCustomPromisifiedSymbol]) {
      Severity: Minor
      Found in lts/lib/internal/util.js - About 1 hr to fix

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

        function deprecate(fn, msg, code) {
          if (process.noDeprecation === true) {
            return fn;
          }
        
        
        Severity: Minor
        Found in lts/lib/internal/util.js - About 1 hr to fix

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

          function isInsideNodeModules() {
            if (getStructuredStack === undefined) {
              // Lazy-load to avoid a circular dependency.
              const { runInNewContext } = require('vm');
              // Use `runInNewContext()` to get something tamper-proof and
          Severity: Minor
          Found in lts/lib/internal/util.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

          Avoid too many return statements within this function.
          Open

                if (enc === 'UCS-2') return 'utf16le';
          Severity: Major
          Found in lts/lib/internal/util.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  if (enc === 'ucs-2') return 'utf16le';
            Severity: Major
            Found in lts/lib/internal/util.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    if (enc === 'latin1' || enc === 'binary') return 'latin1';
              Severity: Major
              Found in lts/lib/internal/util.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      if (enc === 'ucs-2') return 'utf16le';
                Severity: Major
                Found in lts/lib/internal/util.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        if (enc === 'latin1' || enc === 'binary') return 'latin1';
                  Severity: Major
                  Found in lts/lib/internal/util.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          if (enc === 'ascii') return 'ascii';
                    Severity: Major
                    Found in lts/lib/internal/util.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            if (enc === 'UTF-8') return 'utf8';
                      Severity: Major
                      Found in lts/lib/internal/util.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              if (enc === 'base64') return 'base64';
                        Severity: Major
                        Found in lts/lib/internal/util.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                if (enc === 'base64') return 'base64';
                          Severity: Major
                          Found in lts/lib/internal/util.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  if (enc === 'LATIN1' || enc === 'BINARY') return 'latin1';
                            Severity: Major
                            Found in lts/lib/internal/util.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    if (enc === 'ascii') return 'ascii';
                              Severity: Major
                              Found in lts/lib/internal/util.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      if (enc === 'BASE64') return 'base64';
                                Severity: Major
                                Found in lts/lib/internal/util.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return 'hex';
                                  Severity: Major
                                  Found in lts/lib/internal/util.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return 'utf16le';
                                    Severity: Major
                                    Found in lts/lib/internal/util.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                            if (enc === 'ASCII') return 'ascii';
                                      Severity: Major
                                      Found in lts/lib/internal/util.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return 'utf16le';
                                        Severity: Major
                                        Found in lts/lib/internal/util.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                if (enc === '') return 'utf8';
                                          Severity: Major
                                          Found in lts/lib/internal/util.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                  if (enc === 'utf-8') return 'utf8';
                                            Severity: Major
                                            Found in lts/lib/internal/util.js - About 30 mins to fix

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

                                              function slowCases(enc) {
                                                switch (enc.length) {
                                                  case 4:
                                                    if (enc === 'UTF8') return 'utf8';
                                                    if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le';
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 2 days to fix
                                              current/lib/internal/util.js on lines 130..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 488.

                                              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 promisify(original) {
                                                if (typeof original !== 'function')
                                                  throw new ERR_INVALID_ARG_TYPE('original', 'Function', original);
                                              
                                                if (original[kCustomPromisifiedSymbol]) {
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 1 day to fix
                                              current/lib/internal/util.js on lines 277..322

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

                                              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 deprecate(fn, msg, code) {
                                                if (process.noDeprecation === true) {
                                                  return fn;
                                                }
                                              
                                              
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 1 day to fix
                                              current/lib/internal/util.js on lines 65..102

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

                                              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 isInsideNodeModules() {
                                                if (getStructuredStack === undefined) {
                                                  // Lazy-load to avoid a circular dependency.
                                                  const { runInNewContext } = require('vm');
                                                  // Use `runInNewContext()` to get something tamper-proof and
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 5 hrs to fix
                                              current/lib/internal/util.js on lines 353..385

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

                                              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

                                              module.exports = {
                                                assertCrypto,
                                                cachedResult,
                                                convertToValidSignal,
                                                createClassWrapper,
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 5 hrs to fix
                                              current/lib/internal/util.js on lines 407..439

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

                                              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 filterDuplicateStrings(items, low) {
                                                const map = new Map();
                                                for (let i = 0; i < items.length; i++) {
                                                  const item = items[i];
                                                  const key = item.toLowerCase();
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 4 hrs to fix
                                              current/lib/internal/util.js on lines 186..198

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

                                              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 createClassWrapper(type) {
                                                function fn(...args) {
                                                  return ReflectConstruct(type, args, new.target || type);
                                                }
                                                // Mask the wrapper function name and length values
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 3 hrs to fix
                                              current/lib/internal/util.js on lines 215..227

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

                                              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 join(output, separator) {
                                                let str = '';
                                                if (output.length !== 0) {
                                                  const lastIndex = output.length - 1;
                                                  for (let i = 0; i < lastIndex; i++) {
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 3 hrs to fix
                                              current/lib/internal/util.js on lines 327..339

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

                                              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 getConstructorOf(obj) {
                                                while (obj) {
                                                  const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');
                                                  if (descriptor !== undefined &&
                                                      typeof descriptor.value === 'function' &&
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 2 hrs to fix
                                              current/lib/internal/util.js on lines 254..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 90.

                                              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 decorateErrorStack(err) {
                                                if (!(isError(err) && err.stack) ||
                                                    getHiddenValue(err, kDecoratedPrivateSymbolIndex) === true)
                                                  return;
                                              
                                              
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 2 hrs to fix
                                              current/lib/internal/util.js on lines 104..115

                                              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

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

                                              const {
                                                ArrayFrom,
                                                ArrayIsArray,
                                                Error,
                                                Map,
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 2 other locations - About 2 hrs to fix
                                              current/lib/events.js on lines 24..41
                                              current/lib/internal/util.js on lines 3..20

                                              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 convertToValidSignal(signal) {
                                                if (typeof signal === 'number' && getSignalsToNamesMapping()[signal])
                                                  return signal;
                                              
                                                if (typeof signal === 'string') {
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 2 hrs to fix
                                              current/lib/internal/util.js on lines 242..252

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

                                              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 emitExperimentalWarning(feature) {
                                                if (experimentalWarnings.has(feature)) return;
                                                const msg = `${feature} is an experimental feature. This feature could ` +
                                                     'change at any time';
                                                experimentalWarnings.add(feature);
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 1 hr to fix
                                              current/lib/internal/util.js on lines 178..184

                                              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 spliceOne(list, index) {
                                                for (; index + 1 < list.length; index++)
                                                  list[index] = list[index + 1];
                                                list.pop();
                                              }
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 1 hr to fix
                                              current/lib/internal/util.js on lines 343..347

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

                                              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 getSignalsToNamesMapping() {
                                                if (signalsToNamesMapping !== undefined)
                                                  return signalsToNamesMapping;
                                              
                                                signalsToNamesMapping = ObjectCreate(null);
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 1 hr to fix
                                              current/lib/internal/util.js on lines 230..240

                                              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

                                              function cachedResult(fn) {
                                                let result;
                                                return () => {
                                                  if (result === undefined)
                                                    result = fn();
                                              Severity: Major
                                              Found in lts/lib/internal/util.js and 1 other location - About 1 hr to fix
                                              current/lib/internal/util.js on lines 200..207

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

                                              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 once(callback) {
                                                let called = false;
                                                return function(...args) {
                                                  if (called) return;
                                                  called = true;
                                              Severity: Minor
                                              Found in lts/lib/internal/util.js and 1 other location - About 50 mins to fix
                                              current/lib/internal/util.js on lines 387..394

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

                                              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 sleep(msec) {
                                                // Lazy-load to avoid a circular dependency.
                                                if (validateUint32 === undefined)
                                                  ({ validateUint32 } = require('internal/validators'));
                                              
                                              
                                              Severity: Minor
                                              Found in lts/lib/internal/util.js and 1 other location - About 50 mins to fix
                                              current/lib/internal/util.js on lines 398..405

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

                                              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 normalizeEncoding(enc) {
                                                if (enc == null || enc === 'utf8' || enc === 'utf-8') return 'utf8';
                                                return slowCases(enc);
                                              }
                                              Severity: Minor
                                              Found in lts/lib/internal/util.js and 1 other location - About 35 mins to fix
                                              current/lib/internal/util.js on lines 125..128

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

                                              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