Showing 11 of 11 total issues
Method run
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def run
return if @db_helper.exists?(@payload) && !@fix_deps
return if !@db_helper.exists?(@payload) && @fix_deps
log "Adding: #{@payload.full_name}\n"
- 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 deps_for
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deps_for(gem_name)
dataset = @conn[<<-SQL, gem_name]
SELECT rv.name, rv.number, rv.platform, rv.required_ruby_version, rv.checksum,
rv.rubygems_version, d.requirements, rv.created_at, for_dep_name.name dep_name
FROM
Method find_or_insert_version
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def find_or_insert_version(spec, rubygem_id, platform = 'ruby', checksum = nil, indexed = nil)
insert = nil
version_id = nil
version = @db[:versions].filter(
rubygem_id: rubygem_id,
- 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 find_or_insert_version
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_or_insert_version(spec, rubygem_id, platform = 'ruby', checksum = nil, indexed = nil)
insert = nil
version_id = nil
version = @db[:versions].filter(
rubygem_id: rubygem_id,
Method versions
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def versions(date,include_yanks = false)
dataset = if include_yanks
@conn[<<-SQL, date,date]
(SELECT r.name, v.created_at as date, v.info_checksum, v.number, v.platform
FROM rubygems AS r, versions AS v
Method insert_dependencies
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_dependencies(spec, version_id)
deps_added = []
spec.dependencies.each do |dep|
rubygem_name = nil
Method insert_dependencies
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def insert_dependencies(spec, version_id)
deps_added = []
spec.dependencies.each do |dep|
rubygem_name = 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 fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fetch(url, redirects = 0, tries = [])
raise BundlerApi::HTTPError, "Too many redirects #{url}" if redirects >= REDIRECT_LIMIT
raise BundlerApi::HTTPError, "Could not download #{url} (#{tries.join(", ")})" if tries.size >= TRY_LIMIT
uri = URI.parse(url)
- 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(user, token, worker_index = nil)
return unless user && token
opts = {
on_error: error_handler,
- 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 find_or_insert_version
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_or_insert_version(spec, rubygem_id, platform = 'ruby', checksum = nil, indexed = nil)
Method get_payload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_payload
params = JSON.parse(request.body.read)
log "webhook request: #{params.inspect}"
if @rubygems_token && (params["rubygems_token"] != @rubygems_token)
- 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"