Method add_aws_service_responses
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def add_aws_service_responses(request, aws_response)
return_hash = Hash.new
aws = Nokogiri::XML(aws_response.body)
# extract and collect info from the xml
- 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 add_aws_service_responses
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_aws_service_responses(request, aws_response)
return_hash = Hash.new
aws = Nokogiri::XML(aws_response.body)
# extract and collect info from the xml
Method add_asin_service_responses
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def add_asin_service_responses(request, asin, item_url)
# we want to highlight Amazon to link to 'search in this book', etc.
if asin
# Search or Look inside the book offered? We only know by trying and
# then screen-scraping.
- 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 add_asin_service_responses
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_asin_service_responses(request, asin, item_url)
# we want to highlight Amazon to link to 'search in this book', etc.
if asin
# Search or Look inside the book offered? We only know by trying and
# then screen-scraping.
Method handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(request)
isbn = request.referent.metadata['isbn']
isbn = isbn.gsub(/[^0-9X]/,'') if isbn
- 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
Avoid too many return
statements within this method. Open
return request.dispatched(self, DispatchedService::FailedFatal, e)
Avoid too many return
statements within this method. Open
return request.dispatched(self, true)
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(config)
# defaults
@url = 'http://webservices.amazon.com/onca/xml'
@reader_base_url = 'http://www.amazon.com/gp/reader/'
@display_name = "Amazon.com"
- 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"