JenkinsDev/Validatinator

View on GitHub
src/validations.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

File validations.spec.ts has 702 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { HTMLFormValidations } from "./validations";

export function createAndGetFormAndInput(
  type: string,
  value: string,
Severity: Major
Found in src/validations.spec.ts - About 1 day to fix

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

    describe("HTMLFormValidations.max", () => {
      describe("when the field's value is not a valid number", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "not-a-number");
          expect(HTMLFormValidations.max(form, field, "5")).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 day to fix
    src/validations.spec.ts on lines 511..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 290.

    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

    describe("HTMLFormValidations.min", () => {
      describe("when the field's value is not a valid number", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "not-a-number");
          expect(HTMLFormValidations.min(form, field, "5")).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 day to fix
    src/validations.spec.ts on lines 455..485

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

    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

      describe("when the otherField's value equals the provided value", () => {
        describe("and the field's value is empty", () => {
          test("should return false", () => {
            const [form, field] = createAndGetFormAndInput("text", "");
            const otherField = createAndGetInput(form, "text", "test");
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 day to fix
    src/validations.spec.ts on lines 672..698

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

    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

      describe("when the otherField's value does not equal the provided comparator value", () => {
        describe("and the field's value is empty", () => {
          test("should return false", () => {
            const [form, field] = createAndGetFormAndInput("text", "");
            const otherField = createAndGetInput(form, "text", "test");
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 day to fix
    src/validations.spec.ts on lines 624..650

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

    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

    describe("HTMLFormValidations.minLength", () => {
      describe("when the field's value is less than the minLength", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "abc");
          expect(HTMLFormValidations.minLength(form, field, 5)).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 day to fix
    src/validations.spec.ts on lines 487..508

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

    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

    describe("HTMLFormValidations.maxLength", () => {
      describe("when the field's value is less than the maxLength", () => {
        test("should return true", () => {
          const [form, field] = createAndGetFormAndInput("text", "abc");
          expect(HTMLFormValidations.maxLength(form, field, 5)).toBe(true);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 day to fix
    src/validations.spec.ts on lines 543..564

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

    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

    describe("HTMLFormValidations.alphaDash", () => {
      const failureTestCases = [
        "1", "a1", "a1%", "a\t", "#$1",
        "a b", "a.b", "a,b"
      ];
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 6 hrs to fix
    src/validations.spec.ts on lines 91..110

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

    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

    describe("HTMLFormValidations.alphaNum", () => {
      const failureTestCases = [
        "a1%", "a\t", "#$1", "a b",
        "a.b", "a,b", "a-b", "a_b"
      ];
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 6 hrs to fix
    src/validations.spec.ts on lines 70..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 168.

    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

        describe("and the field's value is the same as the provided value, with different casing", () => {
          test("should return true", () => {
            const [form, field] = createAndGetFormAndInput("text", "SaMe");
            const otherField = createAndGetInput(form, "text", "same");
    
    
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 6 hrs to fix
    src/validations.spec.ts on lines 722..737

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

    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

          describe("without casing differences", () => {
            test("should return true", () => {
              const [form, field] = createAndGetFormAndInput("text", "test");
              const otherField = createAndGetInput(form, "text", "test");
    
    
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 6 hrs to fix
    src/validations.spec.ts on lines 271..286

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

    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

    describe("HTMLFormValidations.number", () => {
      describe("when the field's value is not a valid number", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "not-a-number");
          expect(HTMLFormValidations.number(form, field)).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 5 hrs to fix
    src/validations.spec.ts on lines 398..412

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

    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

    describe("HTMLFormValidations.email", () => {
      describe("when the field's value is not a valid email", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "not-an-email");
          expect(HTMLFormValidations.email(form, field)).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 5 hrs to fix
    src/validations.spec.ts on lines 582..596

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

    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

        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "");
          invalidIPv4Addresses.forEach(ipv4Address => {
            field.value = ipv4Address;
            expect(HTMLFormValidations.ipvFour(form, field)).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 2 hrs to fix
    src/validations.spec.ts on lines 445..451

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

    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

        test("should return true", () => {
          const [form, field] = createAndGetFormAndInput("text", "");
          validIPv4Addresses.forEach(ipv4Address => {
            field.value = ipv4Address;
            expect(HTMLFormValidations.ipvFour(form, field)).toBe(true);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 2 hrs to fix
    src/validations.spec.ts on lines 430..436

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

    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 4 locations. Consider refactoring.
    Open

        describe("and the field's value is exactly the same as the provided value", () => {
          test("should return false", () => {
            const [form, field] = createAndGetFormAndInput("text", "SaMe");
            const otherField = createAndGetInput(form, "text", "SaMe");
    
    
    Severity: Major
    Found in src/validations.spec.ts and 3 other locations - About 2 hrs to fix
    src/validations.spec.ts on lines 262..269
    src/validations.spec.ts on lines 703..710
    src/validations.spec.ts on lines 713..720

    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

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

        describe("and the field's value is different from the otherField's value", () => {
          test("should return false", () => {
            const [form, field] = createAndGetFormAndInput("text", "abc");
            const otherField = createAndGetInput(form, "text", "def");
    
    
    Severity: Major
    Found in src/validations.spec.ts and 3 other locations - About 2 hrs to fix
    src/validations.spec.ts on lines 253..260
    src/validations.spec.ts on lines 262..269
    src/validations.spec.ts on lines 713..720

    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

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

          describe("with casing differences", () => {
            test("should return false", () => {
              const [form, field] = createAndGetFormAndInput("text", "TesT");
              const otherField = createAndGetInput(form, "text", "test");
    
    
    Severity: Major
    Found in src/validations.spec.ts and 3 other locations - About 2 hrs to fix
    src/validations.spec.ts on lines 253..260
    src/validations.spec.ts on lines 262..269
    src/validations.spec.ts on lines 703..710

    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

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

        describe("and the field's value not the same at all", () => {
          test("should return true", () => {
            const [form, field] = createAndGetFormAndInput("text", "SaMe");
            const otherField = createAndGetInput(form, "text", "not-the-same-at-all");
    
    
    Severity: Major
    Found in src/validations.spec.ts and 3 other locations - About 2 hrs to fix
    src/validations.spec.ts on lines 253..260
    src/validations.spec.ts on lines 703..710
    src/validations.spec.ts on lines 713..720

    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

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

      describe("when the field's value matches the pattern", () => {
        test("should return true", () => {
          const regex = "[0-9]{2,4}[a-z]+";
          const [form, field] = createAndGetFormAndInput("text", "343bde");
          expect(HTMLFormValidations.pattern(form, field, regex)).toBe(true);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 hr to fix
    src/validations.spec.ts on lines 808..814

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

    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

      describe("when the field's value does not match the pattern", () => {
        test("should return false", () => {
          const regex = "[0-9]{2,4}[a-z]+";
          const [form, field] = createAndGetFormAndInput("text", "not a match");
          expect(HTMLFormValidations.pattern(form, field, regex)).toBe(false);
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 hr to fix
    src/validations.spec.ts on lines 816..822

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

    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

      describe("when the field's value is not in the provided list", () => {
        test("should return true", () => {
          const [form, field] = createAndGetFormAndInput("text", "abc");
          expect(HTMLFormValidations.notIn(form, field, ...["def", "ghi"])).toBe(true);
        });
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 hr to fix
    src/validations.spec.ts on lines 574..579

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

    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

      describe("when the field's value is in the provided list", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "def");
          expect(HTMLFormValidations.notIn(form, field, ...["def", "ghi"])).toBe(false);
        });
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 hr to fix
    src/validations.spec.ts on lines 567..572

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

    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

      describe("when the field's value is not contained in the array", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "no");
          expect(HTMLFormValidations.contains(form, field, "a", "b", "c")).toBe(false);
        });
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 hr to fix
    src/validations.spec.ts on lines 174..179

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 68.

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

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

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

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

    Refactorings

    Further Reading

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

      describe("when the field's value is contained in the array", () => {
        test("should return true", () => {
          const [form, field] = createAndGetFormAndInput("text", "a");
          expect(HTMLFormValidations.contains(form, field, "a", "b", "c")).toBe(true);
        });
    Severity: Major
    Found in src/validations.spec.ts and 1 other location - About 1 hr to fix
    src/validations.spec.ts on lines 167..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 68.

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

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

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

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

    Refactorings

    Further Reading

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

        describe("and the field's value is between the minLength and maxLength", () => {
          test("should return true", () => {
            const [form, field] = createAndGetFormAndInput("text", "123456");
            expect(HTMLFormValidations.digitsLengthBetween(form, field, 5, 10)).toBe(true);
          });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

      describe("when the field is not between the values", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "1203.23");
          expect(HTMLFormValidations.between(form, field, 0, 10)).toBe(false);
        });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

        describe("and the field value's length is equal to maxLength", () => {
          test("should return true", () => {
            const [form, field] = createAndGetFormAndInput("text", "1234567890");
            expect(HTMLFormValidations.digitsLengthBetween(form, field, 5, 10)).toBe(true);
          });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387

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

    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 9 locations. Consider refactoring.
    Open

        describe("and the field value's length is less than minLength", () => {
          test("should return false", () => {
            const [form, field] = createAndGetFormAndInput("text", "20");
            expect(HTMLFormValidations.digitsLengthBetween(form, field, 5, 10)).toBe(false);
          });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

        describe("and the field value's length is equal to minLength", () => {
          test("should return true", () => {
            const [form, field] = createAndGetFormAndInput("text", "12345");
            expect(HTMLFormValidations.digitsLengthBetween(form, field, 5, 10)).toBe(true);
          });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

      describe("when the field value's length is between the values", () => {
        test("should return true", () => {
          const [form, field] = createAndGetFormAndInput("text", "12");
          expect(HTMLFormValidations.betweenLength(form, field, 0, 10)).toBe(true);
        });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

      describe("when the field's value is not a valid number", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "not-a-number");
          expect(HTMLFormValidations.digitsLengthBetween(form, field, 5, 10)).toBe(false);
        });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

        describe("and the field value's length is greater than maxLength", () => {
          test("should return false", () => {
            const [form, field] = createAndGetFormAndInput("text", "203213123124213123123");
            expect(HTMLFormValidations.digitsLengthBetween(form, field, 5, 10)).toBe(false);
          });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 151..156
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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 9 locations. Consider refactoring.
    Open

      describe("when the field value's length is not between the values", () => {
        test("should return false", () => {
          const [form, field] = createAndGetFormAndInput("text", "asdfasdfasdfasdf");
          expect(HTMLFormValidations.betweenLength(form, field, 0, 10)).toBe(false);
        });
    Severity: Major
    Found in src/validations.spec.ts and 8 other locations - About 1 hr to fix
    src/validations.spec.ts on lines 135..140
    src/validations.spec.ts on lines 158..163
    src/validations.spec.ts on lines 353..358
    src/validations.spec.ts on lines 361..366
    src/validations.spec.ts on lines 368..373
    src/validations.spec.ts on lines 375..380
    src/validations.spec.ts on lines 382..387
    src/validations.spec.ts on lines 389..394

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

    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