theodi/coopy-ruby

View on GitHub

Showing 45 of 53 total issues

Method trim_blank has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def trim_blank
      return true if (h==0)
      h_test = @height
      h_test = 3 if (h_test>=3)
      view = get_cell_view
Severity: Minor
Found in lib/coopy/simple_table.rb - About 1 hr to fix

    Method move_units has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.move_units(units)
          isrc = []
          idest = []
          len = units.length
          ltop = -1.0
    Severity: Minor
    Found in lib/coopy/mover.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 spread_context has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def spread_context(units, del, active) 
          if (del>0 && active != nil) 
            # forward
            mark = -del-1
            skips = 0
    Severity: Minor
    Found in lib/coopy/table_diff.rb - About 1 hr to fix

      Method move_without_extras has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.move_without_extras(src, dest)
            return nil if (src.length!=dest.length) 
            return [] if (src.length<=1)
            
            len = src.length
      Severity: Minor
      Found in lib/coopy/mover.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 render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def render(rows) 
              return if (rows.width==0||rows.height==0)
              render = self
              render.begin_table()
              change_row = -1
      Severity: Minor
      Found in lib/coopy/diff_render.rb - About 1 hr to fix

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

            def self.mark_spaces(sl, sr) 
                return sl if (sl==sr)
                return sl if (sl.nil? || sr.nil?)
                slc = sl.gsub(" ","")
                src = sr.gsub(" ","")
        Severity: Minor
        Found in lib/coopy/diff_render.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 get_separator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def get_separator(t, t2, root)
              sep = root
              w = t.width
              h = t.height
              view = t.get_cell_view
        Severity: Minor
        Found in lib/coopy/table_diff.rb - About 1 hr to fix

          Method mark_spaces has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.mark_spaces(sl, sr) 
                  return sl if (sl==sr)
                  return sl if (sl.nil? || sr.nil?)
                  slc = sl.gsub(" ","")
                  src = sr.gsub(" ","")
          Severity: Minor
          Found in lib/coopy/diff_render.rb - About 1 hr to fix

            Method move_units has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.move_units(units)
                  isrc = []
                  idest = []
                  len = units.length
                  ltop = -1.0
            Severity: Minor
            Found in lib/coopy/mover.rb - About 1 hr to fix

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

                  def self.examine_cell(x, y, value, vcol, vrow, vcorner, cell)  
              Severity: Major
              Found in lib/coopy/diff_render.rb - About 50 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    offset = cell.conflicted ? 1 : 0
                Severity: Major
                Found in lib/coopy/diff_render.rb - About 45 mins to fix

                  Method has_same_columns_2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def has_same_columns_2(a, b)
                        if (a.width!=b.width) 
                          return false
                        end
                        if (a.height==0 || b.height==0) 
                  Severity: Minor
                  Found in lib/coopy/compare_table.rb - About 45 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_order has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def to_order
                        if @order_cache
                          if @reference
                            if !@order_cache_has_reference
                              @order_cache = nil
                  Severity: Minor
                  Found in lib/coopy/alignment.rb - About 45 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 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

                    Avoid deeply nested control flow statements.
                    Open

                                        if (part!=full) 
                                            if (cell.value.index(full)) 
                                                div = full
                                                cat = "conflict"
                                                cell.conflicted = true
                    Severity: Major
                    Found in lib/coopy/diff_render.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          cell.pvalue = tokens[0] if (cell.conflicted)
                      Severity: Major
                      Found in lib/coopy/diff_render.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

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

                          Avoid deeply nested control flow statements.
                          Open

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

                            Avoid deeply nested control flow statements.
                            Open

                                                if (@flags.allow_update) 
                                                  have_addition = true
                                                end
                            Severity: Major
                            Found in lib/coopy/table_diff.rb - About 45 mins to fix

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language