JenkinsDev/Validatinator

View on GitHub

Showing 44 of 44 total issues

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 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 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 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("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("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 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

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("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("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 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 2 locations. Consider refactoring.
Open

  static dateAfter(form: HTMLFormElement, field: HTMLInputElement, date: string) {
    return Date.parse(field.value) > Date.parse(date);
  }
Severity: Minor
Found in src/validations.ts and 1 other location - About 55 mins to fix
src/validations.ts on lines 82..84

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

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