node-opcua/node-opcua-crypto

View on GitHub

Showing 108 of 108 total issues

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

async function generatePrivateKeyFileJSRSA(privateKeyFilename: string, modulusLength: 2048 | 3072 | 4096) {
    const kp = jsrsasign.KEYUTIL.generateKeypair("RSA", modulusLength);
    const prv = kp.prvKeyObj;
    const pub = kp.pubKeyObj;
    const prvpem = jsrsasign.KEYUTIL.getPEM(prv, "PKCS8PRV");
packages/node-opcua-crypto/source_nodejs/generate_private_key_filename.ts on lines 40..48

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

Function make_suite has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function make_suite(algorithm: string, signatureLength: number) {
        it("should sign with a private key and verify with the public key - " + algorithm, function () {
            const alice_private_key = readPrivateKey(alice_private_key_filename);
            const options1 = {
                algorithm,
Severity: Major
Found in packages/node-opcua-crypto-test/test/test_crypto.ts - About 3 hrs to fix

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

    async function generatePrivateKeyFile(privateKeyFilename: string, modulusLength: 1024 | 2048 | 3072 | 4096) {
        const keys = await generateKeyPair(modulusLength);
        const privateKeyPem = await privateKeyToPEM(keys.privateKey);
        await fs.promises.writeFile(privateKeyFilename, privateKeyPem.privPem, "utf-8");
        privateKeyPem.privPem = "";
    packages/node-opcua-crypto/source_nodejs/generate_private_key_filename.ts on lines 27..33

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

    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

    export async function generatePrivateKeyFile(privateKeyFilename: string, modulusLength: 1024 | 2048 | 3072 | 4096) {
        const keys = await generateKeyPair(modulusLength);
        const privateKeyPem = await privateKeyToPEM(keys.privateKey);
        await fs.promises.writeFile(privateKeyFilename, privateKeyPem.privPem, "utf-8");
        privateKeyPem.privPem = "";
    packages/node-opcua-crypto-test/test/test_peculiar_edge_case.ts on lines 156..162

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 110.

    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

        it("should explore a 1024 bits RSA certificate", () => {
            const certificate = readCertificate(path.join(__dirname, "../test-fixtures/certs/server_cert_1024.pem"));
            const data = exploreCertificateInfo(certificate);
            data.publicKeyLength.should.eql(128);
            data.notAfter.should.be.instanceOf(Date);
    Severity: Major
    Found in packages/node-opcua-crypto-test/test/test_crypto_utils.ts and 1 other location - About 3 hrs to fix
    packages/node-opcua-crypto-test/test/test_crypto_utils.ts on lines 128..134

    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

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

        it("should explore a 2048 bits RSA certificate", () => {
            const certificate = readCertificate(path.join(__dirname, "../test-fixtures/certs/server_cert_2048.pem"));
            const data = exploreCertificateInfo(certificate);
            data.publicKeyLength.should.eql(256);
            data.notAfter.should.be.instanceOf(Date);
    Severity: Major
    Found in packages/node-opcua-crypto-test/test/test_crypto_utils.ts and 1 other location - About 3 hrs to fix
    packages/node-opcua-crypto-test/test/test_crypto_utils.ts on lines 121..127

    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

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

    export async function readCertificateSigningRequest(filename: string): Promise<CertificateSigningRequest> {
        const csr = await promisify(fs.readFile)(filename);
        if (csr[0] === 0x30 && csr[1] === 0x82) {
            // der format
            return csr as CertificateRevocationList;
    packages/node-opcua-crypto/source_nodejs/read_certificate_revocation_list.ts on lines 29..37

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

    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

    export async function readCertificateRevocationList(filename: string): Promise<CertificateRevocationList> {
        const crl = await promisify(fs.readFile)(filename);
        if (crl[0] === 0x30 && crl[1] === 0x82) {
            // der format
            return crl as CertificateRevocationList;
    packages/node-opcua-crypto/source_nodejs/read_certificate_signing_request.ts on lines 31..39

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

    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 encrypt_buffer(buffer: Buffer, algorithm: string, key: Buffer): Buffer {
        const iv = Buffer.alloc(16, 0); // Initialization vector.
        const cipher = createCipheriv(algorithm, key, iv);
        const encrypted_chunks: Buffer[] = [];
        encrypted_chunks.push(cipher.update(buffer));
    Severity: Major
    Found in packages/node-opcua-crypto-test/test/test_crypto.ts and 1 other location - About 3 hrs to fix
    packages/node-opcua-crypto-test/test/test_crypto.ts on lines 107..114

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 101.

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

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

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

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

    Refactorings

    Further Reading

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

    function decrypt_buffer(buffer: Buffer, algorithm: string, key: Buffer): Buffer {
        const iv = Buffer.alloc(16, 0); // Initialization vector.
        const decipher = createDecipheriv(algorithm, key, iv);
        const decrypted_chunks: Buffer[] = [];
        decrypted_chunks.push(decipher.update(buffer));
    Severity: Major
    Found in packages/node-opcua-crypto-test/test/test_crypto.ts and 1 other location - About 3 hrs to fix
    packages/node-opcua-crypto-test/test/test_crypto.ts on lines 98..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 101.

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

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

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

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

    Refactorings

    Further Reading

    File asn1.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import assert from "assert";
    import { oid_map } from "./oid_map.js";
    
    // https://github.com/lapo-luchini/asn1js/blob/master/asn1.js
    export enum TagType {
    Severity: Minor
    Found in packages/node-opcua-crypto/source/asn1.ts - About 3 hrs to fix

      File oid_map.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // https://github.com/lapo-luchini/asn1js/blob/master/oids.js
      export const oid_map: { [key: string]: { d: string; c: string; w?: boolean } } = {
          "0.9.2342.19200300.100.1.1": { d: "userID", c: "Some oddball X.500 attribute collection" },
          "0.9.2342.19200300.100.1.3": { d: "rfc822Mailbox", c: "Some oddball X.500 attribute collection" },
          "0.9.2342.19200300.100.1.25": { d: "domainComponent", c: "Men are from Mars, this OID is from Pluto" },
      Severity: Minor
      Found in packages/node-opcua-crypto/source/oid_map.ts - About 3 hrs to fix

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

        export function rsaLengthRsaPublicKey(key: PublicKeyPEM | PublicKey): number {
            key = coerceRsaPublicKeyPem(key);
            assert(typeof key === "string");
            const a = jsrsasign.KEYUTIL.getKey(key) as any;
            return a.n.toString(16).length / 2;
        Severity: Major
        Found in packages/node-opcua-crypto/source/crypto_utils2.ts and 1 other location - About 3 hrs to fix
        packages/node-opcua-crypto/source/crypto_utils2.ts on lines 118..123

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

        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

        export function rsaLengthPublicKey(key: PublicKeyPEM | PublicKey): number {
            key = coercePublicKeyPem(key);
            assert(typeof key === "string");
            const a = jsrsasign.KEYUTIL.getKey(key) as any;
            return a.n.toString(16).length / 2;
        Severity: Major
        Found in packages/node-opcua-crypto/source/crypto_utils2.ts and 1 other location - About 3 hrs to fix
        packages/node-opcua-crypto/source/crypto_utils2.ts on lines 124..129

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

        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

        Function explorePrivateKey has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function explorePrivateKey(privateKey2: PrivateKey): PrivateKeyInternals {
        
            const privateKey1 = privateKey2 .hidden;
            const privateKey = typeof privateKey1 === "string" ? convertPEMtoDER(privateKey1) : privateKey1.export({ format: "der", type: "pkcs1" });
        
        
        Severity: Major
        Found in packages/node-opcua-crypto/source/explore_private_key.ts - About 2 hrs to fix

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

          export interface CreateSelfSignCertificateOptions {
              privateKey: CryptoKey;
              notBefore?: Date;
              notAfter?: Date;
              validity?: number;
          packages/node-opcua-crypto/source/x509/create_self_signed_certificate.ts on lines 30..41

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

          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

          export interface CreateSelfSignCertificateOptions {
              privateKey: CryptoKey;
              notBefore?: Date;
              notAfter?: Date;
              validity?: number;
          packages/node-opcua-crypto-test/test/test_peculiar_edge_case.ts on lines 237..248

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

          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

          async function derToPrivateKey(privDer: ArrayBuffer): Promise<CryptoKey> {
              const crypto = getCrypto();
          
              return await crypto.subtle.importKey(
                  "pkcs8",
          packages/node-opcua-crypto/source/x509/create_key_pair.ts on lines 57..79

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

          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

          export async function derToPrivateKey(privDer: ArrayBuffer): Promise<CryptoKey> {
              const crypto = getCrypto();
          
              return await crypto.subtle.importKey(
                  "pkcs8",
          Severity: Major
          Found in packages/node-opcua-crypto/source/x509/create_key_pair.ts and 1 other location - About 2 hrs to fix
          packages/node-opcua-crypto-test/test/test_peculiar_edge_case.ts on lines 185..207

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

          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

          export async function privateKeyToPEM(privateKey: CryptoKey) {
              const crypto = getCrypto();
              const privDer = await crypto.subtle.exportKey("pkcs8", privateKey);
              const privPem = x509.PemConverter.encode(privDer, "PRIVATE KEY");
              return { privPem, privDer };
          Severity: Major
          Found in packages/node-opcua-crypto/source/x509/create_key_pair.ts and 1 other location - About 2 hrs to fix
          packages/node-opcua-crypto-test/test/test_peculiar_edge_case.ts on lines 173..178

          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

          Severity
          Category
          Status
          Source
          Language