mekanika/skematic

View on GitHub

Showing 37 of 45 total issues

Avoid deeply nested control flow statements.
Open

            if (!arsub.valid) {
              if (!errs[key]) errs[key] = {}
              errs[key][idx] = arsub.errors
            }
Severity: Major
Found in src/validate/validate.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (er.length) {
                  if (!errs[key]) errs[key] = {}
                  errs[key][idx] = er
                }
    Severity: Major
    Found in src/validate/validate.js - About 45 mins to fix

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

      function _checkKeys (model, data) {
        let ret = {
          valid: true,
          errors: {}
        }
      Severity: Minor
      Found in src/validate/validate.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 true
      Severity: Major
      Found in src/compute.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return [`wrongType:${model.type}`]
        Severity: Major
        Found in src/validate/checkValue.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            if (req && !provided) return false
          Severity: Major
          Found in src/compute.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                if (!isNaN(val) && typeof val === 'number') return val
            Severity: Major
            Found in src/plugins/typeconvert.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return true
              Severity: Major
              Found in src/is.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return setError(model, 'required', errs)
                Severity: Major
                Found in src/validate/checkValue.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return !!val
                  Severity: Major
                  Found in src/plugins/typeconvert.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      if (!model.required && val === undefined) return []
                    Severity: Major
                    Found in src/validate/checkValue.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return false
                      Severity: Major
                      Found in src/is.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return true
                        Severity: Major
                        Found in src/is.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                if (aKeys.length !== bKeys.length) return false
                          Severity: Major
                          Found in src/is.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    if (!is.equal(a[aKeys[i]], b[aKeys[i]])) return false
                            Severity: Major
                            Found in src/is.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                if (provided && preserve) return false
                              Severity: Major
                              Found in src/compute.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  return errs
                                Severity: Major
                                Found in src/validate/checkValue.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language