FrankYan93/pa-ims

View on GitHub

Showing 6 of 6 total issues

Method respond has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def self.respond(usr_command, command_len)
        bigFlag = true#to see if add is successful
        store = YAML::Store.new('track_data.yml')
        data0 = JSON.parse(store.transaction { store[:data] } || {}.to_json)
        case usr_command
Severity: Minor
Found in ims-Command.rb - 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

Method count has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def count(data0, usr_command, command_len, complex_command)
    if complex_command[1] != 'tracks'
        puts 'You typed a command that is not very precise,but it does not matter since we only care about the third word!'
    end
    total = 0
Severity: Minor
Found in ims-Command.rb - 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

Method list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def list(data0, usr_command, command_len, complex_command)
    if complex_command[1] != 'tracks'
        puts 'You typed a command that is not very precise,but it does not matter since we only care about the third word!'
    end
    flag = false
Severity: Minor
Found in ims-Command.rb - 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

Method info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def info(data0, usr_command, command_len, data)
    flag = false
    data0.each do |x, y|
        if x.to_s == usr_command[(5...command_len)]
            trackInfo = Track_artist.new(x, y[0], y[1], data)
Severity: Minor
Found in ims-Command.rb - 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

Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def update(data0, usr_command, command_len, data)
    ar = 'default'
    s = ' by '
    if usr_command.include?' by '
        label = usr_command.rindex(s)
Severity: Minor
Found in ims-Command.rb - 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

Method add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def add(data0, usr_command, command_len, data)
    flag = usr_command[(4...command_len)].include?' by '
    ar = 'default'
    if flag
        label = usr_command.rindex(' by ') - 1
Severity: Minor
Found in ims-Command.rb - 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

Severity
Category
Status
Source
Language