weshatheleopard/rubyXL

View on GitHub

Showing 61 of 61 total issues

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

    def attach_relationship(rid, rf)
      relationships = self.class.class_variable_get(:@@ooxml_relationships)
      klass = rf.class
      if relationships.has_key?(klass) then
        accessor = relationships[klass]
Severity: Minor
Found in lib/rubyXL/objects/relationships.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 validate_workbook has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_workbook
      unless workbook.nil? || workbook.worksheets.nil?
        workbook.worksheets.each { |sheet|
          unless sheet.nil? || sheet.sheet_data.nil? || sheet.sheet_data[row].nil?
            if sheet.sheet_data[row][column] == self
Severity: Minor
Found in lib/rubyXL/cell.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_hls has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def to_hls
        hls_color = HlsColor.new

        # Note that we are overriding accessors with local vars here:
        r = self.r / 255.0
Severity: Minor
Found in lib/rubyXL/convenience_methods/color.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 insert_cell has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def insert_cell(row = 0, col = 0, data = nil, formula = nil, shift = nil)
Severity: Minor
Found in lib/rubyXL/convenience_methods/worksheet.rb - About 35 mins to fix

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

        def change_column_font(column_index, change_type, arg, font, xf)
    Severity: Minor
    Found in lib/rubyXL/convenience_methods/worksheet.rb - About 35 mins to fix

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

          def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
      Severity: Minor
      Found in lib/rubyXL/worksheet.rb - About 35 mins to fix

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

            def self.parse(param)
              sheet_obj = super
              sheet_obj.sheet_data.rows.each { |r|
                next if r.nil?
                r.worksheet = sheet_obj
        Severity: Minor
        Found in lib/rubyXL/objects/worksheet.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 change_column_alignment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def change_column_alignment(column_index, &block)
              validate_workbook
              ensure_cell_exists(0, column_index)
        
              cols.get_range(column_index).style_index = @workbook.modify_alignment(get_col_style(column_index), &block)
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/worksheet.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 change_column_fill has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def change_column_fill(column_index, color_code = 'ffffff')
              validate_workbook
              RubyXL::Color.validate_color(color_code)
              ensure_cell_exists(0, column_index)
        
        
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/worksheet.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

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

            def get_range(col_index)
              col_num = col_index + 1
        
              old_range = self.locate_range(col_index)
        
        
        Severity: Minor
        Found in lib/rubyXL/objects/column_range.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

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

            def change_column_border(column_index, direction, weight)
              validate_workbook
              ensure_cell_exists(0, column_index)
        
              cols.get_range(column_index).style_index = @workbook.modify_border(get_col_style(column_index), direction, weight)
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/worksheet.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

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

            def insert_cell(row = 0, col = 0, data = nil, formula = nil, shift = nil)
              validate_workbook
              ensure_cell_exists(row, col)
        
              case shift
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/worksheet.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

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

              def set_color(t1, t2, t3)
                color = 0
        
                t3 += 1.0 if (t3 < 0)
                t3 -= 1.0 if (t3 > 1)
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/color.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

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

            def before_write_xml
              max_sheet_id = worksheets.collect(&:sheet_id).compact.max || 0
        
              self.sheets = RubyXL::Sheets.new
        
        
        Severity: Minor
        Found in lib/rubyXL/objects/workbook.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

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

            def get_rgb(workbook)
              if rgb then
                return rgb
              elsif theme then
                theme_color = workbook.theme.get_theme_color(theme)
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/color.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

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

            def self.get_class_by_rel_type(rel_type)
              unless defined?(@@rel_hash)
                @@rel_hash = {}
                RubyXL.constants.each { |c|
                  klass = RubyXL.const_get(c)
        Severity: Minor
        Found in lib/rubyXL/objects/relationships.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

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

            def change_contents(data, formula_expression = nil)
              validate_worksheet
        
              if formula_expression then
                self.datatype = nil
        Severity: Minor
        Found in lib/rubyXL/convenience_methods/cell.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

          class CT_Path2DArcTo < OOXMLObject
            define_attribute(:wR,    :int, :required => true)
            define_attribute(:hR,    :int, :required => true)
            define_attribute(:stAng, :int, :required => true)
            define_attribute(:swAng, :int, :required => true)
        Severity: Minor
        Found in lib/rubyXL/objects/theme.rb and 1 other location - About 20 mins to fix
        lib/rubyXL/objects/theme.rb on lines 911..916

        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 28.

        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

          class ShapeTextRectangle < OOXMLObject
            define_attribute(:l, :int, :required => true)
            define_attribute(:t, :int, :required => true)
            define_attribute(:r, :int, :required => true)
            define_attribute(:b, :int, :required => true)
        Severity: Minor
        Found in lib/rubyXL/objects/theme.rb and 1 other location - About 20 mins to fix
        lib/rubyXL/objects/theme.rb on lines 976..981

        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 28.

        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

          class CT_XYAdjustHandle < OOXMLObject
            define_child_node(RubyXL::CT_AdjPoint2D)
            define_attribute(:gdRefX, :string)
            define_attribute(:minX,   :int)
            define_attribute(:maxX,   :int)
        Severity: Minor
        Found in lib/rubyXL/objects/theme.rb and 1 other location - About 15 mins to fix
        lib/rubyXL/objects/theme.rb on lines 939..947

        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 25.

        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