enclose-io/compiler

View on GitHub
lts/lib/internal/crypto/keys.js

Summary

Maintainability
F
1 wk
Test Coverage

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

function parseKeyEncoding(enc, keyType, isPublic, objName) {
  if (enc === null || typeof enc !== 'object')
    throw new ERR_INVALID_ARG_TYPE('options', 'object', enc);

  const isInput = keyType === undefined;
Severity: Minor
Found in lts/lib/internal/crypto/keys.js - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

File keys.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const {
  ObjectDefineProperty,
  Symbol,
Severity: Minor
Found in lts/lib/internal/crypto/keys.js - About 3 hrs to fix

    Function prepareAsymmetricKey has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function prepareAsymmetricKey(key, ctx) {
      if (isKeyObject(key)) {
        // Best case: A key object, as simple as that.
        return { data: getKeyObjectHandle(key, ctx) };
      } else if (typeof key === 'string' || isArrayBufferView(key)) {
    Severity: Minor
    Found in lts/lib/internal/crypto/keys.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 parseKeyEncoding has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseKeyEncoding(enc, keyType, isPublic, objName) {
      if (enc === null || typeof enc !== 'object')
        throw new ERR_INVALID_ARG_TYPE('options', 'object', enc);
    
      const isInput = keyType === undefined;
    Severity: Minor
    Found in lts/lib/internal/crypto/keys.js - About 1 hr to fix

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

      function prepareSecretKey(key, bufferOnly = false) {
        if (!isArrayBufferView(key) && (bufferOnly || typeof key !== 'string')) {
          if (isKeyObject(key) && !bufferOnly) {
            if (key.type !== 'secret')
              throw new ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE(key.type, 'secret');
      Severity: Minor
      Found in lts/lib/internal/crypto/keys.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 parseKeyType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function parseKeyType(typeStr, required, keyType, isPublic, optionName) {
        if (typeStr === undefined && !required) {
          return undefined;
        } else if (typeStr === 'pkcs1') {
          if (keyType !== undefined && keyType !== 'rsa') {
      Severity: Minor
      Found in lts/lib/internal/crypto/keys.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

      Consider simplifying this complex logical expression.
      Open

          if ((isInput && passphrase !== undefined &&
               !isStringOrBuffer(passphrase)) ||
              (!isInput && cipher != null && !isStringOrBuffer(passphrase))) {
            throw new ERR_INVALID_OPT_VALUE(option('passphrase', objName),
                                            passphrase);
      Severity: Major
      Found in lts/lib/internal/crypto/keys.js - About 40 mins to fix

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

        function parseKeyType(typeStr, required, keyType, isPublic, optionName) {
        Severity: Minor
        Found in lts/lib/internal/crypto/keys.js - About 35 mins to fix

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

          function getKeyObjectHandle(key, ctx) {
            if (ctx === kCreatePrivate) {
              throw new ERR_INVALID_ARG_TYPE(
                'key',
                ['string', 'Buffer', 'TypedArray', 'DataView'],
          Severity: Minor
          Found in lts/lib/internal/crypto/keys.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

          Avoid too many return statements within this function.
          Open

              return kKeyEncodingSEC1;
          Severity: Major
          Found in lts/lib/internal/crypto/keys.js - About 30 mins to fix

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

            function parseKeyEncoding(enc, keyType, isPublic, objName) {
              if (enc === null || typeof enc !== 'object')
                throw new ERR_INVALID_ARG_TYPE('options', 'object', enc);
            
              const isInput = keyType === undefined;
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 1 day to fix
            current/lib/internal/crypto/keys.js on lines 199..238

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

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

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

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

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

            Refactorings

            Further Reading

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

            function prepareAsymmetricKey(key, ctx) {
              if (isKeyObject(key)) {
                // Best case: A key object, as simple as that.
                return { data: getKeyObjectHandle(key, ctx) };
              } else if (typeof key === 'string' || isArrayBufferView(key)) {
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 1 day to fix
            current/lib/internal/crypto/keys.js on lines 275..307

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

            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 parseKeyType(typeStr, required, keyType, isPublic, optionName) {
              if (typeStr === undefined && !required) {
                return undefined;
              } else if (typeStr === 'pkcs1') {
                if (keyType !== undefined && keyType !== 'rsa') {
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 7 hrs to fix
            current/lib/internal/crypto/keys.js on lines 150..172

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

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

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

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

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

            Refactorings

            Further Reading

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

            function prepareSecretKey(key, bufferOnly = false) {
              if (!isArrayBufferView(key) && (bufferOnly || typeof key !== 'string')) {
                if (isKeyObject(key) && !bufferOnly) {
                  if (key.type !== 'secret')
                    throw new ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE(key.type, 'secret');
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 4 hrs to fix
            current/lib/internal/crypto/keys.js on lines 317..331

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

            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 getKeyObjectHandle(key, ctx) {
              if (ctx === kCreatePrivate) {
                throw new ERR_INVALID_ARG_TYPE(
                  'key',
                  ['string', 'Buffer', 'TypedArray', 'DataView'],
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 3 hrs to fix
            current/lib/internal/crypto/keys.js on lines 254..273

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

            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 parseKeyFormatAndType(enc, keyType, isPublic, objName) {
              const { format: formatStr, type: typeStr } = enc;
            
              const isInput = keyType === undefined;
              const format = parseKeyFormat(formatStr,
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 3 hrs to fix
            current/lib/internal/crypto/keys.js on lines 178..193

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

            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 PrivateKeyObject extends AsymmetricKeyObject {
              constructor(handle) {
                super('private', handle);
              }
            
            
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 2 hrs to fix
            current/lib/internal/crypto/keys.js on lines 121..135

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 89.

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

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

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

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

            Refactorings

            Further Reading

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

            module.exports = {
              // Public API.
              createSecretKey,
              createPublicKey,
              createPrivateKey,
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 2 hrs to fix
            current/lib/internal/crypto/keys.js on lines 361..378

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 81.

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

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

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

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

            Refactorings

            Further Reading

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

            class PublicKeyObject extends AsymmetricKeyObject {
              constructor(handle) {
                super('public', handle);
              }
            
            
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 2 hrs to fix
            current/lib/internal/crypto/keys.js on lines 107..119

            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

            class SecretKeyObject extends KeyObject {
              constructor(handle) {
                super('secret', handle);
              }
            
            
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 1 hr to fix
            current/lib/internal/crypto/keys.js on lines 84..96

            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 parseKeyFormat(formatStr, defaultFormat, optionName) {
              if (formatStr === undefined && defaultFormat !== undefined)
                return defaultFormat;
              else if (formatStr === 'pem')
                return kKeyFormatPEM;
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 1 hr to fix
            current/lib/internal/crypto/keys.js on lines 140..148

            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

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

            const {
              KeyObject: KeyObjectHandle,
              kKeyTypeSecret,
              kKeyTypePublic,
              kKeyTypePrivate,
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 1 hr to fix
            current/lib/internal/worker.js on lines 48..59

            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

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

            const {
              ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS,
              ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE,
              ERR_INVALID_ARG_TYPE,
              ERR_INVALID_ARG_VALUE,
            Severity: Major
            Found in lts/lib/internal/crypto/keys.js and 6 other locations - About 35 mins to fix
            current/lib/internal/crypto/diffiehellman.js on lines 9..16
            current/lib/internal/crypto/keygen.js on lines 31..38
            current/lib/internal/crypto/keys.js on lines 21..28
            lts/lib/internal/crypto/diffiehellman.js on lines 9..16
            lts/lib/internal/crypto/keygen.js on lines 31..38
            lts/lib/internal/modules/esm/loader.js on lines 9..16

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 46.

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

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

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

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

            Refactorings

            Further Reading

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

            for (const m of [[kKeyEncodingPKCS1, 'pkcs1'], [kKeyEncodingPKCS8, 'pkcs8'],
                             [kKeyEncodingSPKI, 'spki'], [kKeyEncodingSEC1, 'sec1']])
              encodingNames[m[0]] = m[1];
            Severity: Minor
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 35 mins to fix
            current/lib/internal/crypto/keys.js on lines 42..44

            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

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

            class AsymmetricKeyObject extends KeyObject {
              get asymmetricKeyType() {
                return this[kAsymmetricKeyType] ||
                       (this[kAsymmetricKeyType] = this[kHandle].getAsymmetricKeyType());
              }
            Severity: Minor
            Found in lts/lib/internal/crypto/keys.js and 1 other location - About 35 mins to fix
            current/lib/internal/crypto/keys.js on lines 100..105

            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