Showing 61 of 614 total issues

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 to_yaml has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def to_yaml(prefix = {}, from_row = nil, from_column = nil, to_row = nil, to_column = nil, sheet = default_sheet)
    Severity: Minor
    Found in lib/roo/formatters/yaml.rb - About 45 mins to fix

      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 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/base.rb - About 45 mins to fix

        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 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 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 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 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 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 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 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 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 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 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 write_csv_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def write_csv_content(file = nil, sheet = nil, separator = ",")
                        file ||= STDOUT
                        return unless first_row(sheet) # The sheet is empty
                
                        1.upto(last_row(sheet)) do |row|
                Severity: Minor
                Found in lib/roo/formatters/csv.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 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 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