RubyLouvre/avalon

View on GitHub
src/directives/validate.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function validate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    validate: function(field, isValidateAll, event) {

        var promises = []
        var value = field.value
        var elem = field.dom
Severity: Major
Found in src/directives/validate.js - About 2 hrs to fix

    Function validate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        validate: function(field, isValidateAll, event) {
    
            var promises = []
            var value = field.value
            var elem = field.dom
    Severity: Minor
    Found in src/directives/validate.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

    Function validateAll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        validateAll: function(callback) {
            var validator = this
            var vdom = this.vdom
            var fields = validator.fields = []
            collectFeild(vdom.children, fields, validator)
    Severity: Minor
    Found in src/directives/validate.js - About 1 hr to fix

      Function diff has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          diff: function(validator) {
              var vdom = this.node
              if (vdom.validator) {
                  return
              }
      Severity: Minor
      Found in src/directives/validate.js - About 45 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 collectFeild has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function collectFeild(nodes, fields, validator) {
          for (var i = 0, vdom; vdom = nodes[i++];) {
              var duplex = vdom.rules && vdom.duplex
              if (duplex) {
                  fields.push(duplex)
      Severity: Minor
      Found in src/directives/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

      Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
      Open

      import { avalon, isObject, platform } from '../seed/core'
      Severity: Minor
      Found in src/directives/validate.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      There are no issues that match your filters.

      Category
      Status