Showing 9 of 9 total issues
Method query
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query(params={ :conditions => {} })
# TODO: clarify naming of conditions, options, query.
params[:conditions][:is] ||= {}
params[:conditions][:in] ||= {}
Method query_request_params
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query_request_params
condition_matcher = '(
/[^/]+/(in|is|matches|contains)/[^/]+ |
/closest/[^/]+/[^/]+ |
/[^/]+/maround/[^/]+/[^/]+
Method query_request_params
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def query_request_params
condition_matcher = '(
/[^/]+/(in|is|matches|contains)/[^/]+ |
/closest/[^/]+/[^/]+ |
/[^/]+/maround/[^/]+/[^/]+
- 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 query
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def query(params={ :conditions => {} })
# TODO: clarify naming of conditions, options, query.
params[:conditions][:is] ||= {}
params[:conditions][:in] ||= {}
- 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 initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(database, table_name)
options = { dbname: database }
options[:host] = ENV["RESTFUL_GEOF_PG_HOST"] || "localhost"
options[:port] = ENV["RESTFUL_GEOF_PG_PORT"] || "5432"
options[:user] = ENV["RESTFUL_GEOF_PG_USERNAME"] if ENV["RESTFUL_GEOF_PG_USERNAME"]
Method handle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.handle(request)
params = Routes.new(request).params
action = params[:action]
return 400 unless action.is_in?([:query, :read, :create, :delete, :update])
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(database, table_name)
options = { dbname: database }
options[:host] = ENV["RESTFUL_GEOF_PG_HOST"] || "localhost"
options[:port] = ENV["RESTFUL_GEOF_PG_PORT"] || "5432"
options[:user] = ENV["RESTFUL_GEOF_PG_USERNAME"] if ENV["RESTFUL_GEOF_PG_USERNAME"]
- 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_sql
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_sql
raise "Need to specify table" unless @parts[:table]
raise "Need to specify fields" if @parts[:fields].empty?
raise "Need to specify values" if @parts[:values].empty?
raise "Need to specify where clause" unless @parts[:where]
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(params)
feature = RGeo::GeoJSON.decode(params[:body_json], :json_parser => :json)
properties = Hash[feature.properties.map { |k,v| [esc_i(k), i_or_quoted_s_for(v, k)] }]
unless feature.properties[@table_info.id_column].to_s == params[:id].to_s
- 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"