Sage/transdifflation

View on GitHub

Showing 9 of 11 total issues

Method generate_added_diff has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_added_diff(source, target, added_diff_hash, key_trace_passed, from_locale, to_locale, add_NOT_TRANSLATED=true)

      source.each_pair { |source_key, source_value|
        key_trace = key_trace_passed.dup #each pair should have a clear copy of the same array
        key_is_symbol = source_key.instance_of? Symbol
Severity: Minor
Found in lib/transdifflation.rb - About 3 hrs 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 rate_from_branch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def rate_from_branch(hash_from, hash_to, token, words, found)

      hash_from.each_pair{ |key, value|
        if hash_from[key.to_sym].instance_of? Hash
          if hash_to[key.to_sym]
Severity: Minor
Found in lib/transdifflation.rb - About 2 hrs 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 translate_keys_in_same_yaml has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def translate_keys_in_same_yaml(source, target, from_locale, to_locale, add_NOT_TRANSLATED=true)

      source.each_pair { |source_key, source_value|

        key_is_symbol = source_key.instance_of? Symbol
Severity: Minor
Found in lib/transdifflation.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 generate_diff_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_diff_file(yml_source_content, host_target_file, from_locale, to_locale)

      existant_yml = YAMLReader.read_YAML_from_pathfile(host_target_file)
      added_diff_hash, removed_diff_hash = Hash.new, Hash.new

Severity: Minor
Found in lib/transdifflation.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 generate_diff_file has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def generate_diff_file(yml_source_content, host_target_file, from_locale, to_locale)

      existant_yml = YAMLReader.read_YAML_from_pathfile(host_target_file)
      added_diff_hash, removed_diff_hash = Hash.new, Hash.new

Severity: Minor
Found in lib/transdifflation.rb - About 1 hr to fix

    Method generate_added_diff has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def generate_added_diff(source, target, added_diff_hash, key_trace_passed, from_locale, to_locale, add_NOT_TRANSLATED=true)
    Severity: Major
    Found in lib/transdifflation.rb - About 50 mins to fix

      Method rate_from_branch has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def rate_from_branch(hash_from, hash_to, token, words, found)
      Severity: Minor
      Found in lib/transdifflation.rb - About 35 mins to fix

        Method translate_keys_in_same_yaml has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def translate_keys_in_same_yaml(source, target, from_locale, to_locale, add_NOT_TRANSLATED=true)
        Severity: Minor
        Found in lib/transdifflation.rb - About 35 mins to fix

          Method get_transdifflation_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_transdifflation_from_file(tag_name, path_to_yaml_relative_from_rails_root, from_locale=:en, to_locale=:es )
          
                #default values in optional params
                from_locale ||= I18n.default_locale
                to_locale ||= I18n.locale
          Severity: Minor
          Found in lib/transdifflation.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

          Severity
          Category
          Status
          Source
          Language