enclose-io/compiler

View on GitHub
lts/lib/repl.js

Summary

Maintainability
F
1 mo
Test Coverage

Function REPLServer has a Cognitive Complexity of 257 (exceeds 5 allowed). Consider refactoring.
Open

function REPLServer(prompt,
                    stream,
                    eval_,
                    useGlobal,
                    ignoreUndefined,
Severity: Minor
Found in lts/lib/repl.js - About 5 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

File repl.js has 1236 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Severity: Major
Found in lts/lib/repl.js - About 3 days to fix

    Function REPLServer has 569 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function REPLServer(prompt,
                        stream,
                        eval_,
                        useGlobal,
                        ignoreUndefined,
    Severity: Major
    Found in lts/lib/repl.js - About 2 days to fix

      Function complete has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
      Open

      function complete(line, callback) {
        // List of completion lists, one for each inheritance "level"
        let completionGroups = [];
        let completeOn, group;
      
      
      Severity: Minor
      Found in lts/lib/repl.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

      Function complete has 201 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function complete(line, callback) {
        // List of completion lists, one for each inheritance "level"
        let completionGroups = [];
        let completeOn, group;
      
      
      Severity: Major
      Found in lts/lib/repl.js - About 1 day to fix

        Function defaultEval has 140 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function defaultEval(code, context, file, cb) {
            const asyncESM = require('internal/process/esm_loader');
        
            let result, script, wrappedErr;
            let err = null;
        Severity: Major
        Found in lts/lib/repl.js - About 5 hrs to fix

          Function defineDefaultCommands has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function defineDefaultCommands(repl) {
            repl.defineCommand('break', {
              help: 'Sometimes you get stuck, this gets you out',
              action: function() {
                this.clearBufferedCommand();
          Severity: Major
          Found in lts/lib/repl.js - About 3 hrs to fix

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

            function _memory(cmd) {
              const self = this;
              self.lines = self.lines || [];
              self.lines.level = self.lines.level || [];
            
            
            Severity: Minor
            Found in lts/lib/repl.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 debugDomainError has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              self._domain.on('error', function debugDomainError(e) {
                debug('domain error');
                let errStack = '';
            
                if (typeof e === 'object' && e !== null) {
            Severity: Major
            Found in lts/lib/repl.js - About 3 hrs to fix

              Function onLine has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                self.on('line', function onLine(cmd) {
                  debug('line %j', cmd);
                  cmd = cmd || '';
                  sawSIGINT = false;
              
              
              Severity: Major
              Found in lts/lib/repl.js - About 2 hrs to fix

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

                function defineDefaultCommands(repl) {
                  repl.defineCommand('break', {
                    help: 'Sometimes you get stuck, this gets you out',
                    action: function() {
                      this.clearBufferedCommand();
                Severity: Minor
                Found in lts/lib/repl.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 _ttyWrite has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  self._ttyWrite = (d, key) => {
                    key = key || {};
                    if (paused && !(self.breakEvalOnSigint && key.ctrl && key.name === 'c')) {
                      pausedBuffer.push(['key', [d, key], self.isCompletionEnabled]);
                      return;
                Severity: Minor
                Found in lts/lib/repl.js - About 1 hr to fix

                  Function createContext has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  REPLServer.prototype.createContext = function() {
                    let context;
                    if (this.useGlobal) {
                      context = global;
                    } else {
                  Severity: Minor
                  Found in lts/lib/repl.js - About 1 hr to fix

                    Function _memory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function _memory(cmd) {
                      const self = this;
                      self.lines = self.lines || [];
                      self.lines.level = self.lines.level || [];
                    
                    
                    Severity: Minor
                    Found in lts/lib/repl.js - About 1 hr to fix

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

                        function completionGroupsLoaded() {
                          // Filter, sort (within each group), uniq and merge the completion groups.
                          if (completionGroups.length && filter) {
                            const newCompletionGroups = [];
                            for (let i = 0; i < completionGroups.length; i++) {
                      Severity: Minor
                      Found in lts/lib/repl.js - About 1 hr to fix

                        Function resetContext has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        REPLServer.prototype.resetContext = function() {
                          this.context = this.createContext();
                          this.underscoreAssigned = false;
                          this.underscoreErrAssigned = false;
                          this.lines = [];
                        Severity: Minor
                        Found in lts/lib/repl.js - About 1 hr to fix

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

                              function finish(e, ret) {
                                debug('finish', e, ret);
                                _memory.call(self, cmd);
                          
                                if (e && !self[kBufferedCommandSymbol] && cmd.trim().startsWith('npm ')) {
                          Severity: Minor
                          Found in lts/lib/repl.js - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                  while (contextProto = ObjectGetPrototypeOf(contextProto)) {
                                    completionGroups.push(filteredOwnPropertyNames(contextProto));
                                  }
                            Severity: Major
                            Found in lts/lib/repl.js - About 45 mins to fix

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

                              function isIdentifier(str) {
                                if (str === '') {
                                  return false;
                                }
                                const first = str.codePointAt(0);
                              Severity: Minor
                              Found in lts/lib/repl.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 (isDirectory) {
                                        group.push(subdir + name + '/');
                                        try {
                                          subfiles = fs.readdirSync(abs);
                                        } catch {
                              Severity: Major
                              Found in lts/lib/repl.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                      if (!this.useGlobal) {
                                        // When the context is not `global`, builtins are not own
                                        // properties of it.
                                        contextOwnNames.push(...globalBuiltins);
                                      }
                                Severity: Major
                                Found in lts/lib/repl.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                          if (typeof obj === 'object' || typeof obj === 'function') {
                                            try {
                                              memberGroups.push(filteredOwnPropertyNames(obj));
                                            } catch {
                                              // Probably a Proxy object without `getOwnPropertyNames` trap.
                                  Severity: Major
                                  Found in lts/lib/repl.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                            if (filter) {
                                              filter = `${expr}.${filter}`;
                                            }
                                    Severity: Major
                                    Found in lts/lib/repl.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                            if (filter !== '') addCommonWords(completionGroups);
                                      Severity: Major
                                      Found in lts/lib/repl.js - About 45 mins to fix

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

                                        function REPLServer(prompt,
                                                            stream,
                                                            eval_,
                                                            useGlobal,
                                                            ignoreUndefined,
                                        Severity: Minor
                                        Found in lts/lib/repl.js - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                  if (versionedFileNamesRe.test(base) || name === '.npm') {
                                                    // Exclude versioned names that 'npm' installs.
                                                    continue;
                                                  }
                                          Severity: Major
                                          Found in lts/lib/repl.js - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                    for (let i = 0; i < memberGroups.length; i++) {
                                                      completionGroups.push(
                                                        memberGroups[i].map((member) => `${expr}.${member}`));
                                                    }
                                            Severity: Major
                                            Found in lts/lib/repl.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                        if (typeof obj === 'object' || typeof obj === 'function') {
                                                          p = ObjectGetPrototypeOf(obj);
                                                        } else {
                                                          p = obj.constructor ? obj.constructor.prototype : null;
                                                        }
                                              Severity: Major
                                              Found in lts/lib/repl.js - About 45 mins to fix

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

                                                exports.start = function(prompt,
                                                                         source,
                                                                         eval_,
                                                                         useGlobal,
                                                                         ignoreUndefined,
                                                Severity: Minor
                                                Found in lts/lib/repl.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                            while (p !== null && sentinel-- !== 0) {
                                                              memberGroups.push(filteredOwnPropertyNames(p));
                                                              p = ObjectGetPrototypeOf(p);
                                                            }
                                                  Severity: Major
                                                  Found in lts/lib/repl.js - About 45 mins to fix

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

                                                    REPLServer.prototype.createContext = function() {
                                                      let context;
                                                      if (this.useGlobal) {
                                                        context = global;
                                                      } else {
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js - About 35 mins to fix

                                                    Cognitive Complexity

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

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

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

                                                    Further reading

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

                                                    function defineDefaultCommands(repl) {
                                                      repl.defineCommand('break', {
                                                        help: 'Sometimes you get stuck, this gets you out',
                                                        action: function() {
                                                          this.clearBufferedCommand();
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 4 days to fix
                                                    current/lib/repl.js on lines 1496..1596

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

                                                    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 (!err) {
                                                          // Unset raw mode during evaluation so that Ctrl+C raises a signal.
                                                          let previouslyInRawMode;
                                                          if (self.breakEvalOnSigint) {
                                                            // Start the SIGINT watchdog before entering raw mode so that a very
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 3 days to fix
                                                    current/lib/repl.js on lines 460..540

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

                                                    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 _memory(cmd) {
                                                      const self = this;
                                                      self.lines = self.lines || [];
                                                      self.lines.level = self.lines.level || [];
                                                    
                                                    
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 days to fix
                                                    current/lib/repl.js on lines 1409..1472

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

                                                    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 (options[kStandaloneREPL] &&
                                                            process.listenerCount('uncaughtException') !== 0) {
                                                          process.nextTick(() => {
                                                            process.emit('uncaughtException', e);
                                                            self.clearBufferedCommand();
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 days to fix
                                                    current/lib/repl.js on lines 616..652

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

                                                    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

                                                    REPLServer.prototype.createContext = function() {
                                                      let context;
                                                      if (this.useGlobal) {
                                                        context = global;
                                                      } else {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 days to fix
                                                    current/lib/repl.js on lines 971..1019

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

                                                    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 finish(e, ret) {
                                                          debug('finish', e, ret);
                                                          _memory.call(self, cmd);
                                                    
                                                          if (e && !self[kBufferedCommandSymbol] && cmd.trim().startsWith('npm ')) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 day to fix
                                                    current/lib/repl.js on lines 811..856

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

                                                    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

                                                      self.on('SIGINT', function onSigInt() {
                                                        if (prioritizedSigintQueue.size > 0) {
                                                          for (const task of prioritizedSigintQueue) {
                                                            task();
                                                          }
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 day to fix
                                                    current/lib/repl.js on lines 734..762

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

                                                    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

                                                          overrideStackTrace.set(e, (error, stackFrames) => {
                                                            let frames;
                                                            if (typeof stackFrames === 'object') {
                                                              // Search from the bottom of the call stack to
                                                              // find the first frame with a null function name
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 7 hrs to fix
                                                    current/lib/repl.js on lines 554..575

                                                    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

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

                                                        if (trimmedCmd) {
                                                          if (trimmedCmd.charAt(0) === '.' && trimmedCmd.charAt(1) !== '.' &&
                                                              NumberIsNaN(parseFloat(trimmedCmd))) {
                                                            const matches = trimmedCmd.match(/^\.([^\s]+)\s*(.*)$/);
                                                            const keyword = matches && matches[1];
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 6 hrs to fix
                                                    current/lib/repl.js on lines 789..804

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

                                                    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

                                                    REPLServer.prototype.displayPrompt = function(preserveCursor) {
                                                      let prompt = this._initialPrompt;
                                                      if (this[kBufferedCommandSymbol].length) {
                                                        prompt = '...';
                                                        const len = this.lines.level.length ? this.lines.level.length - 1 : 0;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 6 hrs to fix
                                                    current/lib/repl.js on lines 1058..1070

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

                                                    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 (key.ctrl && !key.shift) {
                                                          switch (key.name) {
                                                            // TODO(BridgeAR): There should not be a special mode necessary for full
                                                            // multiline support.
                                                            case 'd': // End editor mode
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 6 hrs to fix
                                                    current/lib/repl.js on lines 906..934

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

                                                    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 isIdentifier(str) {
                                                      if (str === '') {
                                                        return false;
                                                      }
                                                      const first = str.codePointAt(0);
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 5 hrs to fix
                                                    current/lib/repl.js on lines 1088..1107

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

                                                    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 unpause() {
                                                        if (!paused) return;
                                                        paused = false;
                                                        let entry;
                                                        const tmpCompletionEnabled = self.isCompletionEnabled;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 5 hrs to fix
                                                    current/lib/repl.js on lines 338..361

                                                    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 (!expr) {
                                                          // Get global vars synchronously
                                                          completionGroups.push(getGlobalLexicalScopeNames(this[kContextId]));
                                                          let contextProto = this.context;
                                                          while (contextProto = ObjectGetPrototypeOf(contextProto)) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 5 hrs to fix
                                                    current/lib/repl.js on lines 1268..1285

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

                                                    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

                                                        for (const group of completionGroups) {
                                                          group.sort((a, b) => (b > a ? 1 : -1));
                                                          const setSize = uniqueSet.size;
                                                          for (const entry of group) {
                                                            if (!uniqueSet.has(entry)) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 5 hrs to fix
                                                    current/lib/repl.js on lines 1355..1368

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

                                                    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 (self.writer === writer) {
                                                        // Conditionally turn on ANSI coloring.
                                                        writer.options.colors = self.useColors;
                                                    
                                                        if (options[kStandaloneREPL]) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 4 hrs to fix
                                                    current/lib/repl.js on lines 688..707

                                                    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

                                                      self.on('SIGCONT', function onSigCont() {
                                                        if (self.editorMode) {
                                                          self.outputStream.write(`${self._initialPrompt}.editor\n`);
                                                          self.outputStream.write(
                                                            '// Entering editor mode (^D to finish, ^C to cancel)\n');
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 4 hrs to fix
                                                    current/lib/repl.js on lines 859..869

                                                    Duplicated Code

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

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

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

                                                    Tuning

                                                    This issue has a mass of 127.

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

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

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

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

                                                    Refactorings

                                                    Further Reading

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

                                                        if (self.editorMode) {
                                                          self[kBufferedCommandSymbol] += cmd + '\n';
                                                    
                                                          // code alignment
                                                          const matches = self._sawKeyPress ? cmd.match(/^\s+/) : null;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 4 hrs to fix
                                                    current/lib/repl.js on lines 769..782

                                                    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

                                                    REPLServer.prototype.close = function close() {
                                                      if (this.terminal && this._flushing && !this._closingOnFlush) {
                                                        this._closingOnFlush = true;
                                                        this.once('flushHistory', () =>
                                                          Interface.prototype.close.call(this)
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 4 hrs to fix
                                                    current/lib/repl.js on lines 957..969

                                                    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

                                                      if (prompt !== null && typeof prompt === 'object') {
                                                        // An options object was given.
                                                        options = { ...prompt };
                                                        stream = options.stream || options.socket;
                                                        eval_ = options.eval;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 4 hrs to fix
                                                    current/lib/repl.js on lines 189..200

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

                                                    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

                                                    REPLServer.prototype.completeOnEditorMode = (callback) => (err, results) => {
                                                      if (err) return callback(err);
                                                    
                                                      const [completions, completeOn = ''] = results;
                                                      let result = completions.filter((v) => v);
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 3 hrs to fix
                                                    current/lib/repl.js on lines 1379..1390

                                                    Duplicated Code

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

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

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

                                                    Tuning

                                                    This issue has a mass of 113.

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

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

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

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

                                                    Refactorings

                                                    Further Reading

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

                                                        if (completeOn === '.') {
                                                          group = ['./', '../'];
                                                        } else if (completeOn === '..') {
                                                          group = ['../'];
                                                        } else if (/^\.\.?\//.test(completeOn)) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 3 hrs to fix
                                                    current/lib/repl.js on lines 1195..1203

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

                                                    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 {
                                                            if (!/^\s*$/.test(code) &&
                                                                self.replMode === exports.REPL_MODE_STRICT) {
                                                              // "void 0" keeps the repl from returning "use strict" as the result
                                                              // value for statements and declarations that don't return a value.
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 3 hrs to fix
                                                    current/lib/repl.js on lines 408..438

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

                                                    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 (options.terminal && options.useColors === undefined) {
                                                        // If possible, check if stdout supports colors or not.
                                                        if (options.output.hasColors) {
                                                          options.useColors = options.output.hasColors();
                                                        } else if (process.env.NODE_DISABLE_COLORS === undefined) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 3 hrs to fix
                                                    current/lib/repl.js on lines 219..226

                                                    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

                                                    REPLServer.prototype.defineCommand = function(keyword, cmd) {
                                                      if (typeof cmd === 'function') {
                                                        cmd = { action: cmd };
                                                      } else if (typeof cmd.action !== 'function') {
                                                        throw new ERR_INVALID_ARG_TYPE('cmd.action', 'Function', cmd.action);
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 1392..1399

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

                                                    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(this.context, '_error', {
                                                        configurable: true,
                                                        get: () => this.lastError,
                                                        set: (value) => {
                                                          this.lastError = value;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 1041..1052

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

                                                    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 {
                                                      Error,
                                                      MathMax,
                                                      NumberIsNaN,
                                                      ObjectAssign,
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/events.js on lines 24..42

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

                                                    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 (experimentalREPLAwait && code.includes('await')) {
                                                          if (processTopLevelAwait === undefined) {
                                                            ({ processTopLevelAwait } = require('internal/repl/await'));
                                                          }
                                                    
                                                    
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 382..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 92.

                                                    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(this.context, '_', {
                                                        configurable: true,
                                                        get: () => this.last,
                                                        set: (value) => {
                                                          this.last = value;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 1029..1039

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

                                                    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 finishExecution(err, result) {
                                                          if (finished) return;
                                                          finished = true;
                                                    
                                                          // After executing the current expression, store the values of RegExp
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 447..458

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

                                                    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 (!options.input && !options.output) {
                                                        // Legacy API, passing a 'stream'/'socket' option.
                                                        if (!stream) {
                                                          // Use stdin and stdout as the default streams if none were given.
                                                          stream = process;
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 202..212

                                                    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

                                                    function getGlobalLexicalScopeNames(contextId) {
                                                      return sendInspectorCommand((session) => {
                                                        let names = [];
                                                        session.post('Runtime.globalLexicalScopeNames', {
                                                          executionContextId: contextId
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 1115..1125

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

                                                    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 {
                                                      // Hack for require.resolve("./relative") to work properly.
                                                      module.filename = path.resolve('repl');
                                                    } catch {
                                                      // path.resolve('repl') fails when the current working directory has been
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 153..162

                                                    Duplicated Code

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

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

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

                                                    Tuning

                                                    This issue has a mass of 78.

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

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

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

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

                                                    Refactorings

                                                    Further Reading

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

                                                        process.prependListener('newListener', (event, listener) => {
                                                          if (event === 'uncaughtException' &&
                                                              process.domain &&
                                                              listener.name !== 'domainUncaughtExceptionClear' &&
                                                              domainSet.has(process.domain)) {
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 2 hrs to fix
                                                    current/lib/repl.js on lines 293..305

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

                                                    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 regExMatcher = new RegExp(`^${sep}(.*)${sep}(.*)${sep}(.*)${sep}(.*)` +
                                                                                      `${sep}(.*)${sep}(.*)${sep}(.*)${sep}(.*)` +
                                                                                      `${sep}(.*)$`);
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 323..325

                                                    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 (/^\s*{/.test(code) && !/;\s*$/.test(code)) {
                                                          code = `(${code.trim()})\n`;
                                                          wrappedCmd = true;
                                                        }
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 377..380

                                                    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

                                                          if (key.ctrl && key.name === 'd' &&
                                                              self.cursor === 0 && self.line.length === 0) {
                                                            self.clearLine();
                                                          }
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 893..896

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

                                                    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 addCommonWords(completionGroups) {
                                                      // Only words which do not yet exist as global property should be added to
                                                      // this list.
                                                      completionGroups.push([
                                                        'async', 'await', 'break', 'case', 'catch', 'const', 'continue',
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 1474..1484

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

                                                    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 (paused && !(self.breakEvalOnSigint && key.ctrl && key.name === 'c')) {
                                                          pausedBuffer.push(['key', [d, key], self.isCompletionEnabled]);
                                                          return;
                                                        }
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 887..890

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

                                                    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

                                                    REPLServer.prototype.setPrompt = function setPrompt(prompt) {
                                                      this._initialPrompt = prompt;
                                                      Interface.prototype.setPrompt.call(this, prompt);
                                                    };
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 1073..1076

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

                                                    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

                                                      ObjectDefineProperty(this, 'bufferedCommand', {
                                                        get: deprecate(() => self[kBufferedCommandSymbol],
                                                                       'REPLServer.bufferedCommand is deprecated',
                                                                       'DEP0074'),
                                                        set: deprecate((val) => self[kBufferedCommandSymbol] = val,
                                                    Severity: Major
                                                    Found in lts/lib/repl.js and 1 other location - About 1 hr to fix
                                                    current/lib/repl.js on lines 656..664

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

                                                    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

                                                            script = vm.createScript(code, {
                                                              filename: file,
                                                              displayErrors: true,
                                                              importModuleDynamically: async (specifier) => {
                                                                return asyncESM.ESMLoader.import(specifier, parentURL);
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 55 mins to fix
                                                    current/lib/repl.js on lines 415..421

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

                                                    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 _parseREPLKeyword(keyword, rest) {
                                                        const cmd = this.commands[keyword];
                                                        if (cmd) {
                                                          cmd.action.call(this, rest);
                                                          return true;
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 55 mins to fix
                                                    current/lib/repl.js on lines 709..716

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

                                                    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

                                                      ObjectDefineProperty(this, 'rli', {
                                                        get: deprecate(() => rli,
                                                                       'REPLServer.rli is deprecated', 'DEP0124'),
                                                        set: deprecate((val) => rli = val,
                                                                       'REPLServer.rli is deprecated', 'DEP0124'),
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 55 mins to fix
                                                    current/lib/repl.js on lines 312..319

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

                                                    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 {
                                                          const { pathToFileURL } = require('url');
                                                          // Adding `/repl` prevents dynamic imports from loading relative
                                                          // to the parent of `process.cwd()`.
                                                          parentURL = pathToFileURL(path.join(process.cwd(), 'repl')).href;
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 50 mins to fix
                                                    current/lib/repl.js on lines 400..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 51.

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

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

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

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

                                                    Refactorings

                                                    Further Reading

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

                                                      self.on('close', function emitExit() {
                                                        if (paused) {
                                                          pausedBuffer.push(['close']);
                                                          return;
                                                        }
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 50 mins to fix
                                                    current/lib/repl.js on lines 723..729

                                                    Duplicated Code

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

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

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

                                                    Tuning

                                                    This issue has a mass of 51.

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

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

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

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

                                                    Refactorings

                                                    Further Reading

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

                                                              while (p !== null && sentinel-- !== 0) {
                                                                memberGroups.push(filteredOwnPropertyNames(p));
                                                                p = ObjectGetPrototypeOf(p);
                                                              }
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 35 mins to fix
                                                    current/lib/repl.js on lines 1307..1310

                                                    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

                                                            const filteredValue = fileList.filter((d) =>
                                                              d.name.startsWith(baseName))
                                                              .map((d) => d.name);
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 35 mins to fix
                                                    current/lib/repl.js on lines 1148..1150

                                                    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

                                                    function filteredOwnPropertyNames(obj) {
                                                      if (!obj) return [];
                                                      const filter = ALL_PROPERTIES | SKIP_SYMBOLS;
                                                      return getOwnNonIndexProperties(obj, filter).filter(isIdentifier);
                                                    }
                                                    Severity: Minor
                                                    Found in lts/lib/repl.js and 1 other location - About 35 mins to fix
                                                    current/lib/repl.js on lines 1109..1113

                                                    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

                                                    There are no issues that match your filters.

                                                    Category
                                                    Status