Showing 70 of 88 total issues
Class Ipregistry
has 71 methods (exceeds 20 allowed). Consider refactoring. Open
class Ipregistry < Base
def initialize(data)
super
Class Base
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
def initialize
@cache = nil
end
Class AbstractApi
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractApi < Base
##
# Geolocation
Method run
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.run(args, out = STDOUT)
show_url = false
show_json = false
# remove arguments that are probably coordinates so they are not
Class BanDataGouvFr
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class BanDataGouvFr < Base
STATE_CODE_MAPPINGS = {
"Guadeloupe" => "01",
"Martinique" => "02",
Method to_osgb_36
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_osgb_36
osgb_fo = 0.9996012717
northing0 = -100_000.0
easting0 = 400_000.0
phi0 = deg_to_rad(49.0)
Class Google
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Google < Base
def coordinates
['lat', 'lng'].map{ |i| geometry['location'][i] }
end
Method query_url_google_params
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def query_url_google_params(query)
params = {
:sensor => "false",
:language => (query.language || configuration.language)
}
- 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 Yandex
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Yandex < Base
# Yandex result has difficult tree structure,
# and presence of some nodes depends on exact search case.
# Also Yandex lacks documentation about it.
Class Nominatim
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Nominatim < Base
def poi
return address_data[place_type] if address_data.key?(place_type)
return nil
Class Geoapify
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Geoapify < Base
def address(_format = :full)
properties['formatted']
end
Method near_scope_options
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def near_scope_options(latitude, longitude, radius = 20, options = {})
if options[:units]
options[:units] = options[:units].to_sym
end
latitude_attribute = options[:latitude] || geocoder_options[:latitude]
- 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 field_names
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.field_names
{
:country => [
:country_code,
:error
Method do_lookup
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def do_lookup(reverse = false)
options = self.class.geocoder_options
if reverse and options[:reverse_geocode]
query = to_coordinates
elsif !reverse and options[:geocode]
- 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 search_geocode_ban_fr_params
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def search_geocode_ban_fr_params(query)
params = {
q: query.sanitized_text
}
unless (limit = query.options[:limit]).nil? || !limit_param_is_valid?(limit)
- 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_raw_data
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fetch_raw_data(query)
key = cache_key(query)
if cache and body = cache[key]
@cache_hit = true
else
- 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 results
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def results(query, reverse = false)
return [] unless doc = fetch_data(query)
case [doc['status'], doc['info']]
when ['1', 'OK']
return doc['regeocodes'] unless doc['regeocodes'].blank?
- 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 results
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def results(query)
return [] unless doc = fetch_data(query)
if doc['statusCode'] == 200
return doc['resourceSets'].first['estimatedTotal'] > 0 ? doc['resourceSets'].first['resources'] : []
- 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 near_scope_options
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def near_scope_options(latitude, longitude, radius = 20, options = {})
if options[:units]
options[:units] = options[:units].to_sym
end
latitude_attribute = options[:latitude] || geocoder_options[:latitude]
Method street_services
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def street_services
@street_services ||= [
:location_iq,
:dstk,
:esri,