TechnologyAdvice/obey

View on GitHub

Showing 30 of 30 total issues

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

  requiredIf: function(def, value, key, errors, data) {
    const type = 'requiredIf'
    const sub = def.requiredIf
    if (typeof sub === 'object') {
      const field = Object.keys(sub)[0]
Severity: Major
Found in src/lib/validators.js and 1 other location - About 1 day to fix
src/lib/validators.js on lines 122..138

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

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

  requiredIfNot: function(def, value, key, errors, data) {
    const type = 'requiredIfNot'
    const sub = def.requiredIfNot
    if (typeof sub === 'object') {
      const field = Object.keys(sub)[0]
Severity: Major
Found in src/lib/validators.js and 1 other location - About 1 day to fix
src/lib/validators.js on lines 86..102

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

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

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

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

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

Refactorings

Further Reading

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

const phone = {
  _regex: {
    default: /^[\(\)\s\-\+\d]{10,17}$/,
    numeric: /\d{7,10}/
  },
Severity: Major
Found in src/typeStrategies/phone.js and 1 other location - About 1 day to fix
src/typeStrategies/zip.js on lines 1..18

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

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

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

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

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

Refactorings

Further Reading

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

const zip = {
  _regex: {
    default: /^([0-9]{5})(?:[-\s]*([0-9]{4}))?$/,
    ca: /^([A-Z][0-9][A-Z])\s*([0-9][A-Z][0-9])$/
  },
Severity: Major
Found in src/typeStrategies/zip.js and 1 other location - About 1 day to fix
src/typeStrategies/phone.js on lines 1..18

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

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

  max: function(def, value, key, errors) {
    const type = 'max'
    const sub = def.max
    if ((Array.isArray(value) || typeof value === 'string') && value.length > def.max) {
      errors.push({ type, sub, key, value, message: `Length must be less than or equal to ${def.max}` })
Severity: Major
Found in src/lib/validators.js and 1 other location - About 1 day to fix
src/lib/validators.js on lines 49..57

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

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

  min: function(def, value, key, errors) {
    const type = 'min'
    const sub = def.min
    if ((Array.isArray(value) || typeof value === 'string') && value.length < def.min) {
      errors.push({ type, sub, key, value, message: `Length must be greater than or equal to ${def.min}` })
Severity: Major
Found in src/lib/validators.js and 1 other location - About 1 day to fix
src/lib/validators.js on lines 67..75

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

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

  default: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(url._regex.default)) {
      context.fail('Value must be a valid URL')
    }
  }
Severity: Major
Found in src/typeStrategies/url.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 6..10
src/typeStrategies/ip.js on lines 11..15
src/typeStrategies/string.js on lines 10..14
src/typeStrategies/uuid.js on lines 7..11
src/typeStrategies/uuid.js on lines 12..16
src/typeStrategies/uuid.js on lines 17..21

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

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

  upper: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(uuid._regex.upper)) {
      context.fail('Value must be a valid UUID with all uppercase letters')
    }
  },
Severity: Major
Found in src/typeStrategies/uuid.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 6..10
src/typeStrategies/ip.js on lines 11..15
src/typeStrategies/string.js on lines 10..14
src/typeStrategies/url.js on lines 5..9
src/typeStrategies/uuid.js on lines 7..11
src/typeStrategies/uuid.js on lines 17..21

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

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

  default: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(uuid._regex.default)) {
      context.fail('Value must be a valid UUID')
    }
  },
Severity: Major
Found in src/typeStrategies/uuid.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 6..10
src/typeStrategies/ip.js on lines 11..15
src/typeStrategies/string.js on lines 10..14
src/typeStrategies/url.js on lines 5..9
src/typeStrategies/uuid.js on lines 12..16
src/typeStrategies/uuid.js on lines 17..21

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

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

  v4: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(ip._regex.v4)) {
      context.fail('Value must be a valid IPv4 address')
    }
  },
Severity: Major
Found in src/typeStrategies/ip.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 11..15
src/typeStrategies/string.js on lines 10..14
src/typeStrategies/url.js on lines 5..9
src/typeStrategies/uuid.js on lines 7..11
src/typeStrategies/uuid.js on lines 12..16
src/typeStrategies/uuid.js on lines 17..21

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

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

  v6: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(ip._regex.v6)) {
      context.fail('Value must be a valid IPv6 address')
    }
  },
Severity: Major
Found in src/typeStrategies/ip.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 6..10
src/typeStrategies/string.js on lines 10..14
src/typeStrategies/url.js on lines 5..9
src/typeStrategies/uuid.js on lines 7..11
src/typeStrategies/uuid.js on lines 12..16
src/typeStrategies/uuid.js on lines 17..21

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

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

  lower: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(uuid._regex.lower)) {
      context.fail('Value must be a valid UUID with all lowercase letters')
    }
  }
Severity: Major
Found in src/typeStrategies/uuid.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 6..10
src/typeStrategies/ip.js on lines 11..15
src/typeStrategies/string.js on lines 10..14
src/typeStrategies/url.js on lines 5..9
src/typeStrategies/uuid.js on lines 7..11
src/typeStrategies/uuid.js on lines 12..16

Duplicated Code

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

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

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

Tuning

This issue has a mass of 84.

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

  alphanumeric: context => {
    if (context.value == null || !context.value.length || !context.value.toString().match(string._regex.alphanumeric)) {
      context.fail('Value must contain only letters and/or numbers')
    }
  }
Severity: Major
Found in src/typeStrategies/string.js and 6 other locations - About 2 hrs to fix
src/typeStrategies/ip.js on lines 6..10
src/typeStrategies/ip.js on lines 11..15
src/typeStrategies/url.js on lines 5..9
src/typeStrategies/uuid.js on lines 7..11
src/typeStrategies/uuid.js on lines 12..16
src/typeStrategies/uuid.js on lines 17..21

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

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

  requireIf: function(def, value, key, errors, data) {
    console.log('-----\nObey Warning: `requireIf` should be `requiredIf`\n-----')
    def.requiredIf = def.requireIf
    delete def.requireIf
    validators.requiredIf(def, value, key, errors, data)
Severity: Major
Found in src/lib/validators.js and 1 other location - About 1 hr to fix
src/lib/validators.js on lines 142..147

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

  requireIfNot: function(def, value, key, errors, data) {
    console.log('-----\nObey Warning: `requireIfNot` should be `requiredIfNot`\n-----')
    def.requiredIfNot = def.requireIfNot
    delete def.requireIfNot
    validators.requiredIfNot(def, value, key, errors, data)
Severity: Major
Found in src/lib/validators.js and 1 other location - About 1 hr to fix
src/lib/validators.js on lines 106..111

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

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

  getProps: (def, val) => {
    // Require(d) alias
    if (def.require) {
      def.required = def.require
      delete def.require
Severity: Minor
Found in src/rules.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

  add: (name, fn) => {
    if (typeof name !== 'string') throw new Error('creator name should be a string')
    if (typeof fn !== 'function') throw new Error('creator method should be a function')
    creators.lib[name] = fn
  }
Severity: Major
Found in src/creators.js and 1 other location - About 1 hr to fix
src/modifiers.js on lines 36..40

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

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

  add: (name, fn) => {
    if (typeof name !== 'string') throw new Error('Modifier name should be a string')
    if (typeof fn !== 'function') throw new Error('Modifier method should be a function')
    modifiers.lib[name] = fn
  }
Severity: Major
Found in src/modifiers.js and 1 other location - About 1 hr to fix
src/creators.js on lines 37..41

Duplicated Code

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

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

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

Tuning

This issue has a mass of 63.

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

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

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

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

Refactorings

Further Reading

Function getProps has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getProps: (def, val) => {
    // Require(d) alias
    if (def.require) {
      def.required = def.require
      delete def.require
Severity: Minor
Found in src/rules.js - About 1 hr to fix

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

      requiredIfNot: function(def, value, key, errors, data) {
    Severity: Minor
    Found in src/lib/validators.js - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language