enclose-io/compiler

View on GitHub
lts/lib/internal/http2/compat.js

Summary

Maintainability
F
3 wks
Test Coverage

File compat.js has 682 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

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

    Http2ServerResponse has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Http2ServerResponse extends Stream {
      constructor(stream, options) {
        super(options);
        this[kState] = {
          closed: false,
    Severity: Minor
    Found in lts/lib/internal/http2/compat.js - About 5 hrs to fix

      Http2ServerRequest has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Http2ServerRequest extends Readable {
        constructor(stream, headers, options, rawHeaders) {
          super(options);
          this[kState] = {
            closed: false,
      Severity: Minor
      Found in lts/lib/internal/http2/compat.js - About 2 hrs to fix

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

          end(chunk, encoding, cb) {
            const stream = this[kStream];
            const state = this[kState];
        
            if (typeof chunk === 'function') {
        Severity: Minor
        Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        function onServerStream(ServerRequest, ServerResponse,
                                stream, headers, flags, rawHeaders) {
          const server = this;
          const request = new ServerRequest(stream, headers, undefined, rawHeaders);
          const response = new ServerResponse(stream);
        Severity: Minor
        Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

          writeHead(statusCode, statusMessage, headers) {
            const state = this[kState];
        
            if (state.closed || this.stream.destroyed)
              return this;
        Severity: Minor
        Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

          end(chunk, encoding, cb) {
            const stream = this[kStream];
            const state = this[kState];
        
            if (typeof chunk === 'function') {
        Severity: Minor
        Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

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

            get(stream, prop) {
              switch (prop) {
                case 'on':
                case 'once':
                case 'end':
          Severity: Minor
          Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

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

            get(stream, prop) {
              switch (prop) {
                case 'on':
                case 'once':
                case 'end':
          Severity: Minor
          Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

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

              set(stream, prop, value) {
                switch (prop) {
                  case 'writable':
                  case 'readable':
                  case 'destroyed':
            Severity: Minor
            Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

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

              function onServerStream(ServerRequest, ServerResponse,
                                      stream, headers, flags, rawHeaders) {
                const server = this;
                const request = new ServerRequest(stream, headers, undefined, rawHeaders);
                const response = new ServerResponse(stream);
              Severity: Minor
              Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

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

                  writeHead(statusCode, statusMessage, headers) {
                    const state = this[kState];
                
                    if (state.closed || this.stream.destroyed)
                      return this;
                Severity: Minor
                Found in lts/lib/internal/http2/compat.js - About 1 hr to fix

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

                  function onServerStream(ServerRequest, ServerResponse,
                                          stream, headers, flags, rawHeaders) {
                  Severity: Minor
                  Found in lts/lib/internal/http2/compat.js - About 45 mins to fix

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

                      write(chunk, encoding, cb) {
                        const state = this[kState];
                    
                        if (typeof encoding === 'function') {
                          cb = encoding;
                    Severity: Minor
                    Found in lts/lib/internal/http2/compat.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 too many return statements within this function.
                    Open

                            return typeof value === 'function' ? value.bind(ref) : value;
                    Severity: Major
                    Found in lts/lib/internal/http2/compat.js - About 30 mins to fix

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

                      const assertValidHeader = hideStackFrames((name, value) => {
                        if (name === '' || typeof name !== 'string') {
                          throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
                        }
                        if (isPseudoHeader(name)) {
                      Severity: Minor
                      Found in lts/lib/internal/http2/compat.js - About 25 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                      class Http2ServerResponse extends Stream {
                        constructor(stream, options) {
                          super(options);
                          this[kState] = {
                            closed: false,
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 2 wks to fix
                      current/lib/internal/http2/compat.js on lines 440..792

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

                      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 proxySocketHandler = {
                        get(stream, prop) {
                          switch (prop) {
                            case 'on':
                            case 'once':
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 2 days to fix
                      current/lib/internal/http2/compat.js on lines 183..253

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

                      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 onServerStream(ServerRequest, ServerResponse,
                                              stream, headers, flags, rawHeaders) {
                        const server = this;
                        const request = new ServerRequest(stream, headers, undefined, rawHeaders);
                        const response = new ServerResponse(stream);
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 day to fix
                      current/lib/internal/http2/compat.js on lines 794..829

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

                      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 onStreamCloseRequest() {
                        const req = this[kRequest];
                      
                        if (req === undefined)
                          return;
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 4 hrs to fix
                      current/lib/internal/http2/compat.js on lines 255..274

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

                      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 onStreamCloseResponse() {
                        const res = this[kResponse];
                      
                        if (res === undefined)
                          return;
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 4 hrs to fix
                      current/lib/internal/http2/compat.js on lines 418..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 123.

                      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 assertValidHeader = hideStackFrames((name, value) => {
                        if (name === '' || typeof name !== 'string') {
                          throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
                        }
                        if (isPseudoHeader(name)) {
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 4 hrs to fix
                      current/lib/internal/http2/compat.js on lines 69..82

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

                      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

                        _read(nread) {
                          const state = this[kState];
                          assert(!state.closed);
                          if (!state.didRead) {
                            state.didRead = true;
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 2 hrs to fix
                      current/lib/internal/http2/compat.js on lines 368..377

                      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

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

                      const {
                        constants: {
                          HTTP2_HEADER_AUTHORITY,
                          HTTP2_HEADER_CONNECTION,
                          HTTP2_HEADER_METHOD,
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 hr to fix
                      current/lib/internal/http2/compat.js on lines 17..31

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

                      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 onStreamAbortedRequest() {
                        const request = this[kRequest];
                        if (request !== undefined && request[kState].closed === false) {
                          request[kAborted] = true;
                          request.emit('aborted');
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 hr to fix
                      current/lib/internal/http2/compat.js on lines 167..173

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

                      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 onStreamTrailers(trailers, flags, rawTrailers) {
                        const request = this[kRequest];
                        if (request !== undefined) {
                          ObjectAssign(request[kTrailers], trailers);
                          request[kRawTrailers].push(...rawTrailers);
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 hr to fix
                      current/lib/internal/http2/compat.js on lines 130..136

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 62.

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

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

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

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

                      Refactorings

                      Further Reading

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

                      function isPseudoHeader(name) {
                        switch (name) {
                          case HTTP2_HEADER_STATUS:    // :status
                          case HTTP2_HEADER_METHOD:    // :method
                          case HTTP2_HEADER_PATH:      // :path
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 hr to fix
                      current/lib/internal/http2/compat.js on lines 84..95

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

                      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

                        get socket() {
                          const stream = this[kStream];
                          const proxySocket = stream[kProxySocket];
                          if (proxySocket === null)
                            return stream[kProxySocket] = new Proxy(stream, proxySocketHandler);
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 hr to fix
                      current/lib/internal/http2/compat.js on lines 356..362

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 57.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        set method(method) {
                          validateString(method, 'method');
                          if (method.trim() === '')
                            throw new ERR_INVALID_ARG_VALUE('method', method);
                      
                      
                      Severity: Major
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 1 hr to fix
                      current/lib/internal/http2/compat.js on lines 383..389

                      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

                      function onStreamData(chunk) {
                        const request = this[kRequest];
                        if (request !== undefined && !request.push(chunk))
                          this.pause();
                      }
                      Severity: Minor
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 50 mins to fix
                      current/lib/internal/http2/compat.js on lines 124..128

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 52.

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

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

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

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

                      Refactorings

                      Further Reading

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

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

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 48.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        get complete() {
                          return this[kAborted] ||
                                 this.readableEnded ||
                                 this[kState].closed ||
                                 this[kStream].destroyed;
                      Severity: Minor
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 35 mins to fix
                      current/lib/internal/http2/compat.js on lines 317..322

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 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 connectionHeaderMessageWarn() {
                        if (statusConnectionHeaderWarned === false) {
                          process.emitWarning(
                            'The provided connection header is not valid, ' +
                            'the value will be dropped from the header and ' +
                      Severity: Minor
                      Found in lts/lib/internal/http2/compat.js and 1 other location - About 35 mins to fix
                      current/lib/internal/http2/compat.js on lines 112..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 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