enclose-io/compiler

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

Summary

Maintainability
F
3 mos
Test Coverage

File inspect.js has 1704 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const {
  Array,
  ArrayIsArray,
Severity: Major
Found in lts/lib/internal/util/inspect.js - About 4 days to fix

    Function formatRaw has a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring.
    Open

    function formatRaw(ctx, value, recurseTimes, typedArray) {
      let keys;
      let protoProps;
      if (ctx.showHidden && (recurseTimes <= ctx.depth || ctx.depth === null)) {
        protoProps = [];
    Severity: Minor
    Found in lts/lib/internal/util/inspect.js - About 2 days 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

    Consider simplifying this complex logical expression.
    Open

    if (internalBinding('config').hasIntl) {
      const icu = internalBinding('icu');
      // icu.getStringWidth(string, ambiguousAsFullWidth, expandEmojiSequence)
      // Defaults: ambiguousAsFullWidth = false; expandEmojiSequence = true;
      // TODO(BridgeAR): Expose the options to the user. That is probably the
    Severity: Critical
    Found in lts/lib/internal/util/inspect.js - About 1 day to fix

      Function formatWithOptions has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

      function formatWithOptions(inspectOptions, ...args) {
        const first = args[0];
        let a = 0;
        let str = '';
        let join = '';
      Severity: Minor
      Found in lts/lib/internal/util/inspect.js - About 1 day 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 formatRaw has 221 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function formatRaw(ctx, value, recurseTimes, typedArray) {
        let keys;
        let protoProps;
        if (ctx.showHidden && (recurseTimes <= ctx.depth || ctx.depth === null)) {
          protoProps = [];
      Severity: Major
      Found in lts/lib/internal/util/inspect.js - About 1 day to fix

        Function formatError has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

        function formatError(err, constructor, tag, ctx, keys) {
          const name = err.name != null ? String(err.name) : 'Error';
          let len = name.length;
          let stack = err.stack ? String(err.stack) : ErrorPrototypeToString(err);
        
        
        Severity: Minor
        Found in lts/lib/internal/util/inspect.js - About 7 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function groupArrayElements has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

        function groupArrayElements(ctx, output, value) {
          let totalLength = 0;
          let maxLength = 0;
          let i = 0;
          let outputLength = output.length;
        Severity: Minor
        Found in lts/lib/internal/util/inspect.js - About 5 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 formatProperty has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        function formatProperty(ctx, value, recurseTimes, key, type, desc) {
          let name, str;
          let extra = ' ';
          desc = desc || ObjectGetOwnPropertyDescriptor(value, key) ||
            { value: value[key], enumerable: true };
        Severity: Minor
        Found in lts/lib/internal/util/inspect.js - About 5 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 formatWithOptions has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function formatWithOptions(inspectOptions, ...args) {
          const first = args[0];
          let a = 0;
          let str = '';
          let join = '';
        Severity: Major
        Found in lts/lib/internal/util/inspect.js - About 4 hrs to fix

          Function addPrototypeProperties has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          function addPrototypeProperties(ctx, main, obj, recurseTimes, output) {
            let depth = 0;
            let keys;
            let keySet;
            do {
          Severity: Minor
          Found in lts/lib/internal/util/inspect.js - About 4 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 isFullWidthCodePoint has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

            const isFullWidthCodePoint = (code) => {
              // Code points are partially derived from:
              // http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
              return code >= 0x1100 && (
                code <= 0x115f ||  // Hangul Jamo
          Severity: Minor
          Found in lts/lib/internal/util/inspect.js - About 4 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 reduceToSingleString has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          function reduceToSingleString(
            ctx, output, base, braces, extrasType, recurseTimes, value) {
            if (ctx.compact !== true) {
              if (typeof ctx.compact === 'number' && ctx.compact >= 1) {
                // Memorize the original output length. In case the the output is grouped,
          Severity: Minor
          Found in lts/lib/internal/util/inspect.js - About 3 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function formatValue has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

          function formatValue(ctx, value, recurseTimes, typedArray) {
            // Primitive types cannot have properties.
            if (typeof value !== 'object' &&
                typeof value !== 'function' &&
                !isUndetectableObject(value)) {
          Severity: Minor
          Found in lts/lib/internal/util/inspect.js - About 3 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          function inspect(value, opts) {
            // Default options
            const ctx = {
              budget: {},
              indentationLvl: 0,
          Severity: Minor
          Found in lts/lib/internal/util/inspect.js - About 3 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function formatSpecialArray has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          function formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
            const keys = ObjectKeys(value);
            let index = i;
            for (; i < keys.length && output.length < maxLength; i++) {
              const key = keys[i];
          Severity: Minor
          Found in lts/lib/internal/util/inspect.js - About 3 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function groupArrayElements has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function groupArrayElements(ctx, output, value) {
            let totalLength = 0;
            let maxLength = 0;
            let i = 0;
            let outputLength = output.length;
          Severity: Major
          Found in lts/lib/internal/util/inspect.js - About 3 hrs to fix

            Function formatError has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function formatError(err, constructor, tag, ctx, keys) {
              const name = err.name != null ? String(err.name) : 'Error';
              let len = name.length;
              let stack = err.stack ? String(err.stack) : ErrorPrototypeToString(err);
            
            
            Severity: Major
            Found in lts/lib/internal/util/inspect.js - About 2 hrs to fix

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

              function strEscape(str) {
                let escapeTest = strEscapeSequencesRegExp;
                let escapeReplace = strEscapeSequencesReplacer;
                let singleQuote = 39;
              
              
              Severity: Minor
              Found in lts/lib/internal/util/inspect.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 formatProperty has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function formatProperty(ctx, value, recurseTimes, key, type, desc) {
                let name, str;
                let extra = ' ';
                desc = desc || ObjectGetOwnPropertyDescriptor(value, key) ||
                  { value: value[key], enumerable: true };
              Severity: Major
              Found in lts/lib/internal/util/inspect.js - About 2 hrs to fix

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

                function getConstructorName(obj, ctx, recurseTimes, protoProps) {
                  let firstProto;
                  const tmp = obj;
                  while (obj || isUndetectableObject(obj)) {
                    const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');
                Severity: Minor
                Found in lts/lib/internal/util/inspect.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 inspect has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function inspect(value, opts) {
                  // Default options
                  const ctx = {
                    budget: {},
                    indentationLvl: 0,
                Severity: Minor
                Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                  Function formatValue has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function formatValue(ctx, value, recurseTimes, typedArray) {
                    // Primitive types cannot have properties.
                    if (typeof value !== 'object' &&
                        typeof value !== 'function' &&
                        !isUndetectableObject(value)) {
                  Severity: Minor
                  Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                    Function addPrototypeProperties has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function addPrototypeProperties(ctx, main, obj, recurseTimes, output) {
                      let depth = 0;
                      let keys;
                      let keySet;
                      do {
                    Severity: Minor
                    Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                      Function isZeroWidthCodePoint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                        const isZeroWidthCodePoint = (code) => {
                          return code <= 0x1F || // C0 control codes
                            (code >= 0x7F && code <= 0x9F) || // C1 control codes
                            (code >= 0x300 && code <= 0x36F) || // Combining Diacritical Marks
                            (code >= 0x200B && code <= 0x200F) || // Modifying Invisible Characters
                      Severity: Minor
                      Found in lts/lib/internal/util/inspect.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 getBoxedBase has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getBoxedBase(value, ctx, keys, constructor, tag) {
                        let fn;
                        let type;
                        if (isNumberObject(value)) {
                          fn = NumberPrototypeValueOf;
                      Severity: Minor
                      Found in lts/lib/internal/util/inspect.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 strEscape has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function strEscape(str) {
                        let escapeTest = strEscapeSequencesRegExp;
                        let escapeReplace = strEscapeSequencesReplacer;
                        let singleQuote = 39;
                      
                      
                      Severity: Minor
                      Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

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

                        function getConstructorName(obj, ctx, recurseTimes, protoProps) {
                          let firstProto;
                          const tmp = obj;
                          while (obj || isUndetectableObject(obj)) {
                            const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');
                        Severity: Minor
                        Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                          Function formatPrimitive has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function formatPrimitive(fn, value, ctx) {
                            if (typeof value === 'string') {
                              let trailer = '';
                              if (value.length > ctx.maxStringLength) {
                                const remaining = value.length - ctx.maxStringLength;
                          Severity: Minor
                          Found in lts/lib/internal/util/inspect.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 formatSpecialArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
                            const keys = ObjectKeys(value);
                            let index = i;
                            for (; i < keys.length && output.length < maxLength; i++) {
                              const key = keys[i];
                          Severity: Minor
                          Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                            Function getBoxedBase has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function getBoxedBase(value, ctx, keys, constructor, tag) {
                              let fn;
                              let type;
                              if (isNumberObject(value)) {
                                fn = NumberPrototypeValueOf;
                            Severity: Minor
                            Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                              Function getFunctionBase has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function getFunctionBase(value, constructor, tag) {
                                const stringified = FunctionPrototypeToString(value);
                                if (stringified.slice(0, 5) === 'class' && stringified.endsWith('}')) {
                                  const slice = stringified.slice(5, -1);
                                  const bracketIndex = slice.indexOf('{');
                              Severity: Minor
                              Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

                                Function getFunctionBase has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function getFunctionBase(value, constructor, tag) {
                                  const stringified = FunctionPrototypeToString(value);
                                  if (stringified.slice(0, 5) === 'class' && stringified.endsWith('}')) {
                                    const slice = stringified.slice(5, -1);
                                    const bracketIndex = slice.indexOf('{');
                                Severity: Minor
                                Found in lts/lib/internal/util/inspect.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 formatMapIterInner has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function formatMapIterInner(ctx, recurseTimes, entries, state) {
                                  const maxArrayLength = MathMax(ctx.maxArrayLength, 0);
                                  // Entries exist as [key1, val1, key2, val2, ...]
                                  const len = entries.length / 2;
                                  const remaining = len - maxArrayLength;
                                Severity: Minor
                                Found in lts/lib/internal/util/inspect.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 formatMapIterInner has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function formatMapIterInner(ctx, recurseTimes, entries, state) {
                                  const maxArrayLength = MathMax(ctx.maxArrayLength, 0);
                                  // Entries exist as [key1, val1, key2, val2, ...]
                                  const len = entries.length / 2;
                                  const remaining = len - maxArrayLength;
                                Severity: Minor
                                Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

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

                                  function reduceToSingleString(
                                    ctx, output, base, braces, extrasType, recurseTimes, value) {
                                    if (ctx.compact !== true) {
                                      if (typeof ctx.compact === 'number' && ctx.compact >= 1) {
                                        // Memorize the original output length. In case the the output is grouped,
                                  Severity: Minor
                                  Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

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

                                    function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
                                      const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);
                                      const remaining = value.length - maxLength;
                                      const output = new Array(maxLength);
                                      const elementFormatter = value.length > 0 && typeof value[0] === 'number' ?
                                    Severity: Minor
                                    Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

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

                                      function formatPrimitive(fn, value, ctx) {
                                        if (typeof value === 'string') {
                                          let trailer = '';
                                          if (value.length > ctx.maxStringLength) {
                                            const remaining = value.length - ctx.maxStringLength;
                                      Severity: Minor
                                      Found in lts/lib/internal/util/inspect.js - About 1 hr to fix

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

                                        function getClassBase(value, constructor, tag) {
                                          const hasName = ObjectPrototypeHasOwnProperty(value, 'name');
                                          const name = (hasName && value.name) || '(anonymous)';
                                          let base = `class ${name}`;
                                          if (constructor !== 'Function' && constructor !== null) {
                                        Severity: Minor
                                        Found in lts/lib/internal/util/inspect.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 reduceToSingleString has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                          ctx, output, base, braces, extrasType, recurseTimes, value) {
                                        Severity: Major
                                        Found in lts/lib/internal/util/inspect.js - About 50 mins to fix

                                          Function formatProperty has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          function formatProperty(ctx, value, recurseTimes, key, type, desc) {
                                          Severity: Minor
                                          Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                            Function getKeys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function getKeys(value, showHidden) {
                                              let keys;
                                              const symbols = ObjectGetOwnPropertySymbols(value);
                                              if (showHidden) {
                                                keys = ObjectGetOwnPropertyNames(value);
                                            Severity: Minor
                                            Found in lts/lib/internal/util/inspect.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 formatSpecialArray has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            function formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
                                            Severity: Minor
                                            Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                        if (lastPos !== i - 1) {
                                                          str += first.slice(lastPos, i - 1);
                                                        }
                                              Severity: Major
                                              Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                        } else if (nextChar === 37) {
                                                          str += first.slice(lastPos, i);
                                                          lastPos = i + 1;
                                                        }
                                                Severity: Major
                                                Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                  Function getStringWidth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                    getStringWidth = function getStringWidth(str, removeControlChars = true) {
                                                      let width = 0;
                                                  
                                                      str = prepareStringForGetStringWidth(str, removeControlChars);
                                                      for (let i = 0; i < str.length; i++) {
                                                  Severity: Minor
                                                  Found in lts/lib/internal/util/inspect.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

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                      } else if (isDate(value)) {
                                                        // Make dates with properties first say the date
                                                        base = NumberIsNaN(DatePrototypeGetTime(value)) ?
                                                          DatePrototypeToString(value) :
                                                          DatePrototypeToISOString(value);
                                                  Severity: Major
                                                  Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                    Function tryStringify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                    function tryStringify(arg) {
                                                      try {
                                                        return JSONStringify(arg);
                                                      } catch (err) {
                                                        // Populate the circular error message lazily
                                                    Severity: Minor
                                                    Found in lts/lib/internal/util/inspect.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

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                          if (prefix !== 'RegExp ')
                                                            base = `${prefix}${base}`;
                                                    Severity: Major
                                                    Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                          } else if (isTypedArray(value)) {
                                                            keys = getOwnNonIndexProperties(value, filter);
                                                            let bound = value;
                                                            let fallback = '';
                                                            if (constructor === null) {
                                                      Severity: Major
                                                      Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                              if ((keys.length === 0 && protoProps === undefined) ||
                                                                  (recurseTimes > ctx.depth && ctx.depth !== null)) {
                                                                return ctx.stylize(base, 'regexp');
                                                              }
                                                        Severity: Major
                                                        Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                          Function formatTypedArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                          function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
                                                            const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);
                                                            const remaining = value.length - maxLength;
                                                            const output = new Array(maxLength);
                                                            const elementFormatter = value.length > 0 && typeof value[0] === 'number' ?
                                                          Severity: Minor
                                                          Found in lts/lib/internal/util/inspect.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

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                if (size === 0 && keys.length === 0 && protoProps === undefined)
                                                                  return `${prefix}{}`;
                                                          Severity: Major
                                                          Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                      switch (nextChar) {
                                                                        case 115: // 's'
                                                                          const tempArg = args[++a];
                                                                          if (typeof tempArg === 'number') {
                                                                            tempStr = formatNumber(stylizeNoColor, tempArg);
                                                            Severity: Major
                                                            Found in lts/lib/internal/util/inspect.js - About 45 mins to fix

                                                              Function isBelowBreakLength has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                              function isBelowBreakLength(ctx, output, start, base) {
                                                                // Each entry is separated by at least a comma. Thus, we start with a total
                                                                // length of at least `output.length`. In addition, some cases have a
                                                                // whitespace in-between each other that is added to the total as well.
                                                                // TODO(BridgeAR): Add unicode support. Use the readline getStringWidth
                                                              Severity: Minor
                                                              Found in lts/lib/internal/util/inspect.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

                                                              Consider simplifying this complex logical expression.
                                                              Open

                                                                  if (ctx.getters && (ctx.getters === true ||
                                                                        (ctx.getters === 'get' && desc.set === undefined) ||
                                                                        (ctx.getters === 'set' && desc.set !== undefined))) {
                                                                    try {
                                                                      const tmp = value[key];
                                                              Severity: Major
                                                              Found in lts/lib/internal/util/inspect.js - About 40 mins to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                  if (constructor === null ||
                                                                      (name.endsWith('Error') &&
                                                                      stack.startsWith(name) &&
                                                                      (stack.length === len || stack[len] === ':' || stack[len] === '\n'))) {
                                                                    let fallback = 'Error';
                                                                Severity: Major
                                                                Found in lts/lib/internal/util/inspect.js - About 40 mins to fix

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

                                                                  function getBoxedBase(value, ctx, keys, constructor, tag) {
                                                                  Severity: Minor
                                                                  Found in lts/lib/internal/util/inspect.js - About 35 mins to fix

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

                                                                    function formatError(err, constructor, tag, ctx, keys) {
                                                                    Severity: Minor
                                                                    Found in lts/lib/internal/util/inspect.js - About 35 mins to fix

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

                                                                      function formatSet(value, size, ctx, ignored, recurseTimes) {
                                                                      Severity: Minor
                                                                      Found in lts/lib/internal/util/inspect.js - About 35 mins to fix

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

                                                                        function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
                                                                        Severity: Minor
                                                                        Found in lts/lib/internal/util/inspect.js - About 35 mins to fix

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

                                                                          function formatMap(value, size, ctx, ignored, recurseTimes) {
                                                                          Severity: Minor
                                                                          Found in lts/lib/internal/util/inspect.js - About 35 mins to fix

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

                                                                            function addPrototypeProperties(ctx, main, obj, recurseTimes, output) {
                                                                            Severity: Minor
                                                                            Found in lts/lib/internal/util/inspect.js - About 35 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

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

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                        return `${braces[0]}}`;
                                                                                Severity: Major
                                                                                Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          return ctx.stylize(base, 'regexp');
                                                                                  Severity: Major
                                                                                  Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                      return `${res} <${protoConstr}>`;
                                                                                    Severity: Major
                                                                                    Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                          return ctx.stylize('[Circular]', 'special');
                                                                                      Severity: Major
                                                                                      Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

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

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return prefix +
                                                                                                        `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength)} }`;
                                                                                          Severity: Major
                                                                                          Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                return ctx.stylize(constructorName, 'special');
                                                                                            Severity: Major
                                                                                            Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                      return ret.replace(/\n/g, `\n${' '.repeat(ctx.indentationLvl)}`);
                                                                                              Severity: Major
                                                                                              Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                  return fn(SymbolPrototypeToString(value), 'symbol');
                                                                                                Severity: Major
                                                                                                Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                            return ctx.stylize('[External]', 'special');
                                                                                                  Severity: Major
                                                                                                  Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                        return handleMaxCallStackSize(ctx, err, constructorName, indentationLvl);
                                                                                                    Severity: Major
                                                                                                    Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                          return fn('undefined', 'undefined');
                                                                                                      Severity: Major
                                                                                                      Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                return ctx.stylize(base, 'special');
                                                                                                        Severity: Major
                                                                                                        Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                              return fn(`${value}`, 'boolean');
                                                                                                          Severity: Major
                                                                                                          Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                              return formatRaw(ctx, value, recurseTimes, typedArray);
                                                                                                            Severity: Major
                                                                                                            Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

                                                                                                                      return ctx.stylize(base, 'date');
                                                                                                              Severity: Major
                                                                                                              Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

                                                                                                                        return `${getCtxStyle(value, constructor, tag)}{}`;
                                                                                                                Severity: Major
                                                                                                                Found in lts/lib/internal/util/inspect.js - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

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

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

                                                                                                                    function formatNamespaceObject(keys, ctx, value, recurseTimes) {
                                                                                                                      const output = new Array(keys.length);
                                                                                                                      for (let i = 0; i < keys.length; i++) {
                                                                                                                        try {
                                                                                                                          output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js - About 25 mins to fix

                                                                                                                    Cognitive Complexity

                                                                                                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                    A method's cognitive complexity is based on a few simple rules:

                                                                                                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                    • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                    • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                    Further reading

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

                                                                                                                    function formatArray(ctx, value, recurseTimes) {
                                                                                                                      const valLen = value.length;
                                                                                                                      const len = MathMin(MathMax(0, ctx.maxArrayLength), valLen);
                                                                                                                    
                                                                                                                      const remaining = valLen - len;
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js - About 25 mins to fix

                                                                                                                    Cognitive Complexity

                                                                                                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                    A method's cognitive complexity is based on a few simple rules:

                                                                                                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                    • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                    • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                    Further reading

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

                                                                                                                      getStringWidth = function getStringWidth(str, removeControlChars = true) {
                                                                                                                        let width = 0;
                                                                                                                    
                                                                                                                        str = prepareStringForGetStringWidth(str, removeControlChars);
                                                                                                                        for (const char of str) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js - About 25 mins to fix

                                                                                                                    Cognitive Complexity

                                                                                                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                    A method's cognitive complexity is based on a few simple rules:

                                                                                                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                    • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                    • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                    Further reading

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

                                                                                                                    function formatError(err, constructor, tag, ctx, keys) {
                                                                                                                      const name = err.name != null ? String(err.name) : 'Error';
                                                                                                                      let len = name.length;
                                                                                                                      let stack = err.stack ? String(err.stack) : ErrorPrototypeToString(err);
                                                                                                                    
                                                                                                                    
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1166..1248

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    function formatWithOptions(inspectOptions, ...args) {
                                                                                                                      const first = args[0];
                                                                                                                      let a = 0;
                                                                                                                      let str = '';
                                                                                                                      let join = '';
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1881..1999

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    function formatProperty(ctx, value, recurseTimes, key, type, desc) {
                                                                                                                      let name, str;
                                                                                                                      let extra = ' ';
                                                                                                                      desc = desc || ObjectGetOwnPropertyDescriptor(value, key) ||
                                                                                                                        { value: value[key], enumerable: true };
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1671..1729

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    function groupArrayElements(ctx, output, value) {
                                                                                                                      let totalLength = 0;
                                                                                                                      let maxLength = 0;
                                                                                                                      let i = 0;
                                                                                                                      let outputLength = output.length;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1250..1358

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

                                                                                                                    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 reduceToSingleString(
                                                                                                                      ctx, output, base, braces, extrasType, recurseTimes, value) {
                                                                                                                      if (ctx.compact !== true) {
                                                                                                                        if (typeof ctx.compact === 'number' && ctx.compact >= 1) {
                                                                                                                          // Memorize the original output length. In case the the output is grouped,
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 3 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1755..1813

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

                                                                                                                    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 inspect(value, opts) {
                                                                                                                      // Default options
                                                                                                                      const ctx = {
                                                                                                                        budget: {},
                                                                                                                        indentationLvl: 0,
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 273..327

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    function addPrototypeProperties(ctx, main, obj, recurseTimes, output) {
                                                                                                                      let depth = 0;
                                                                                                                      let keys;
                                                                                                                      let keySet;
                                                                                                                      do {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 578..633

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

                                                                                                                    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 formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
                                                                                                                      const keys = ObjectKeys(value);
                                                                                                                      let index = i;
                                                                                                                      for (; i < keys.length && output.length < maxLength; i++) {
                                                                                                                        const key = keys[i];
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1442..1479

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

                                                                                                                    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

                                                                                                                    inspect.colors = ObjectAssign(ObjectCreate(null), {
                                                                                                                      reset: [0, 0],
                                                                                                                      bold: [1, 22],
                                                                                                                      dim: [2, 22], // Alias: faint
                                                                                                                      italic: [3, 23],
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 347..393

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

                                                                                                                    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 formatMapIterInner(ctx, recurseTimes, entries, state) {
                                                                                                                      const maxArrayLength = MathMax(ctx.maxArrayLength, 0);
                                                                                                                      // Entries exist as [key1, val1, key2, val2, ...]
                                                                                                                      const len = entries.length / 2;
                                                                                                                      const remaining = len - maxArrayLength;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1590..1626

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

                                                                                                                    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 formatPrimitive(fn, value, ctx) {
                                                                                                                      if (typeof value === 'string') {
                                                                                                                        let trailer = '';
                                                                                                                        if (value.length > ctx.maxStringLength) {
                                                                                                                          const remaining = value.length - ctx.maxStringLength;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 days to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1382..1412

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

                                                                                                                    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

                                                                                                                        } else if (isMap(value)) {
                                                                                                                          const size = mapSizeGetter(value);
                                                                                                                          const prefix = getPrefix(constructor, tag, 'Map');
                                                                                                                          keys = getKeys(value, ctx.showHidden);
                                                                                                                          formatter = constructor !== null ?
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 856..897

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

                                                                                                                    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 getBoxedBase(value, ctx, keys, constructor, tag) {
                                                                                                                      let fn;
                                                                                                                      let type;
                                                                                                                      if (isNumberObject(value)) {
                                                                                                                        fn = NumberPrototypeValueOf;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1067..1105

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                      const isFullWidthCodePoint = (code) => {
                                                                                                                        // Code points are partially derived from:
                                                                                                                        // http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
                                                                                                                        return code >= 0x1100 && (
                                                                                                                          code <= 0x115f ||  // Hangul Jamo
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 2051..2087

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

                                                                                                                    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 formatTypedArray(value, length, ctx, ignored, recurseTimes) {
                                                                                                                      const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);
                                                                                                                      const remaining = value.length - maxLength;
                                                                                                                      const output = new Array(maxLength);
                                                                                                                      const elementFormatter = value.length > 0 && typeof value[0] === 'number' ?
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1516..1545

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    function formatNamespaceObject(keys, ctx, value, recurseTimes) {
                                                                                                                      const output = new Array(keys.length);
                                                                                                                      for (let i = 0; i < keys.length; i++) {
                                                                                                                        try {
                                                                                                                          output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1414..1439

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

                                                                                                                    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 formatSetIterInner(ctx, recurseTimes, entries, state) {
                                                                                                                      const maxArrayLength = MathMax(ctx.maxArrayLength, 0);
                                                                                                                      const maxLength = MathMin(maxArrayLength, entries.length);
                                                                                                                      let output = new Array(maxLength);
                                                                                                                      ctx.indentationLvl += 2;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1568..1588

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

                                                                                                                    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 formatArrayBuffer(ctx, value) {
                                                                                                                      let buffer;
                                                                                                                      try {
                                                                                                                        buffer = new Uint8Array(value);
                                                                                                                      } catch {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1481..1496

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

                                                                                                                    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 getKeys(value, showHidden) {
                                                                                                                      let keys;
                                                                                                                      const symbols = ObjectGetOwnPropertySymbols(value);
                                                                                                                      if (showHidden) {
                                                                                                                        keys = ObjectGetOwnPropertyNames(value);
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 650..676

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    function getClassBase(value, constructor, tag) {
                                                                                                                      const hasName = ObjectPrototypeHasOwnProperty(value, 'name');
                                                                                                                      const name = (hasName && value.name) || '(anonymous)';
                                                                                                                      let base = `class ${name}`;
                                                                                                                      if (constructor !== 'Function' && constructor !== null) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 day to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1107..1126

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

                                                                                                                    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 hasBuiltInToString(value) {
                                                                                                                      // Prevent triggering proxy traps.
                                                                                                                      const getFullProxy = false;
                                                                                                                      const proxyTarget = getProxyDetails(value, getFullProxy);
                                                                                                                      if (proxyTarget !== undefined) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 7 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1815..1845

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

                                                                                                                    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 formatArray(ctx, value, recurseTimes) {
                                                                                                                      const valLen = value.length;
                                                                                                                      const len = MathMin(MathMax(0, ctx.maxArrayLength), valLen);
                                                                                                                    
                                                                                                                      const remaining = valLen - len;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 7 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1498..1514

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

                                                                                                                    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 isBelowBreakLength(ctx, output, start, base) {
                                                                                                                      // Each entry is separated by at least a comma. Thus, we start with a total
                                                                                                                      // length of at least `output.length`. In addition, some cases have a
                                                                                                                      // whitespace in-between each other that is added to the total as well.
                                                                                                                      // TODO(BridgeAR): Add unicode support. Use the readline getStringWidth
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 7 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1731..1753

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                      const isZeroWidthCodePoint = (code) => {
                                                                                                                        return code <= 0x1F || // C0 control codes
                                                                                                                          (code >= 0x7F && code <= 0x9F) || // C1 control codes
                                                                                                                          (code >= 0x300 && code <= 0x36F) || // Combining Diacritical Marks
                                                                                                                          (code >= 0x200B && code <= 0x200F) || // Modifying Invisible Characters
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 2089..2099

                                                                                                                    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

                                                                                                                      if (ctx.sorted) {
                                                                                                                        const comparator = ctx.sorted === true ? undefined : ctx.sorted;
                                                                                                                        if (extrasType === kObjectType) {
                                                                                                                          output = output.sort(comparator);
                                                                                                                        } else if (keys.length > 1) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1030..1038

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                        if (ArrayIsArray(value)) {
                                                                                                                          // Only set the constructor for non ordinary ("Array [...]") arrays.
                                                                                                                          const prefix = (constructor !== 'Array' || tag !== '') ?
                                                                                                                            getPrefix(constructor, tag, 'Array', `(${value.length})`) :
                                                                                                                            '';
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 835..897

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                        } else if (isSet(value)) {
                                                                                                                          const size = setSizeGetter(value);
                                                                                                                          const prefix = getPrefix(constructor, tag, 'Set');
                                                                                                                          keys = getKeys(value, ctx.showHidden);
                                                                                                                          formatter = constructor !== null ?
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 hrs to fix
                                                                                                                    lts/lib/internal/util/inspect.js on lines 816..857

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

                                                                                                                    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 formatPromise(ctx, value, recurseTimes) {
                                                                                                                      let output;
                                                                                                                      const [state, result] = getPromiseDetails(value);
                                                                                                                      if (state === kPending) {
                                                                                                                        output = [ctx.stylize('<pending>', 'special')];
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1653..1669

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

                                                                                                                    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

                                                                                                                        } else if (isAnyArrayBuffer(value)) {
                                                                                                                          // Fast path for ArrayBuffer and SharedArrayBuffer.
                                                                                                                          // Can't do the same for DataView because it has a non-primitive
                                                                                                                          // .buffer property that we need to recurse for.
                                                                                                                          const arrayType = isArrayBuffer(value) ? 'ArrayBuffer' :
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 5 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 942..988

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

                                                                                                                    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

                                                                                                                      try {
                                                                                                                        output = formatter(ctx, value, recurseTimes);
                                                                                                                        for (i = 0; i < keys.length; i++) {
                                                                                                                          output.push(
                                                                                                                            formatProperty(ctx, value, recurseTimes, keys[i], extrasType));
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1003..1015

                                                                                                                    Duplicated Code

                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                    Tuning

                                                                                                                    This issue has a mass of 133.

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                      if (stringified.slice(0, 5) === 'class' && stringified.endsWith('}')) {
                                                                                                                        const slice = stringified.slice(5, -1);
                                                                                                                        const bracketIndex = slice.indexOf('{');
                                                                                                                        if (bracketIndex !== -1 &&
                                                                                                                            (!slice.slice(0, bracketIndex).includes('(') ||
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1130..1139

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

                                                                                                                    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 getPrefix(constructor, tag, fallback, size = '') {
                                                                                                                      if (constructor === null) {
                                                                                                                        if (tag !== '') {
                                                                                                                          return `[${fallback}${size}: null prototype] [${tag}] `;
                                                                                                                        }
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 635..647

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                        } else if (isRegExp(value)) {
                                                                                                                          // Make RegExps say that they are RegExps
                                                                                                                          base = RegExpPrototypeToString(
                                                                                                                            constructor !== null ? value : new RegExp(value)
                                                                                                                          );
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 915..988

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

                                                                                                                    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 tryStringify(arg) {
                                                                                                                      try {
                                                                                                                        return JSONStringify(arg);
                                                                                                                      } catch (err) {
                                                                                                                        // Populate the circular error message lazily
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1849..1867

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

                                                                                                                    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 formatProxy(ctx, proxy, recurseTimes) {
                                                                                                                      if (recurseTimes > ctx.depth && ctx.depth !== null) {
                                                                                                                        return ctx.stylize('Proxy [Array]', 'special');
                                                                                                                      }
                                                                                                                      recurseTimes += 1;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 689..702

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

                                                                                                                    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

                                                                                                                      return {
                                                                                                                        stylize: ctx.stylize,
                                                                                                                        showHidden: ctx.showHidden,
                                                                                                                        depth: ctx.depth,
                                                                                                                        colors: ctx.colors,
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 221..235

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

                                                                                                                    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

                                                                                                                      if (str.includes("'")) {
                                                                                                                        // This invalidates the charCode and therefore can not be matched for
                                                                                                                        // anymore.
                                                                                                                        if (!str.includes('"')) {
                                                                                                                          singleQuote = -1;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 4 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 462..474

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

                                                                                                                    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

                                                                                                                        } else if (isDate(value)) {
                                                                                                                          // Make dates with properties first say the date
                                                                                                                          base = NumberIsNaN(DatePrototypeGetTime(value)) ?
                                                                                                                            DatePrototypeToString(value) :
                                                                                                                            DatePrototypeToISOString(value);
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 3 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 927..988

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

                                                                                                                    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

                                                                                                                        if (ctx.circular === undefined) {
                                                                                                                          ctx.circular = new Map([[value, index]]);
                                                                                                                        } else {
                                                                                                                          index = ctx.circular.get(value);
                                                                                                                          if (index === undefined) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 3 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 781..789

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

                                                                                                                    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

                                                                                                                        if (constructor === 'Object') {
                                                                                                                          if (isArgumentsObject(value)) {
                                                                                                                            braces[0] = '[Arguments] {';
                                                                                                                          } else if (tag !== '') {
                                                                                                                            braces[0] = `${getPrefix(constructor, tag, 'Object')}{`;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 3 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 902..988

                                                                                                                    Duplicated Code

                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                    Tuning

                                                                                                                    This issue has a mass of 103.

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    const meta = [
                                                                                                                      '\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004',
                                                                                                                      '\\u0005', '\\u0006', '\\u0007', '\\b', '\\t',
                                                                                                                      '\\n', '\\u000b', '\\f', '\\r', '\\u000e',
                                                                                                                      '\\u000f', '\\u0010', '\\u0011', '\\u0012', '\\u0013',
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 3 hrs to fix
                                                                                                                    lts/deps/v8/tools/heap-stats/categories.js on lines 8..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 95.

                                                                                                                    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 stylizeWithColor(str, styleType) {
                                                                                                                      const style = inspect.styles[styleType];
                                                                                                                      if (style !== undefined) {
                                                                                                                        const color = inspect.colors[style];
                                                                                                                        if (color !== undefined)
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 508..516

                                                                                                                    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 findTypedConstructor(value) {
                                                                                                                      for (const [check, clazz] of [
                                                                                                                        [isUint8Array, Uint8Array],
                                                                                                                        [isUint8ClampedArray, Uint8ClampedArray],
                                                                                                                        [isUint16Array, Uint16Array],
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 704..722

                                                                                                                    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

                                                                                                                      if (recurseTimes > ctx.depth && ctx.depth !== null) {
                                                                                                                        let constructorName = getCtxStyle(value, constructor, tag).slice(0, -1);
                                                                                                                        if (constructor !== null)
                                                                                                                          constructorName = `[${constructorName}]`;
                                                                                                                        return ctx.stylize(constructorName, 'special');
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 991..996

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

                                                                                                                    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

                                                                                                                    inspect.styles = ObjectAssign(ObjectCreate(null), {
                                                                                                                      special: 'cyan',
                                                                                                                      number: 'yellow',
                                                                                                                      bigint: 'yellow',
                                                                                                                      boolean: 'yellow',
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 423..437

                                                                                                                    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 formatIterator(braces, ctx, value, recurseTimes) {
                                                                                                                      const [entries, isKeyValue] = previewEntries(value, true);
                                                                                                                      if (isKeyValue) {
                                                                                                                        // Mark entry iterators as such.
                                                                                                                        braces[0] = braces[0].replace(/ Iterator] {$/, ' Entries] {');
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1642..1651

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

                                                                                                                    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 getIteratorBraces(type, tag) {
                                                                                                                      if (tag !== `${type} Iterator`) {
                                                                                                                        if (tag !== '')
                                                                                                                          tag += '] [';
                                                                                                                        tag += `${type} Iterator`;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1058..1065

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

                                                                                                                    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 handleMaxCallStackSize(ctx, err, constructorName, indentationLvl) {
                                                                                                                      if (isStackOverflowError(err)) {
                                                                                                                        ctx.seen.pop();
                                                                                                                        ctx.indentationLvl = indentationLvl;
                                                                                                                        return ctx.stylize(
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 2 hrs to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1360..1371

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

                                                                                                                    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

                                                                                                                        if (point === singleQuote || point === 92 || point < 32) {
                                                                                                                          if (last === i) {
                                                                                                                            result += meta[point];
                                                                                                                          } else {
                                                                                                                            result += `${str.slice(last, i)}${meta[point]}`;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 489..499

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

                                                                                                                    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 addQuotes(str, quotes) {
                                                                                                                      if (quotes === -1) {
                                                                                                                        return `"${str}"`;
                                                                                                                      }
                                                                                                                      if (quotes === -2) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 439..447

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    ObjectDefineProperty(inspect, 'defaultOptions', {
                                                                                                                      get() {
                                                                                                                        return inspectDefaultOptions;
                                                                                                                      },
                                                                                                                      set(options) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 330..340

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                        if (descriptor !== undefined &&
                                                                                                                            typeof descriptor.value === 'function' &&
                                                                                                                            descriptor.value.name !== '') {
                                                                                                                          if (protoProps !== undefined &&
                                                                                                                             (firstProto !== obj ||
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 532..543

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

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

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

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

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

                                                                                                                    Refactorings

                                                                                                                    Further Reading

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

                                                                                                                    const inspectDefaultOptions = ObjectSeal({
                                                                                                                      showHidden: false,
                                                                                                                      depth: 2,
                                                                                                                      colors: false,
                                                                                                                      customInspect: true,
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 148..160

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

                                                                                                                    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

                                                                                                                          if (ret !== context) {
                                                                                                                            if (typeof ret !== 'string') {
                                                                                                                              return formatValue(ctx, ret, recurseTimes);
                                                                                                                            }
                                                                                                                            return ret.replace(/\n/g, `\n${' '.repeat(ctx.indentationLvl)}`);
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 768..773

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

                                                                                                                    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 defineColorAlias(target, alias) {
                                                                                                                      ObjectDefineProperty(inspect.colors, alias, {
                                                                                                                        get() {
                                                                                                                          return this[target];
                                                                                                                        },
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 395..406

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

                                                                                                                    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 getCtxStyle(value, constructor, tag) {
                                                                                                                      let fallback = '';
                                                                                                                      if (constructor === null) {
                                                                                                                        fallback = internalGetConstructorName(value);
                                                                                                                        if (fallback === tag) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 678..687

                                                                                                                    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

                                                                                                                        for (const char of str) {
                                                                                                                          const code = char.codePointAt(0);
                                                                                                                          if (isFullWidthCodePoint(code)) {
                                                                                                                            width += 2;
                                                                                                                          } else if (!isZeroWidthCodePoint(code)) {
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 1 hr to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 2035..2042

                                                                                                                    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

                                                                                                                      for (const [k, v] of value) {
                                                                                                                        output.push(`${formatValue(ctx, k, recurseTimes)} => ` +
                                                                                                                                    formatValue(ctx, v, recurseTimes));
                                                                                                                      }
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 50 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 1560..1563

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

                                                                                                                      if (typeof tag !== 'string' ||
                                                                                                                          (tag !== '' &&
                                                                                                                          (ctx.showHidden ?
                                                                                                                            ObjectPrototypeHasOwnProperty :
                                                                                                                            ObjectPrototypePropertyIsEnumerable)(
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 45 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 812..820

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

                                                                                                                    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

                                                                                                                        } else if (typeof value === 'function') {
                                                                                                                          base = getFunctionBase(value, constructor, tag);
                                                                                                                          if (keys.length === 0 && protoProps === undefined)
                                                                                                                            return ctx.stylize(base, 'special');
                                                                                                                        } else if (isRegExp(value)) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 40 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 911..988

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

                                                                                                                    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

                                                                                                                      if (protoConstr === null) {
                                                                                                                        return `${res} <${inspect(firstProto, {
                                                                                                                          ...ctx,
                                                                                                                          customInspect: false,
                                                                                                                          depth: -1
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 40 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 564..570

                                                                                                                    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

                                                                                                                      if (typeof value !== 'object' &&
                                                                                                                          typeof value !== 'function' &&
                                                                                                                          !isUndetectableObject(value)) {
                                                                                                                        return formatPrimitive(ctx.stylize, value, ctx);
                                                                                                                      }
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 40 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 729..733

                                                                                                                    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

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

                                                                                                                        } else if (isWeakSet(value)) {
                                                                                                                          braces[0] = `${getPrefix(constructor, tag, 'WeakSet')}{`;
                                                                                                                          formatter = ctx.showHidden ? formatWeakSet : formatWeakCollection;
                                                                                                                        } else if (isWeakMap(value)) {
                                                                                                                          braces[0] = `${getPrefix(constructor, tag, 'WeakMap')}{`;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 3 other locations - About 35 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 964..988
                                                                                                                    current/lib/internal/util/inspect.js on lines 967..988
                                                                                                                    lts/lib/internal/util/inspect.js on lines 927..946

                                                                                                                    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

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

                                                                                                                        } else if (isWeakMap(value)) {
                                                                                                                          braces[0] = `${getPrefix(constructor, tag, 'WeakMap')}{`;
                                                                                                                          formatter = ctx.showHidden ? formatWeakMap : formatWeakCollection;
                                                                                                                        } else if (isModuleNamespaceObject(value)) {
                                                                                                                          braces[0] = `[${tag}] {`;
                                                                                                                    Severity: Major
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 3 other locations - About 35 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 964..988
                                                                                                                    current/lib/internal/util/inspect.js on lines 967..988
                                                                                                                    lts/lib/internal/util/inspect.js on lines 924..946

                                                                                                                    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

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

                                                                                                                        } else if (isDataView(value)) {
                                                                                                                          braces[0] = `${getPrefix(constructor, tag, 'DataView')}{`;
                                                                                                                          // .buffer goes last, it's not a primitive like the others.
                                                                                                                          keys.unshift('byteLength', 'byteOffset', 'buffer');
                                                                                                                        } else if (isPromise(value)) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 35 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 957..988

                                                                                                                    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

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

                                                                                                                        if (typeof maybeCustom === 'function' &&
                                                                                                                            // Filter out the util module, its inspect function is special.
                                                                                                                            maybeCustom !== inspect &&
                                                                                                                            // Also filter out any prototype objects using the circular check.
                                                                                                                            !(value.constructor && value.constructor.prototype === value)) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 35 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 754..774

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

                                                                                                                    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

                                                                                                                        } else if (isBoxedPrimitive(value)) {
                                                                                                                          base = getBoxedBase(value, ctx, keys, constructor, tag);
                                                                                                                          if (keys.length === 0 && protoProps === undefined) {
                                                                                                                            return base;
                                                                                                                          }
                                                                                                                    Severity: Minor
                                                                                                                    Found in lts/lib/internal/util/inspect.js and 1 other location - About 30 mins to fix
                                                                                                                    current/lib/internal/util/inspect.js on lines 974..988

                                                                                                                    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