weshatheleopard/rubyXL

View on GitHub

Showing 47 of 61 total issues

Method stream has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def stream
      stream = Zip::OutputStream.write_buffer { |zipstream|
        self.rels_hash = {}
        self.relationship_container.owner = self
        collect_related_objects.compact.each { |obj|
Severity: Minor
Found in lib/rubyXL/objects/root.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 insert_row has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def insert_row(row_index = 0)
      validate_workbook
      ensure_cell_exists(row_index)

      old_row = new_cells = nil
Severity: Minor
Found in lib/rubyXL/convenience_methods/worksheet.rb - About 1 hr to fix

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

        def initialize(*params)
          row_from = row_to = col_from = col_to = nil
    
          case params.size
          when 4 then row_from, row_to, col_from, col_to = params
    Severity: Minor
    Found in lib/rubyXL/objects/reference.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 add_cell has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
          validate_workbook
          validate_nonnegative(row_index)
          validate_nonnegative(column_index)
          row = sheet_data.rows[row_index] || add_row(row_index)
    Severity: Minor
    Found in lib/rubyXL/worksheet.rb - About 1 hr to fix

      Method before_write_xml has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def before_write_xml # This method may need to be moved higher in the hierarchy
            first_nonempty_row = nil
            last_nonempty_row = 0
            first_nonempty_column = nil
            last_nonempty_column = 0
      Severity: Minor
      Found in lib/rubyXL/objects/worksheet.rb - About 1 hr to fix

        Method initialize has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(worksheets = [], src_file_path = nil, creator = nil, modifier = nil, created_at = nil,
                           company = '', application = APPLICATION, appversion = APPVERSION, date1904 = 0,
                           is_template = false)
        Severity: Major
        Found in lib/rubyXL/objects/workbook.rb - About 1 hr to fix

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

              def value(args = {})
                r = self.raw_value
          
                case datatype
                when RubyXL::DataType::SHARED_STRING then workbook.shared_strings_container[r.to_i].to_s
          Severity: Minor
          Found in lib/rubyXL/objects/sheet_data.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 before_write_xml has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def before_write_xml
                content_types_by_ext = {}
          
                # Collect all extensions and corresponding content types
                root.rels_hash.each_pair { |klass, objects|
          Severity: Minor
          Found in lib/rubyXL/objects/content_types.rb - About 1 hr to fix

            Method insert_column has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def insert_column(column_index = 0)
                  validate_workbook
                  ensure_cell_exists(0, column_index)
            
                  old_range = cols.get_range(column_index)
            Severity: Minor
            Found in lib/rubyXL/convenience_methods/worksheet.rb - About 1 hr to fix

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

                  def collect_related_objects
                    res = related_objects.compact # Avoid tainting +related_objects+ array
                    res.concat(generic_storage) if generic_storage
              
                    if relationship_container then
              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 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

                    Severity
                    Category
                    Status
                    Source
                    Language