Showing 49 of 49 total issues
Method initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(context, gateway, db)
@channels = Hash.new do|hash,name|
channel = gateway.channel "##{name}", handler: Handler.new(db, name)
channel.join_me
hash[name] = channel
Method http
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def http(uri, open_timeout = nil, read_timeout = 60)
http = case
when @@proxy
Net::HTTP.new(uri.host, uri.port, @@proxy.address, @@proxy.port,
@@proxy.user, @@proxy.password)
- Read upRead up
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 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(context, api, db)
@log = context.log
@api = api
@prev = nil
Method initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(context, gateway, db)
super
@log = context.log
@channel.notify "Client options: #{context.opts.marshal_dump.inspect}"
Method call
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def call(status)
target = short_url_regexp
entities = (entities = status.entities).nil? ? [] : entities.urls
status.merge text: status.text.gsub(target) {|url|
unless entities.nil? or entities.empty?
- Read upRead up
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 shorten
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def shorten(url)
return url if url =~ /bit\.ly/
bitly = URI("http://api.bit.ly/v3/shorten")
if @login and @key
bitly.path = "/shorten"
- Read upRead up
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 watch
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def watch(path, query={}, &f)
path.sub!(%r{\A/+}, "")
uri = api_base
uri.path += path
Method initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(context, api, db)
@log = context.log
@db = db
log :info, "initialize"
Method req
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def req(method, uri, header = {}, credentials = nil)
accepts = ["*/*"]
types = { "json" => "application/json", "txt" => "text/plain" }
ext = uri.path[/[^.]+\z/]
accepts.unshift types[ext] if types.key?(ext)
Method action
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action(target, mesg, command, args)
if args.empty?
yield "/me #{command} [option...] blah blah"
return
end
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(name)
@db = Sql.new name
@roman = Roman.new
unless File.exist? name then
Method levenshtein
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def levenshtein(a, b)
case
when a.empty?
b.length
when b.empty?
Method action
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action(target, mesg, command,args)
if args.empty?
yield "/me #{command} <ID>"
return
end
Method action
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action(target, mesg, command, args)
if args.empty?
yield "/me #{command} <ID1> <ID2> ..."
return
end
Method encode_www_form
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def encode_www_form(enum, enc=nil, separator: -'&')
enum.map do |k,v|
if v.nil?
encode_www_form_component(k, enc)
elsif v.respond_to?(:to_ary)
- Read upRead up
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 exist_uri?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def exist_uri?(uri, limit = 1)
ret = nil
#raise "Not supported." unless uri.is_a?(URI::HTTP)
return ret if limit.zero? or uri.nil? or not uri.is_a?(URI::HTTP)
@log.debug uri.inspect
- Read upRead up
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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(context, api, db)
@log = context.log
@api = api
@prev = nil
- Read upRead up
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 init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def init
return if @queue
debug "transaction thread start"
@queue = SizedQueue.new 10
- Read upRead up
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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(context, gateway, db)
@channels = Hash.new do|hash,name|
channel = gateway.channel "##{name}", handler: Handler.new(db, name)
channel.join_me
hash[name] = channel
- Read upRead up
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 method_missing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(mid, *args) # :nodoc:
mname = mid.id2name
len = args.length
if mname =~ /=$/
if len != 1
- Read upRead up
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"