Showing 8 of 8 total issues
Method irc_bot
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def irc_bot
Octokit.configure do |c|
c.api_endpoint = Octospy.github_api_endpoint if Octospy.github_api_endpoint
c.web_endpoint = Octospy.github_web_endpoint if Octospy.github_web_endpoint
c.login = Octospy.github_login
- 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 show_commands
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def show_commands(m)
m.reply "#{m.bot.name}:"
@handlers.each do |handler|
pattern = handler.pattern.pattern
command = case pattern.class.name
- 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 parse_follow_event
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_follow_event
user = @event.payload.target
title = user.login
title = "#{title} (#{user.name})" if user.name && user.name != ''
- 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 build
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build(hash)
header = "#{hash[:nick].to_s.colorize_for_irc.bold} #{colorize_to hash[:status]}"
if hash[:repository] && !hash[:repository].empty?
header = "(#{hash[:repository]}) #{header}"
Method notify_recent_envets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def notify_recent_envets
events = repository_events
return if events.count.zero?
last_event = events.sort_by(&:id).last
- 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 build
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build(hash)
header = "#{hash[:nick].to_s.colorize_for_irc.bold} #{colorize_to hash[:status]}"
if hash[:repository] && !hash[:repository].empty?
header = "(#{hash[:repository]}) #{header}"
- 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 repository_events
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def repository_events
@repositories.each_with_object([]) do |repo, arr|
break unless api_requestable?
sleep Octospy.api_request_interval
- 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 unwatch_repositories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unwatch_repositories(m, owner)
repos = ::Octospy::Recordable.channel(m.channel.name).repos.each_with_object([]) do |repo, obj|
obj << repo if repo.to_s.split('/').first == owner
end
- 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"