bourbest/sapin

View on GitHub

Showing 24 of 27 total issues

Function PropertyDefinition has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function PropertyDefinition (valueType, getter, validators = [], typeValidator = null, transform = null, collectionValidator = null) {
Severity: Minor
Found in src/types.js - About 45 mins to fix

    Function validateValidators has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const validateValidators = (validationType, validators, argumentName = 'validators') => {
      let valid = false
      if (isNil(validators)) {
        valid = true
      } else if (validationType === ValueTypes.value) {
    Severity: Minor
    Found in src/types.js - About 35 mins 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

    Function transformWithPropDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const transformWithPropDefinition = (propValue, propDefinition) => {
      if (propDefinition.valueType === ValueTypes.value) {
        return propDefinition.transform(propValue)
      } else if (isArray(propValue) && propDefinition.collectionValidator.indexOf(isOfTypeArray) > -1) {
        const valueValidator = propDefinition.validators
    Severity: Minor
    Found in src/transform.js - About 35 mins 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

    Function transformObject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function transformObject (object, schema) {
      const ret = {}
      for (let propName in object) {
        const propValue = object[propName]
        const propDefinition = schema[propName]
    Severity: Minor
    Found in src/transform.js - About 25 mins 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

    Severity
    Category
    Status
    Source
    Language