Nephos/botpop

View on GitHub

Showing 13 of 15 total issues

Method initialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize argv
    @argv = argv
    i = 0
    debugvars = []
    argv = @argv.dup
Severity: Minor
Found in arguments.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 forget has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def forget m, arguments, nb, what
    return if not cmd_allowed? m
    if arguments.nil?
      last = Entry.where(channel: m.channel.to_s, user: "self").last
      m.reply last ? "\"#{last.message}\" Forgotten" : "Nop"
Severity: Minor
Found in plugins/iamalive.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 exec_new has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exec_new m, _, s
    s.downcase!
    f = I18n.transliterate(s)[0]
    x = "Après je vous propose "
    x += (%w(a e i o u y).include?(f) ? "d'" : "de ") if not s.match(/^(d'|de ).+/)
Severity: Minor
Found in plugins/anecdote.rb - About 1 hr to fix

Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize arg
    if arg.is_a? String
      v = arg.match(/^(?<nb>\d+)d(?<faces>\d+)$/i)
      if v
        set_rolldice v
Severity: Minor
Found in plugins/dice/Dice.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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(str, dex, con, int, wiz, cha, opt={})
Severity: Major
Found in plugins/dice/Character.rb - About 50 mins to fix

Method let has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def let m, _, _, to, msg
Severity: Minor
Found in plugins/puppet.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize from, degats, opt, bonus, attack_opt={}
Severity: Minor
Found in plugins/dice/Weapon.rb - About 35 mins to fix

Method channels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def channels
    i = @argv.index('--channels') || @argv.index('-c')
    return ['#equilibre'] if i.nil?
    chans = @argv[(i+1)..-1]
    i = chans.index{|c| c[0] == '-'}
Severity: Minor
Found in arguments.rb - 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

Method get_one_argument has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_one_argument(name, default_value)
    if name.is_a? String
      i = @argv.index(name)
    elsif name.is_a? Array
      i = nil
Severity: Minor
Found in arguments.rb - 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

Method exec_new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def exec_new m, _, s
    s.downcase!
    f = I18n.transliterate(s)[0]
    x = "Après je vous propose "
    x += (%w(a e i o u y).include?(f) ? "d'" : "de ") if not s.match(/^(d'|de ).+/)
Severity: Minor
Found in plugins/anecdote.rb - 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

Method exec_fok has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def exec_fok m
    dos_execution m, lambda {|m|
      nick = Botpop::Builtins.get_ip_from_nick(m)[:nick]
      ip = Botpop::Builtins.get_ip_from_nick(m)[:ip]
      return m.reply "User '#{nick}' doesn't exists" if ip.nil?
Severity: Minor
Found in plugins/network.rb - 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

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

  def self.load_plugins
    Module.constants.select{ |m|
          (m = Module.const_get(m) rescue false) and
            (m.is_a?(Class)) and
            (m.ancestors.include?(Plugin)) and
Severity: Minor
Found in botpop.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 port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def port
    if ssl and not @argv.index('--port') and not @argv.index('-p')
      return 7000
    else
      i = @argv.index('--port') || @argv.index('-p')
Severity: Minor
Found in arguments.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