theodi/coopy-ruby

View on GitHub

Showing 53 of 53 total issues

Avoid deeply nested control flow statements.
Open

                    if (tokens.length>=2) 
                        pretty_tokens[0] = mark_spaces(tokens[0],tokens[1])
                        pretty_tokens[1] = mark_spaces(tokens[1],tokens[0])
                    end
Severity: Major
Found in lib/coopy/diff_render.rb - About 45 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

              (0..b.width-1).each do |cb|
                key = vb.to_s(b.get_cell(cb,rb))
                if (mb.has_key?(key)) 
                  mb[key] = -1
                  uniques-=1
    Severity: Minor
    Found in lib/coopy/compare_table.rb and 1 other location - About 45 mins to fix
    lib/coopy/compare_table.rb on lines 182..190

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

              (0..a.width-1).each do |ca| 
                key = va.to_s(a.get_cell(ca,ra))
                if (ma.has_key?(key)) 
                  ma[key] = -1
                  uniques-=1
    Severity: Minor
    Found in lib/coopy/compare_table.rb and 1 other location - About 45 mins to fix
    lib/coopy/compare_table.rb on lines 197..205

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            (0..h-1).each do |y|
              (0..w-1).each do |x|
                txt = view.to_s(t2.get_cell(x,y))
                next if (txt.nil?)
                while (txt.index(sep)) 
    Severity: Minor
    Found in lib/coopy/table_diff.rb and 1 other location - About 35 mins to fix
    lib/coopy/table_diff.rb on lines 14..19

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          (0..h-1).each do |y|
            (0..w-1).each do |x|
              txt = view.to_s(t.get_cell(x,y))
              next if (txt.nil?)
              while (txt.index(sep)) 
    Severity: Minor
    Found in lib/coopy/table_diff.rb and 1 other location - About 35 mins to fix
    lib/coopy/table_diff.rb on lines 26..31

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method report_unit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def report_unit(unit)  
          txt  = unit.to_s
          reordered = false
          if (unit.l>=0) 
            if (unit.l<@l_prev) 
    Severity: Minor
    Found in lib/coopy/table_diff.rb - About 35 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

    Method index_table has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def index_table(t)
          @indexed_table = t
          (0...t.height).each do |i|
            key = ""
            if @keys.length > i
    Severity: Minor
    Found in lib/coopy/index.rb - About 35 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

    Method to_key has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_key(table, i)
          wide = ""
          @v = table.get_cell_view if @v.nil?
          @cols.each_with_index do |col, k|
            d = table.get_cell(col,i)
    Severity: Minor
    Found in lib/coopy/index.rb - About 35 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

    Avoid too many return statements within this method.
    Open

          return true
    Severity: Major
    Found in lib/coopy/compare_table.rb - About 30 mins to fix

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

          def insert_or_delete_columns(fate, wfate)
            data2 = {}
            (0..fate.length-1).each do |i|
              j = fate[i]
              if (j!=-1)
      Severity: Minor
      Found in lib/coopy/simple_table.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                (0..hb-1).each do |j| 
                  key = av.to_s(b.get_cell(cb,j))
                  if (!mem2.has_key?(key)) 
                    mem2[key] = 1
                    ct+=1
      Severity: Minor
      Found in lib/coopy/compare_table.rb and 1 other location - About 25 mins to fix
      lib/coopy/compare_table.rb on lines 71..76

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 30.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          def to_key_by_content(row)
            wide = ""
            @cols.each_with_index do |col, k|
              txt = row.get_row_string(col)
              next if (txt.nil? || txt=="" || txt=="null" || txt=="undefined")
      Severity: Minor
      Found in lib/coopy/index.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                (0..ha-1).each do |j| 
                  key = av.to_s(a.get_cell(ca,j))
                  if (!mem.has_key?(key)) 
                    mem[key] = 1
                    ct+=1
      Severity: Minor
      Found in lib/coopy/compare_table.rb and 1 other location - About 25 mins to fix
      lib/coopy/compare_table.rb on lines 78..83

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 30.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language