app/controllers/entities_controller.rb
Method get_list_of_records
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_list_of_records(options = {})
options[:query] ||= params[:query] if params[:query]
self.current_page = options[:page] if options[:page]
query, tags = parse_query_and_tags(options[:query])
self.current_query = query
- 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 EntitiesController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class EntitiesController < ApplicationController
before_action :set_current_tab, only: %i[index show]
before_action :set_view, only: %i[index show redraw]
before_action :set_options, only: :index
Method get_list_of_records
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_list_of_records(options = {})
options[:query] ||= params[:query] if params[:query]
self.current_page = options[:page] if options[:page]
query, tags = parse_query_and_tags(options[:query])
self.current_query = query
Method parse_query_and_tags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_query_and_tags(search_string)
return ['', ''] if search_string.blank?
query = []
tags = []
- 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"