enclose-io/compiler

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

Summary

Maintainability
F
2 wks
Test Coverage

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

'use strict';

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

    Function mapToHeaders has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    function mapToHeaders(map,
                          assertValuePseudoHeader = assertValidPseudoHeader) {
      let ret = '';
      let count = 0;
      const keys = ObjectKeys(map);
    Severity: Minor
    Found in lts/lib/internal/http2/util.js - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function mapToHeaders has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function mapToHeaders(map,
                          assertValuePseudoHeader = assertValidPseudoHeader) {
      let ret = '';
      let count = 0;
      const keys = ObjectKeys(map);
    Severity: Major
    Found in lts/lib/internal/http2/util.js - About 2 hrs to fix

      Function updateOptionsBuffer has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function updateOptionsBuffer(options) {
        let flags = 0;
        if (typeof options.maxDeflateDynamicTableSize === 'number') {
          flags |= (1 << IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE);
          optionsBuffer[IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE] =
      Severity: Major
      Found in lts/lib/internal/http2/util.js - About 2 hrs to fix

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

        function getDefaultSettings() {
          settingsBuffer[IDX_SETTINGS_FLAGS] = 0;
          binding.refreshDefaultSettings();
          const holder = ObjectCreate(null);
        
        
        Severity: Minor
        Found in lts/lib/internal/http2/util.js - About 1 hr to fix

          Function updateSettingsBuffer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function updateSettingsBuffer(settings) {
            let flags = 0;
            if (typeof settings.headerTableSize === 'number') {
              flags |= (1 << IDX_SETTINGS_HEADER_TABLE_SIZE);
              settingsBuffer[IDX_SETTINGS_HEADER_TABLE_SIZE] =
          Severity: Minor
          Found in lts/lib/internal/http2/util.js - About 1 hr to fix

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

            function toHeaderObject(headers) {
              const obj = ObjectCreate(null);
              for (var n = 0; n < headers.length; n = n + 2) {
                const name = headers[n];
                let value = headers[n + 1];
            Severity: Minor
            Found in lts/lib/internal/http2/util.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 updateOptionsBuffer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function updateOptionsBuffer(options) {
              let flags = 0;
              if (typeof options.maxDeflateDynamicTableSize === 'number') {
                flags |= (1 << IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE);
                optionsBuffer[IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE] =
            Severity: Minor
            Found in lts/lib/internal/http2/util.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 updateSettingsBuffer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function updateSettingsBuffer(settings) {
              let flags = 0;
              if (typeof settings.headerTableSize === 'number') {
                flags |= (1 << IDX_SETTINGS_HEADER_TABLE_SIZE);
                settingsBuffer[IDX_SETTINGS_HEADER_TABLE_SIZE] =
            Severity: Minor
            Found in lts/lib/internal/http2/util.js - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            function getDefaultSettings() {
              settingsBuffer[IDX_SETTINGS_FLAGS] = 0;
              binding.refreshDefaultSettings();
              const holder = ObjectCreate(null);
            
            
            Severity: Minor
            Found in lts/lib/internal/http2/util.js - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            function mapToHeaders(map,
                                  assertValuePseudoHeader = assertValidPseudoHeader) {
              let ret = '';
              let count = 0;
              const keys = ObjectKeys(map);
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 2 days to fix
            current/lib/internal/http2/util.js on lines 445..509

            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

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

            function updateOptionsBuffer(options) {
              let flags = 0;
              if (typeof options.maxDeflateDynamicTableSize === 'number') {
                flags |= (1 << IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE);
                optionsBuffer[IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE] =
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 2 days to fix
            current/lib/internal/http2/util.js on lines 209..262

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

            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 updateSettingsBuffer(settings) {
              let flags = 0;
              if (typeof settings.headerTableSize === 'number') {
                flags |= (1 << IDX_SETTINGS_HEADER_TABLE_SIZE);
                settingsBuffer[IDX_SETTINGS_HEADER_TABLE_SIZE] =
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 day to fix
            current/lib/internal/http2/util.js on lines 336..374

            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 getDefaultSettings() {
              settingsBuffer[IDX_SETTINGS_FLAGS] = 0;
              binding.refreshDefaultSettings();
              const holder = ObjectCreate(null);
            
            
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 day to fix
            current/lib/internal/http2/util.js on lines 264..314

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

            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 {
              NGHTTP2_SESSION_CLIENT,
              NGHTTP2_SESSION_SERVER,
            
              HTTP2_HEADER_STATUS,
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 day to fix
            current/lib/internal/http2/util.js on lines 31..89

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

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

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

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

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

            Refactorings

            Further Reading

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

              for (var n = 0; n < headers.length; n = n + 2) {
                const name = headers[n];
                let value = headers[n + 1];
                if (name === HTTP2_HEADER_STATUS)
                  value |= 0;
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 day to fix
            current/lib/internal/http2/util.js on lines 545..583

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

            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 getSettings(session, remote) {
              if (remote)
                session.remoteSettings();
              else
                session.localSettings();
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 3 hrs to fix
            current/lib/internal/http2/util.js on lines 318..334

            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

            class NghttpError extends Error {
              constructor(ret) {
                super(binding.nghttp2ErrorString(ret));
                this.code = 'ERR_HTTP2_ERROR';
                this.errno = ret;
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 3 hrs to fix
            current/lib/internal/http2/util.js on lines 511..522

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

            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 getSessionState(session) {
              session.refreshState();
              return {
                effectiveLocalWindowSize:
                  sessionState[IDX_SESSION_STATE_EFFECTIVE_LOCAL_WINDOW_SIZE],
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 3 hrs to fix
            current/lib/internal/http2/util.js on lines 376..398

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 104.

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

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

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

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

            Refactorings

            Further Reading

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

            module.exports = {
              assertIsObject,
              assertValidPseudoHeaderResponse,
              assertValidPseudoHeaderTrailer,
              assertWithinRange,
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 2 other locations - About 3 hrs to fix
            current/lib/internal/http2/util.js on lines 602..621
            current/lib/os.js on lines 273..292

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

            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 assertWithinRange = hideStackFrames(
              (name, value, min = 0, max = Infinity) => {
                if (value !== undefined &&
                  (typeof value !== 'number' || value < min || value > max)) {
                  throw new ERR_HTTP2_INVALID_SETTING_VALUE.RangeError(
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 2 hrs to fix
            current/lib/internal/http2/util.js on lines 533..541

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

            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 getStreamState(stream) {
              stream.refreshState();
              return {
                state: streamState[IDX_STREAM_STATE],
                weight: streamState[IDX_STREAM_STATE_WEIGHT],
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 2 hrs to fix
            current/lib/internal/http2/util.js on lines 400..410

            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 assertIsObject = hideStackFrames((value, name, types) => {
              if (value !== undefined &&
                  (value === null ||
                   typeof value !== 'object' ||
                   ArrayIsArray(value))) {
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 hr to fix
            current/lib/internal/http2/util.js on lines 524..531

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 69.

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

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

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

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

            Refactorings

            Further Reading

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

            function isIllegalConnectionSpecificHeader(name, value) {
              switch (name) {
                case HTTP2_HEADER_CONNECTION:
                case HTTP2_HEADER_UPGRADE:
                case HTTP2_HEADER_HOST:
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 hr to fix
            current/lib/internal/http2/util.js on lines 412..427

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 61.

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

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

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

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

            Refactorings

            Further Reading

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

            const kSingleValueHeaders = new Set([
              HTTP2_HEADER_STATUS,
              HTTP2_HEADER_METHOD,
              HTTP2_HEADER_AUTHORITY,
              HTTP2_HEADER_SCHEME,
            Severity: Major
            Found in lts/lib/internal/http2/util.js and 1 other location - About 1 hr to fix
            current/lib/internal/http2/util.js on lines 105..145

            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

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

            const {
              ArrayIsArray,
              Error,
              MathMax,
              Number,
            Severity: Major
            Found in lts/lib/internal/http2/util.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/compat.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

            There are no issues that match your filters.

            Category
            Status