TechnologyAdvice/obey

View on GitHub

Showing 30 of 30 total issues

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

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

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

      validate: function(def, value, key, errors, initData) {
    Severity: Minor
    Found in src/types.js - About 35 mins to fix

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

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

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

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

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

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

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

              allow: function(def, value, key, errors) {
                const type = 'allow'
                const sub = typeof def.allow === 'object' && !Array.isArray(def.allow) ? Object.keys(def.allow) : def.allow
                const subIsArray = Array.isArray(sub)
                if ((subIsArray && sub.indexOf(value) === -1) || (!subIsArray && sub !== value)) {
            Severity: Minor
            Found in src/lib/validators.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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              check: context => {
                if (!types.strategies[context.def.type]) {
                  if (context.def.type.match(/[\/\\]/)) {
                    throw new Error(`Illegal type name: ${context.def.type}`)
                  }
            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

            Avoid too many return statements within this function.
            Open

                return rules.props.default
            Severity: Major
            Found in src/rules.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return Promise.all(promises)
              Severity: Major
              Found in src/typeStrategies/array.js - About 30 mins to fix

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

                  default: context => {
                    // Ensure array
                    if (!Array.isArray(context.value)) {
                      return context.fail('Value must be an array')
                    }
                Severity: Minor
                Found in src/typeStrategies/array.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