Method perform_query
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.perform_query(site, url, api_data={}, raw=false)
raise ArgumentError, 'site is invalid, this should be set to either :osm or :ogm' unless Osm::Api::BASE_URLS.keys.include?(site)
data = api_data.merge({
'apiid' => @@api_details[site][: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 configure
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.configure(options)
unless options[:i_know].eql?(:unsupported)
raise Osm::Error, 'The OSM gem is now unsupported. ' \
'To continue using it append "i_know: :unsupported" to your passed options. ' \
"See #{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'UNSUPPORTED.md'))} for more details."
- 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 perform_query
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.perform_query(site, url, api_data={}, raw=false)
raise ArgumentError, 'site is invalid, this should be set to either :osm or :ogm' unless Osm::Api::BASE_URLS.keys.include?(site)
data = api_data.merge({
'apiid' => @@api_details[site][:id],
Method get_osm_error
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.get_osm_error(data)
return false unless data.is_a?(Hash)
return false if data['ok']
to_return = data['error'] || data['err'] || false
if to_return.is_a?(Hash)
- 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_user_roles!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_user_roles!(options={})
cache_key = ['user_roles', @user_id]
if !options[:no_cache] && Osm::Model.cache_exist?(self, cache_key)
return Osm::Model.cache_read(self, cache_key)
- 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"