viktorasl/xlocalize

View on GitHub
lib/xlocalize/executor.rb

Summary

Maintainability
C
1 day
Test Coverage

Method purelyze has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def purelyze(locale, targets, excl_prefix, project, filer_ui_duplicates=false, exclude_units)
      locale_file_name = locale_file_name(locale)
      doc = Nokogiri::XML(File.open(locale_file_name))

      puts "Removing all files not matching required targets" if $VERBOSE
Severity: Minor
Found in lib/xlocalize/executor.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 export_master has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def export_master(wti, project, targets, excl_prefix, master_lang, exclude_units=[], no_cryptic)
      master_file_name = locale_file_name(master_lang)

      File.delete(master_file_name) if File.exist?(master_file_name)

Severity: Minor
Found in lib/xlocalize/executor.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 push_master_file has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def push_master_file(wti, master_lang, master_file_name)
      # Pushing master file to WebtranslateIt
      begin
        puts "Uploading master file to WebtranslateIt"
        file = File.open(master_file_name, 'r')
Severity: Minor
Found in lib/xlocalize/executor.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 import_plurals_if_needed has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def import_plurals_if_needed(locale)
      plurals_fname = "#{locale}_plurals.yaml"
      return if !File.exist?(plurals_fname)
      puts "Importing translations from #{plurals_fname}" if $VERBOSE
      plurals_yml = YAML.load_file(plurals_fname)
Severity: Minor
Found in lib/xlocalize/executor.rb - About 1 hr to fix

    Method export_master has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def export_master(wti, project, targets, excl_prefix, master_lang, exclude_units=[], no_cryptic)
          master_file_name = locale_file_name(master_lang)
    
          File.delete(master_file_name) if File.exist?(master_file_name)
    
    
    Severity: Minor
    Found in lib/xlocalize/executor.rb - About 1 hr to fix

      Method localized_filename has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def localized_filename(file_name, locale)
            parts = file_name.split('/')
      
            # WebTranslateIt uses _ for Language_Country separator e.g. pt_PT
            # but Xcode uses - e.g. pt-PT
      Severity: Minor
      Found in lib/xlocalize/executor.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 export_master has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def export_master(wti, project, targets, excl_prefix, master_lang, exclude_units=[], no_cryptic)
      Severity: Major
      Found in lib/xlocalize/executor.rb - About 50 mins to fix

        Method purelyze has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def purelyze(locale, targets, excl_prefix, project, filer_ui_duplicates=false, exclude_units)
        Severity: Minor
        Found in lib/xlocalize/executor.rb - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status