RubyLouvre/avalon

View on GitHub
src/vmodel/share.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function modelFactory has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

platform.modelFactory = function modelFactory(definition, dd) {
    var $computed = definition.$computed || {}
    delete definition.$computed
    var core = new IProxy(definition, dd)
    var $accessors = core.$accessors
Severity: Minor
Found in src/vmodel/share.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 modelFactory has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

platform.modelFactory = function modelFactory(definition, dd) {
    var $computed = definition.$computed || {}
    delete definition.$computed
    var core = new IProxy(definition, dd)
    var $accessors = core.$accessors
Severity: Minor
Found in src/vmodel/share.js - About 1 hr to fix

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

    export function canHijack(key, val, $proxyItemBackdoor) {
        if (key in $$skipArray)
            return false
        if (key.charAt(0) === '$') {
            if ($proxyItemBackdoor) {
    Severity: Minor
    Found in src/vmodel/share.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

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

    function toJson(val) {
        var xtype = avalon.type(val)
        if (xtype === 'array') {
            var array = []
            for (var i = 0; i < val.length; i++) {
    Severity: Minor
    Found in src/vmodel/share.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

    Avoid too many return statements within this function.
    Open

        return !(val && val.nodeName && val.nodeType)
    Severity: Major
    Found in src/vmodel/share.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

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

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

        export function IProxy(definition, dd) {
            avalon.mix(this, definition)
            avalon.mix(this, $$skipArray)
            this.$hashcode = avalon.makeHashCode('$')
            this.$id = this.$id || this.$hashcode
        Severity: Minor
        Found in src/vmodel/share.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

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

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

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

        There are no issues that match your filters.

        Category
        Status