enclose-io/compiler

View on GitHub
lts/deps/node-inspect/lib/_inspect.js

Summary

Maintainability
F
2 wks
Test Coverage

File _inspect.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright Node.js contributors. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
Severity: Minor
Found in lts/deps/node-inspect/lib/_inspect.js - About 3 hrs to fix

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

      constructor(options, stdin, stdout) {
        this.options = options;
        this.stdin = stdin;
        this.stdout = stdout;
    
    
    Severity: Minor
    Found in lts/deps/node-inspect/lib/_inspect.js - About 1 hr to fix

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

      function parseArgv([target, ...args]) {
        let host = '127.0.0.1';
        let port = 9229;
        let isRemote = false;
        let script = target;
      Severity: Minor
      Found in lts/deps/node-inspect/lib/_inspect.js - About 1 hr to fix

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

        function portIsFree(host, port, timeout = 9999) {
          if (port === 0) return Promise.resolve(); // Binding to a random port.
        
          const retryDelay = 150;
          let didTimeOut = false;
        Severity: Minor
        Found in lts/deps/node-inspect/lib/_inspect.js - About 1 hr to fix

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

          function runScript(script, scriptArgs, inspectHost, inspectPort, childPrint) {
            return portIsFree(inspectHost, inspectPort)
              .then(() => {
                return new Promise((resolve) => {
                  const needDebugBrk = process.version.match(/^v(6|7)\./);
          Severity: Minor
          Found in lts/deps/node-inspect/lib/_inspect.js - About 1 hr to fix

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

            function parseArgv([target, ...args]) {
              let host = '127.0.0.1';
              let port = 9229;
              let isRemote = false;
              let script = target;
            Severity: Minor
            Found in lts/deps/node-inspect/lib/_inspect.js - About 55 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            function startInspect(argv = process.argv.slice(2),
              stdin = process.stdin,
              stdout = process.stdout) {
              /* eslint-disable no-console */
              if (argv.length < 1) {
            Severity: Minor
            Found in lts/deps/node-inspect/lib/_inspect.js - About 45 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            function runScript(script, scriptArgs, inspectHost, inspectPort, childPrint) {
            Severity: Minor
            Found in lts/deps/node-inspect/lib/_inspect.js - About 35 mins to fix

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

              class NodeInspector {
                constructor(options, stdin, stdout) {
                  this.options = options;
                  this.stdin = stdin;
                  this.stdout = stdout;
              Severity: Major
              Found in lts/deps/node-inspect/lib/_inspect.js and 1 other location - About 1 wk to fix
              current/deps/node-inspect/lib/_inspect.js on lines 146..287

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

              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 parseArgv([target, ...args]) {
                let host = '127.0.0.1';
                let port = 9229;
                let isRemote = false;
                let script = target;
              Severity: Major
              Found in lts/deps/node-inspect/lib/_inspect.js and 1 other location - About 2 days to fix
              current/deps/node-inspect/lib/_inspect.js on lines 289..333

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

              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 startInspect(argv = process.argv.slice(2),
                stdin = process.stdin,
                stdout = process.stdout) {
                /* eslint-disable no-console */
                if (argv.length < 1) {
              Severity: Major
              Found in lts/deps/node-inspect/lib/_inspect.js and 1 other location - About 1 day to fix
              current/deps/node-inspect/lib/_inspect.js on lines 335..370

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 336.

              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 runScript(script, scriptArgs, inspectHost, inspectPort, childPrint) {
                return portIsFree(inspectHost, inspectPort)
                  .then(() => {
                    return new Promise((resolve) => {
                      const needDebugBrk = process.version.match(/^v(6|7)\./);
              Severity: Major
              Found in lts/deps/node-inspect/lib/_inspect.js and 1 other location - About 1 day to fix
              current/deps/node-inspect/lib/_inspect.js on lines 93..122

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

              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 portIsFree(host, port, timeout = 9999) {
                if (port === 0) return Promise.resolve(); // Binding to a random port.
              
                const retryDelay = 150;
                let didTimeOut = false;
              Severity: Major
              Found in lts/deps/node-inspect/lib/_inspect.js and 1 other location - About 1 day to fix
              current/deps/node-inspect/lib/_inspect.js on lines 52..91

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

              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 createAgentProxy(domain, client) {
                const agent = new EventEmitter();
                agent.then = (...args) => {
                  // TODO: potentially fetch the protocol and pretty-print it here.
                  const descriptor = {
              Severity: Major
              Found in lts/deps/node-inspect/lib/_inspect.js and 1 other location - About 7 hrs to fix
              current/deps/node-inspect/lib/_inspect.js on lines 124..144

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

              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