Showing 614 of 614 total issues

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

      def extract_cells(relationships)
        extracted_cells = {}
        empty_cell = @options[:empty_cell]

        doc.xpath('/worksheet/sheetData/row').each.with_index(1) do |row_xml, ycoord|
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

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

    def perform_decryption(
      encryption_data,
      password,
      content_entry,
      roo_content_xml_path
Severity: Minor
Found in lib/roo/open_office.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 children_to_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def children_to_string(children)
      children.map do |child|
        if child.text?
          child.content
        else
Severity: Minor
Found in lib/roo/open_office.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

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

        def initialize(value, formula, excelx_type, style, link, coordinate)
Severity: Minor
Found in lib/roo/excelx/cell/number.rb - About 45 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def initialize(value, formula, style, link, coordinate)
    Severity: Minor
    Found in lib/roo/excelx/cell/boolean.rb - About 35 mins to fix

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

              def initialize(value, formula, style, link, coordinate)
      Severity: Minor
      Found in lib/roo/excelx/cell/string.rb - About 35 mins to fix

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

              def to_matrix(from_row = nil, from_column = nil, to_row = nil, to_column = nil, sheet = default_sheet)
        Severity: Minor
        Found in lib/roo/formatters/matrix.rb - About 35 mins to fix

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

            def file_type_check(filename, exts, name, warning_level, packed = nil)
          Severity: Minor
          Found in lib/roo/base.rb - About 35 mins to fix

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

              def info
                without_changing_default_sheet do
                  result = "File: #{File.basename(@filename)}\n"\
                    "Number of sheets: #{sheets.size}\n"\
                    "Sheets: #{sheets.join(', ')}\n"
            Severity: Minor
            Found in lib/roo/base.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 extract_hyperlinks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def extract_hyperlinks(relationships)
                    return {} unless (hyperlinks = doc.xpath('/worksheet/hyperlinks/hyperlink'))
            
                    hyperlinks.each_with_object({}) do |hyperlink, hash|
                      if relationship = relationships[hyperlink['id']]
            Severity: Minor
            Found in lib/roo/excelx/sheet_doc.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 each_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def each_element(path, elements)
                  elements = Array(elements)
                  Nokogiri::XML::Reader(::File.open(path, 'rb'), nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS).each do |node|
                    next unless node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT && elements.include?(node.name)
                    yield Nokogiri::XML(node.outer_xml).root if block_given?
            Severity: Minor
            Found in lib/roo/utils.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 extract_coordinate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def extract_coordinate(s)
                  num = letter_num = 0
                  num_only = false
            
                  s.each_byte do |b|
            Severity: Minor
            Found in lib/roo/utils.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def initialize(value, formula, excelx_type, style, link, coordinate)
                      @cell_value = value
                      @cell_type = excelx_type if excelx_type
                      @formula = formula if formula
                      @style = style unless style == 1
            Severity: Minor
            Found in lib/roo/excelx/cell/base.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 process_zipfile_packed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def process_zipfile_packed(zip, tmpdir, path = "")
                if zip.file.file? path
                  # extract and return filename
                  File.open(File.join(tmpdir, path), "wb") do |file|
                    file.write(zip.read(path))
            Severity: Minor
            Found in lib/roo/base.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 to_matrix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def to_matrix(from_row = nil, from_column = nil, to_row = nil, to_column = nil, sheet = default_sheet)
                    require 'matrix'
            
                    return ::Matrix.empty unless first_row
            
            
            Severity: Minor
            Found in lib/roo/formatters/matrix.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 collect_last_row_col_for_sheet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def collect_last_row_col_for_sheet(sheet)
                first_row = first_column = MAX_ROW_COL
                last_row = last_column = MIN_ROW_COL
                @cell[sheet].each_pair do |key, value|
                  next unless value
            Severity: Minor
            Found in lib/roo/base.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 create_numeric has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def create_numeric(number)
                      return number if Excelx::ERROR_VALUES.include?(number)
                      case @format
                      when /%/
                        Float(number)
            Severity: Minor
            Found in lib/roo/excelx/cell/number.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 number_format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def number_format(formatter, negative_formatter = nil)
                      proc do |number|
                        if negative_formatter
                          formatter = number.to_i > 0 ? formatter : negative_formatter
                          number = number.to_f.abs
            Severity: Minor
            Found in lib/roo/excelx/cell/number.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