Showing 6 of 8 total issues
Method parse
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def parse(file)
f = file.split("\n")
r = {}
r[:started] = try_date f.shift.match(/(?:at\s)(.+)/)[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"
Further reading
Method parse
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(file)
f = file.split("\n")
r = {}
r[:started] = try_date f.shift.match(/(?:at\s)(.+)/)[1]
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(m, url)
digest = Digest::SHA2.new(256)
request = Typhoeus::Request.new url, followlocation: true
request.on_headers do |res|
Method execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute(m, param)
param ||= ''
param.strip!
if param == ''
m.reply "Usage: #{@@commands.first}"
- 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 cmd_search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cmd_search(m, *params)
return m.reply 'Need to run !audit summary once first' unless @@summary
return m.reply 'Usage: audit search PATTERN' unless params && params.length > 0
pattern = params.join ' '
- 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 get_casklist
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_casklist(repo)
unless %r{/} =~ repo
repo = if %r{^homebrew-} =~ repo
"caskroom/#{repo}"
else
- 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"