Showing 9 of 9 total issues
File matchers.rb
has 609 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'time'
require 'rspec'
require 'yajl'
Method mismatches
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def mismatches
counts = Hash.new 0
if @subfield
items.each do |item|
unless blank? item[@field]
- 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 matcher
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def matcher(meth)
if @subfield
items.send(meth) do |item|
if blank? item[@field]
meth == :reject
- 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
Class API
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class API
# @example
# require 'scraperwiki-api'
# api = ScraperWiki::API.new
#
Method matcher
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def matcher(meth)
if @subfield
items.send(meth) do |item|
if blank? item[@field]
meth == :reject
Method mismatches
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mismatches
counts = Hash.new 0
if @subfield
items.each do |item|
unless blank? item[@field]
Avoid deeply nested control flow statements. Open
if Hash === w
if blank? w[@subfield]
meth == :reject
else
match? w[@subfield]
Avoid deeply nested control flow statements. Open
if Hash === w
unless blank? w[@subfield]
counts[w[@subfield]] += 1
end
else
Method match?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def match?(v)
w = Yajl::Parser.parse v
if Hash === w
difference(w).empty?
elsif Array === w
- 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"