dashpresshq/dashpress

View on GitHub
src/shared/validations/validations-map.ts

Summary

Maintainability
D
1 day
Test Coverage
A
96%

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

  greaterThanOtherField: {
    label: msg`Greater Than Other Field`,
    input: {
      otherField: "",
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 4 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 170..177
src/shared/validations/validations-map.ts on lines 179..186
src/shared/validations/validations-map.ts on lines 197..204
src/shared/validations/validations-map.ts on lines 206..213

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

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

  max: {
    label: msg`Max`,
    input: {
      value: 10,
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 3 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 129..136
src/shared/validations/validations-map.ts on lines 145..152
src/shared/validations/validations-map.ts on lines 153..160

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

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

  minLength: {
    label: msg`Min Length`,
    input: {
      length: 3,
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 3 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 129..136
src/shared/validations/validations-map.ts on lines 137..144
src/shared/validations/validations-map.ts on lines 145..152

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

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

  min: {
    label: msg`Min`,
    input: {
      value: 3,
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 3 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 137..144
src/shared/validations/validations-map.ts on lines 145..152
src/shared/validations/validations-map.ts on lines 153..160

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

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

  doesntMatchOtherField: {
    label: msg`Not Equal To Other Field`,
    input: {
      otherField: "",
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 4 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 170..177
src/shared/validations/validations-map.ts on lines 179..186
src/shared/validations/validations-map.ts on lines 188..195
src/shared/validations/validations-map.ts on lines 206..213

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

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

  regex: {
    label: msg`Regex`,
    input: {
      pattern: "//",
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 4 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 170..177
src/shared/validations/validations-map.ts on lines 179..186
src/shared/validations/validations-map.ts on lines 188..195
src/shared/validations/validations-map.ts on lines 197..204

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

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

  matchOtherField: {
    label: msg`Equal To Other Field`,
    input: {
      otherField: "",
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 4 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 179..186
src/shared/validations/validations-map.ts on lines 188..195
src/shared/validations/validations-map.ts on lines 197..204
src/shared/validations/validations-map.ts on lines 206..213

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

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

  lessThanOtherField: {
    label: msg`Less Than Other Field`,
    input: {
      otherField: "",
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 4 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 170..177
src/shared/validations/validations-map.ts on lines 188..195
src/shared/validations/validations-map.ts on lines 197..204
src/shared/validations/validations-map.ts on lines 206..213

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

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

  maxLength: {
    label: msg`Max Length`,
    input: {
      length: 100,
    },
Severity: Major
Found in src/shared/validations/validations-map.ts and 3 other locations - About 1 hr to fix
src/shared/validations/validations-map.ts on lines 129..136
src/shared/validations/validations-map.ts on lines 137..144
src/shared/validations/validations-map.ts on lines 153..160

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

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

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

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

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

Refactorings

Further Reading

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

  isJson: {
    label: msg`JSON`,
    isBoundToType: ["json"],
    message: msg`[[ name ]] is an invalid json`,
    implementation: handleValidation(isJSON),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 56..61
src/shared/validations/validations-map.ts on lines 81..86
src/shared/validations/validations-map.ts on lines 87..92
src/shared/validations/validations-map.ts on lines 93..98
src/shared/validations/validations-map.ts on lines 99..104
src/shared/validations/validations-map.ts on lines 105..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 50.

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

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

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

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

Refactorings

Further Reading

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

  isUrl: {
    label: msg`URL`,
    isBoundToType: ["url"],
    message: msg`[[ name ]] is an invalid URL`,
    implementation: handleValidation(isURL),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 56..61
src/shared/validations/validations-map.ts on lines 62..67
src/shared/validations/validations-map.ts on lines 81..86
src/shared/validations/validations-map.ts on lines 93..98
src/shared/validations/validations-map.ts on lines 99..104
src/shared/validations/validations-map.ts on lines 105..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 50.

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

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

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

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

Refactorings

Further Reading

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

  isNumber: {
    label: msg`Number`,
    isBoundToType: ["number"],
    message: msg`[[ name ]] should be a number`,
    implementation: handleValidation(isNumber),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 56..61
src/shared/validations/validations-map.ts on lines 62..67
src/shared/validations/validations-map.ts on lines 81..86
src/shared/validations/validations-map.ts on lines 87..92
src/shared/validations/validations-map.ts on lines 93..98
src/shared/validations/validations-map.ts on lines 105..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 50.

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

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

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

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

Refactorings

Further Reading

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

  isBoolean: {
    label: msg`Boolean`,
    isBoundToType: ["boolean"],
    message: msg`[[ name ]] should be a boolean`,
    implementation: handleValidation(isBoolean),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 56..61
src/shared/validations/validations-map.ts on lines 62..67
src/shared/validations/validations-map.ts on lines 81..86
src/shared/validations/validations-map.ts on lines 87..92
src/shared/validations/validations-map.ts on lines 93..98
src/shared/validations/validations-map.ts on lines 99..104

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

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

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

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

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

Refactorings

Further Reading

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

  isEmail: {
    label: msg`Email`,
    isBoundToType: ["email"],
    message: msg`[[ name ]] is an invalid email`,
    implementation: handleValidation(isEmail),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 62..67
src/shared/validations/validations-map.ts on lines 81..86
src/shared/validations/validations-map.ts on lines 87..92
src/shared/validations/validations-map.ts on lines 93..98
src/shared/validations/validations-map.ts on lines 99..104
src/shared/validations/validations-map.ts on lines 105..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 50.

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

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

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

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

Refactorings

Further Reading

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

  isColor: {
    label: msg`Color`,
    isBoundToType: ["color"],
    message: msg`[[ name ]] should be a color`,
    implementation: handleValidation(isRgbColor),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 56..61
src/shared/validations/validations-map.ts on lines 62..67
src/shared/validations/validations-map.ts on lines 87..92
src/shared/validations/validations-map.ts on lines 93..98
src/shared/validations/validations-map.ts on lines 99..104
src/shared/validations/validations-map.ts on lines 105..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 50.

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

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

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

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

Refactorings

Further Reading

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

  isDate: {
    label: msg`Date`,
    isBoundToType: ["datetime-local"],
    message: msg`[[ name ]] is an invalid date`,
    implementation: handleValidation(isDate),
Severity: Major
Found in src/shared/validations/validations-map.ts and 6 other locations - About 45 mins to fix
src/shared/validations/validations-map.ts on lines 56..61
src/shared/validations/validations-map.ts on lines 62..67
src/shared/validations/validations-map.ts on lines 81..86
src/shared/validations/validations-map.ts on lines 87..92
src/shared/validations/validations-map.ts on lines 99..104
src/shared/validations/validations-map.ts on lines 105..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 50.

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