glebm/i18n-tasks

View on GitHub
lib/i18n/tasks/missing_keys.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
99%

Method missing_plural_forest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def missing_plural_forest(locales, _base = base_locale)
      locales.each_with_object(empty_forest) do |locale, forest|
        required_keys = required_plural_keys_for_locale(locale)
        next if required_keys.empty?

Severity: Minor
Found in lib/i18n/tasks/missing_keys.rb - About 1 hr to fix

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 collapse_same_key_in_locales! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def collapse_same_key_in_locales!(forest)
      locales_and_node_by_key = {}
      to_remove               = []
      forest.each do |root|
        locale = root.key
Severity: Minor
Found in lib/i18n/tasks/missing_keys.rb - About 1 hr to fix

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 plural_keys_for_locale has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def plural_keys_for_locale(locale)
      configuration = load_rails_i18n_pluralization!(locale)
      if configuration[locale.to_sym].nil?
        alternate_locale = alternate_locale_from(locale)
        return Set.new if configuration[alternate_locale.to_sym].nil?
Severity: Minor
Found in lib/i18n/tasks/missing_keys.rb - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status