RubyLouvre/avalon

View on GitHub
src/directives/duplex/updateDataEvents.compact.js

Summary

Maintainability
C
1 day
Test Coverage

Function updateDataEvents has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export function updateDataEvents(dom, data) {
    var events = {}
        //添加需要监听的事件
    switch (data.dtype) {
        case 'radio':
Severity: Minor
Found in src/directives/duplex/updateDataEvents.compact.js - About 4 hrs 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 updateDataEvents has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function updateDataEvents(dom, data) {
    var events = {}
        //添加需要监听的事件
    switch (data.dtype) {
        case 'radio':
Severity: Major
Found in src/directives/duplex/updateDataEvents.compact.js - About 2 hrs to fix

    Function getCaret has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getCaret(target) {
        var start = 0
        var normalizedValue
        var range
        var textInputRange
    Severity: Minor
    Found in src/directives/duplex/updateDataEvents.compact.js - About 1 hr to fix

      Function getCaret has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function getCaret(target) {
          var start = 0
          var normalizedValue
          var range
          var textInputRange
      Severity: Minor
      Found in src/directives/duplex/updateDataEvents.compact.js - About 55 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 deeply nested control flow statements.
      Open

                              if (window.netscape) {
                                  // Firefox <= 3.6 doesn't fire the 'input' event when text is filled in through autocomplete
                                  events.DOMAutoComplete = updateModel
                              }
      Severity: Major
      Found in src/directives/duplex/updateDataEvents.compact.js - About 45 mins to fix

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

        import { avalon, getShortID as markID, window, document, msie } from '../../seed/core'

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

        There are no issues that match your filters.

        Category
        Status