megakote/objectspy.js

View on GitHub

Showing 5 of 6 total issues

Function gc has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  gc() {
    const events = Object.keys(this.emmiter._events)

    const iterator = (object, callback) => {
      for (var key in object) if (object.hasOwnProperty(key))
Severity: Minor
Found in src/objectspy.js - About 2 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 set has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  set(path, value, silent = false) {
    if (typeof (path = this.is_valid_key(path)) === 'undefined') return this
    if (!path.length) return this.setRoot(path, value, silent)

    const split_path = path.split('.')
Severity: Minor
Found in src/objectspy.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 exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = ['bin', 'lib'].map(function(type){
  var config = {
    name: type,
    context: __dirname,
    entry: path.join(__dirname, type === 'bin' ? 'index.js' : 'src/objectspy.js'),
Severity: Minor
Found in webpack.config.js - About 1 hr to fix

    Function getchanges has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      getchanges() {
        const raw_changes = this.changes ? Object.keys(this.changes) : []
        if (!raw_changes) return
    
        this.changes = {}
    Severity: Minor
    Found in src/objectspy.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 loop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      loop() {
        const events = this.emmiter ? Object.keys(this.emmiter._events) : []
        if (!events) return
    
        const changes = this.getchanges()
    Severity: Minor
    Found in src/objectspy.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

    Severity
    Category
    Status
    Source
    Language