Showing 14 of 16 total issues
Method generate_seo
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def generate_seo
self.seo = Weeler::Seo.create if self.seo.blank?
I18n.available_locales.each do |locale|
Globalize.with_locale(locale) do
- 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 lookup_in_database
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def lookup_in_database locale, key, scope = [], options = {}
result = Translation.locale(locale).lookup(key).load
if result.nil? || (::Weeler.empty_translation_acts_like_missing && result.blank?)
if ::Weeler.create_missing_translations
- 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 load_collection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_collection
return @load_collection if @load_collection.present?
if model
if collection
@load_collection = collection
- 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 build_main_menu
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.build_main_menu
home_menu_item = {name: "Home", weeler_path: ""}
content_menu_item = {name: "Content", weeler_path: "content"}
administration_menu_item = {name: "Administration", weeler_path: "administration"}
configuration_menu_item = {name: "Configuration", weeler_path: "configuration"}
- 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 lookup_in_cache
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def lookup_in_cache(locale, key, scope = [], options = {})
# reload cache if cache timestamp differs from last translations update
reload_cache if ((!ActiveRecord::Base.connection.data_source_exists?('settings')) || i18n_cache.read('UPDATED_AT') != Setting.i18n_updated_at)
return nil if i18n_cache.read([:missing, [locale, 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"
Further reading
Method locales_from_xlsx_sheet_row
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def locales_from_xlsx_sheet_row(row)
locales = []
row.each_with_index do |cell, i|
next unless i.positive?
- 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 acquire
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.acquire(name)
already_acquired = definitely_acquired?(name)
if already_acquired
yield
- 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 store_translation_from_xlsx_cell
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def store_translation_from_xlsx_cell(locale_translations, locale, key, cell)
value = cell.nil? ? '' : cell
return if locale.blank? || key.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 copy_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_files subdir, dest_dir
raise ArgumEnterror unless subdir.is_a? String
raise ArgumEnterror unless dest_dir.is_a? String
raise ArgumetnError if subdir.blank?
raise ArgumetnError if dest_dir.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 get_file_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_file_list subdir
raise ArgumentError unless subdir.is_a? String
raise ArgumetnError if subdir.blank?
dir = get_current_dir
search_path = [dir, 'templates', subdir].join('/') + '/'
- 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 acts_as_restful
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def acts_as_restful(active_record_model, options = {})
before_action(:load_record, only: [:show, :edit, :update, :destroy, :remove_image])
include InstanceMethodsOnActivation
helper_method :item_humanized_name
- 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 items_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def items_params
if permited_params.is_a? Proc
permited_params.call(params)
elsif permited_params.blank?
warning_suggestion = params[parameterized_name.to_sym].is_a?(Hash) ? params[parameterized_name.to_sym].keys.map{ |k| k.to_sym } : "permit_params:"
- 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 store_translations_from_xlsx_row
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def store_translations_from_xlsx_row(tranlsations_by_locales, row, locales)
locale = nil
key = nil
row.each_with_index do |cell, i|
- 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 reload_cache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reload_cache
i18n_cache.clear
Translation.all.each do |translation|
# Load in cache unless value is nil or it is blank and empty
- 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"