Showing 15 of 24 total issues
Method construct_menu
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def construct_menu(nodes, options = {}, current = nil)
ul_class = ''
case options
when 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 construct_menu
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def construct_menu(nodes, options = {}, current = nil)
ul_class = ''
case options
when Hash
Method read_entry_type
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.read_entry_type
yaml = YAML::load(File.read(Rails.root.join(Option.entry_types_yaml_path)))
yaml['taxonomies'] = {}
yaml['entry_type_associations'] = {}
Method menu_item
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def menu_item(node, options = {})
result = ''
link_label = (node.rgt - node.lft > 1) ? icon('caret-down', node.to_s, 'right') : node.to_s
result << '<div class="node">' unless options[:li_wrapper].eql?(false)
- 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 truncate_html
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def truncate_html(text, len = 30, at_end = ' ...')
p = REXML::Parsers::PullParser.new((text.presence || '<p> </p>').gsub(/[\r\n\t]/, ''))
tags = []
new_len = len
results = ''
Method read_entry_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.read_entry_type
yaml = YAML::load(File.read(Rails.root.join(Option.entry_types_yaml_path)))
yaml['taxonomies'] = {}
yaml['entry_type_associations'] = {}
- 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_tree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_tree(taxonomy_type, status=nil)
taxonomies_sorted = []
curr_level = 0
leveling = [99]
depth = 0
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@option = Option.new(params[:option])
value = {'entry_types' => params[:entry_types], 'fields' => []}
if params[:field].present?
- 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 index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def index
dirname = THEMES_DIRECTORIES
@themes = Array.new
Dir.foreach(dirname) do |filename|
if File.directory?(dirname + filename) && filename != '.' && filename != '..'
- 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_tree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_tree(entry_type, status=nil)
entries_sorted = []
curr_level = 0
level = 0
leveling = [99]
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def update
@option = Option.find(params[:id])
value = {'entry_types' => params[:entry_types], 'fields' => []}
if params[:field].present?
- 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 truncate_html
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def truncate_html(text, len = 30, at_end = ' ...')
p = REXML::Parsers::PullParser.new((text.presence || '<p> </p>').gsub(/[\r\n\t]/, ''))
tags = []
new_len = len
results = ''
- 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 component
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def component(content = nil, title = nil, footer = nil, id = nil)
result = '<div class="component ' + (title.present? ? title.parameterize + '-component' : '') + '"'
result << ' id="' + id + '" ' if id.present?
result << '>'
result << '<div class="component_title">' + title + '</div>' if title.present?
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
omniauth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if authentication
flash[:notice] = "Signed in successfully."
- 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 convert_entry_metas_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert_entry_metas_attributes(entry_metas_attributes)
entry_metas_attributes.each do |k, v|
if(v.count == 4 || v.count == 5)
entry_metas_attributes[k]['value'] = Time.parse("#{v['date_value(1i)']}-#{v['date_value(2i)']}-#{v['date_value(3i)']}")
elsif(v.count == 6 || v.count == 7)
- 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"