Showing 61 of 614 total issues

Method generate_formatter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def generate_formatter(format)
          # FIXME: numbers can be other colors besides red:
          # [BLACK], [BLUE], [CYAN], [GREEN], [MAGENTA], [RED], [WHITE], [YELLOW], [COLOR n]
          case format
          when /^General$/i then '%.0f'
Severity: Minor
Found in lib/roo/excelx/cell/number.rb - About 1 hr to fix

    Method extract_html_r has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def extract_html_r(r_elem)
            str = +""
            xml_elems = {
              sub: false,
              sup: false,
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb - About 1 hr to fix

      Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(filename_or_stream, options = {})
            packed = options[:packed]
            file_warning = options.fetch(:file_warning, :error)
            cell_max = options.delete(:cell_max)
            sheet_options = {}
      Severity: Minor
      Found in lib/roo/excelx.rb - About 1 hr to fix

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

              def extract_html_r(r_elem)
                str = +""
                xml_elems = {
                  sub: false,
                  sup: false,
        Severity: Minor
        Found in lib/roo/excelx/shared_strings.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 create_cell_from_value has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def create_cell_from_value(value_type, cell, formula, format, style, hyperlink, coordinate)
                # NOTE: format.to_s can replace excelx_type as an argument for
                #       Cell::Time, Cell::DateTime, Cell::Date or Cell::Number, but
                #       it will break some brittle tests.
                excelx_type = [:numeric_or_formula, format.to_s]
        Severity: Minor
        Found in lib/roo/excelx/sheet_doc.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 _to_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def _to_type(format)
                format = format.to_s.downcase
                if (type = EXCEPTIONAL_FORMATS[format])
                  type
                elsif format.include?('#')
        Severity: Minor
        Found in lib/roo/excelx/format.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 decrypt has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def decrypt(content_entry, cipher)
              # Zip::Entry.extract writes a 0-length file when trying
              # to extract an encrypted stream, so we read the
              # raw bytes based on the offset and lengths
              decrypted = ''
        Severity: Minor
        Found in lib/roo/open_office.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 set_cell_values has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def set_cell_values(sheet, x, y, i, v, value_type, formula, table_cell, str_v, style_name)
        Severity: Major
        Found in lib/roo/open_office.rb - About 1 hr to fix

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

                def initialize(value, type, formula, excelx_type, excelx_value, style, hyperlink, base_date, coordinate)
          Severity: Major
          Found in lib/roo/excelx/cell.rb - About 1 hr to fix

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

                  def extract_shared_strings
                    return [] unless doc_exists?
            
                    document = fix_invalid_shared_strings(doc)
                    # read the shared strings xml document
            Severity: Minor
            Found in lib/roo/excelx/shared_strings.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 process_zipfile_entries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def process_zipfile_entries(entries)
                  # NOTE: When Google or Numbers 3.1 exports to xlsx, the worksheet filenames
                  #       are not in order. With Numbers 3.1, the first sheet is always
                  #       sheet.xml, not sheet1.xml. With Google, the order of the worksheets is
                  #       independent of a worksheet's filename (i.e. sheet6.xml can be the
            Severity: Minor
            Found in lib/roo/excelx.rb - About 1 hr to fix

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

                  def initialize(filename, options = {})
                    packed       = options[:packed]
                    file_warning = options[:file_warning] || :error
              
                    @only_visible_sheets = options[:only_visible_sheets]
              Severity: Minor
              Found in lib/roo/open_office.rb - About 55 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 read_table_styles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def read_table_styles(styles)
                    styles.children.each do |style|
                      next unless style.name == 'style'
                      style_name = attribute(style, 'name')
                      style.children.each do |properties|
              Severity: Minor
              Found in lib/roo/open_office.rb - About 55 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 decrypt_if_necessary has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def decrypt_if_necessary(
                    zip_file,
                    content_entry,
                    roo_content_xml_path, options
                  )
              Severity: Minor
              Found in lib/roo/open_office.rb - About 55 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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def initialize(value, formula, excelx_type, style, link, base_date, coordinate)
              Severity: Major
              Found in lib/roo/excelx/cell/time.rb - About 50 mins to fix

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

                      def create_cell_from_value(value_type, cell, formula, format, style, hyperlink, coordinate)
                Severity: Major
                Found in lib/roo/excelx/sheet_doc.rb - About 50 mins to fix

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

                          def initialize(value, formula, excelx_type, style, link, base_date, coordinate)
                  Severity: Major
                  Found in lib/roo/excelx/cell/date.rb - About 50 mins to fix

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

                            def initialize(value, formula, excelx_type, style, link, base_timestamp, coordinate)
                    Severity: Major
                    Found in lib/roo/excelx/cell/datetime.rb - About 50 mins to fix

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

                            def each_row(options = {}, &block)
                              row_count = 0
                              options[:offset] ||= 0
                              @sheet.each_row_streaming do |row|
                                break if options[:max_rows] && row_count == options[:max_rows] + options[:offset] + 1
                      Severity: Minor
                      Found in lib/roo/excelx/sheet.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 cell_from_xml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def cell_from_xml(cell_xml, hyperlink, coordinate, empty_cell=true)
                              coordinate ||= ::Roo::Utils.extract_coordinate(cell_xml["r"])
                              cell_xml_children = cell_xml.children
                              return create_empty_cell(coordinate, empty_cell) if cell_xml_children.empty?
                      
                      
                      Severity: Minor
                      Found in lib/roo/excelx/sheet_doc.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

                      Severity
                      Category
                      Status
                      Source
                      Language