Showing 13 of 43 total issues
File client_spec.rb
has 548 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "spec_helper"
describe GreenButtonData::Client do
let :config do
{
File application_information_spec.rb
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "spec_helper"
describe GreenButtonData::ApplicationInformation do
let(:all_url) { GreenButtonData.configuration.application_information_url }
let(:find_url) { "#{all_url}2" }
Method each_entry_content
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def each_entry_content(feed)
entry_content = nil
feed.entries.each do |entry|
match_data = resource_from_url(entry.self)
- 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 to_h
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_h
{
authorization_server_authorization_endpoint:
authorization_server_authorization_endpoint,
authorization_server_registration_endpoint:
Method pluralize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def pluralize
result = self.dup
if self.empty?
return result
- 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_query_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build_query_params(options)
params = {}
options.each do |key, value|
if key == :published_min || key == :published_max
- 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 dst_datetime
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def dst_datetime(dst_rule, year, month, weekday, day, hour, seconds)
Method validate_dst_rules
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_dst_rules(dst_rule, month, weekday, day, hour, seconds)
Method fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fetch(url = nil, options = nil)
url or raise ArgumentError.new "url is required to fetch data"
connection_options = {}
- 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 dst_datetime
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def dst_datetime(dst_rule, year, month, weekday, day, hour, seconds)
if dst_rule == 1
# Rule 1: DST starts/ends on Day of Week on or after the Day of Month
day_of_month = DateTime.new year, month, day
day_offset = if weekday >= day_of_month.wday
- 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_resource
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_resource(url, id = nil, klazz = nil, options = {})
klazz ||= Entry.class_from_name Entry.class_name_from_url url
# Merge request options
options[:token] ||= token if 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"
Further reading
Method sanitize_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_options(options)
options.delete(:interval_block_id) if options.has_key? :interval_block_id
options.delete(:meter_reading_id) if options.has_key? :meter_reading_id
options.delete(:subscription_id) if options.has_key? :subscription_id
options.delete(:usage_point_id) if options.has_key? :usage_point_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 to_a
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_a
result = []
@interval_readings.each do |interval_reading|
reading = {
- 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"