Showing 12 of 12 total issues
Method scan_validation_errors
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def scan_validation_errors
GettextSimpleRails::ModelInspector.model_classes do |inspector|
clazz_snake_name = StringCases.camel_to_snake(inspector.clazz.name)
@translations_hash["activerecord"]["errors"]["models"][clazz_snake_name] = {"attributes" => {}} unless @translations_hash["activerecord"]["errors"]["models"].key?(clazz_snake_name)
attributes_hash = @translations_hash["activerecord"]["errors"]["models"][clazz_snake_name]["attributes"]
- 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 scan_relation_errors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def scan_relation_errors
GettextSimpleRails::ModelInspector.model_classes do |inspector|
clazz_snake_name = StringCases.camel_to_snake(inspector.clazz.name)
@translations_hash["activerecord"]["errors"]["models"][clazz_snake_name] = {"attributes" => {}} unless @translations_hash["activerecord"]["errors"]["models"].key?(clazz_snake_name)
attributes_hash = @translations_hash["activerecord"]["errors"]["models"][clazz_snake_name]["attributes"]
- 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 translations
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def translations
return {
"number" => {
"currency" => {
"format" => {
Method injector_recursive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def injector_recursive(gettext_simple, locale, translations, pre_path = [])
if translations.is_a?(Hash)
translations.each do |key, val|
newpath = pre_path + [key]
injector_recursive(gettext_simple, locale, val, newpath)
- 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 devise_models
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def devise_models
classes = []
::Rails.application.eager_load!
- 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 translations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def translations
@translations_hash = {
"activerecord" => {
"attributes" => {}
}
- 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 injector_recursive
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def injector_recursive(gettext_simple, locale, translations, pre_path = [])
if translations.is_a?(Hash)
translations.each do |key, val|
newpath = pre_path + [key]
injector_recursive(gettext_simple, locale, val, newpath)
Method inject_translator_translations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def inject_translator_translations(gettext_simple)
@store_hash = {}
GettextSimpleRails::Translators.load_all.each do |translator_data|
translator = translator_data[:class].new
- 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 write_recursive_translations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.write_recursive_translations(fp, translations, pre_path = [], args = {})
if translations.is_a?(Hash)
translations.each do |key, val|
newpath = pre_path + [key]
write_recursive_translations(fp, val, newpath, :comment => "Default value: #{val}")
- 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 model_classes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.model_classes
clazzes = []
::Rails.application.eager_load!
::Object.constants.each do |clazz|
- 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 injector_recursive_array
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def injector_recursive_array(gettext_simple, locale, translations, pre_path = [])
translation_array = []
translations.each_with_index do |val, index|
gettext_key = "#{pre_path.join(".")}.#{index}"
translation = gettext_simple.translate_with_locale(locale.to_s, gettext_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 newest_po_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def newest_po_file
newest_time = nil
newest_path = nil
I18n.available_locales.each do |locale|
- 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"