weshatheleopard/rubyXL

View on GitHub

Showing 49 of 63 total issues

File theme.rb has 1463 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rubyXL/objects/ooxml_object'
require 'rubyXL/objects/extensions'

module RubyXL
  # http://www.datypic.com/sc/ooxml/e-a_ext-1.html
Severity: Major
Found in lib/rubyXL/objects/theme.rb - About 3 days to fix

    Method default has 317 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.default
          default_theme = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
    <a:themeElements>
    <a:clrScheme name="Office">
    Severity: Major
    Found in lib/rubyXL/objects/theme.rb - About 1 day to fix

      File worksheet.rb has 622 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rubyXL/objects/ooxml_object'
      require 'rubyXL/objects/simple_types'
      require 'rubyXL/objects/extensions'
      require 'rubyXL/objects/relationships'
      require 'rubyXL/objects/sheet_common'
      Severity: Major
      Found in lib/rubyXL/objects/worksheet.rb - About 1 day to fix

        File worksheet.rb has 543 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module RubyXL
          module WorksheetConvenienceMethods
            NAME = 0
            SIZE = 1
            COLOR = 2
        Severity: Major
        Found in lib/rubyXL/convenience_methods/worksheet.rb - About 1 day to fix

          File workbook.rb has 444 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'date'
          require 'rubyXL/objects/ooxml_object'
          require 'rubyXL/objects/shared_strings'
          require 'rubyXL/objects/stylesheet'
          require 'rubyXL/objects/theme'
          Severity: Minor
          Found in lib/rubyXL/objects/workbook.rb - About 6 hrs to fix

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

                def parse(node, known_namespaces = nil)
                  case node
                  when String, IO, Zip::InputStream then node = Nokogiri::XML.parse(node)
                  end
            
            
            Severity: Minor
            Found in lib/rubyXL/objects/ooxml_object.rb - About 5 hrs 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_xml has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                def write_xml(xml = nil, node_name_override = nil)
                  if xml.nil? then
                    seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
                    seed_xml.encoding = 'UTF-8'
            
            
            Severity: Minor
            Found in lib/rubyXL/objects/ooxml_object.rb - About 5 hrs 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 28 (exceeds 5 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 4 hrs 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 a Cognitive Complexity of 26 (exceeds 5 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 3 hrs 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

            Class Workbook has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Workbook < OOXMLTopLevelObject
                CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'.freeze
                CONTENT_TYPE_TEMPLATE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml'.freeze
                CONTENT_TYPE_TEMPLATE_WITH_MACROS = 'application/vnd.ms-excel.template.macroEnabled.main+xml'.freeze
                CONTENT_TYPE_WITH_MACROS = 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'.freeze
            Severity: Minor
            Found in lib/rubyXL/objects/workbook.rb - About 3 hrs to fix

              Method before_write_xml has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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

              File ooxml_object.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'nokogiri'
              require 'pathname'
              require 'rubyXL/objects/reference'
              
              module RubyXL
              Severity: Minor
              Found in lib/rubyXL/objects/ooxml_object.rb - About 2 hrs to fix

                Method load_related_files has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def load_related_files(zipdir_path, base_file_name)
                      self.related_files = {}
                
                      @@debug_indent += 2 if @@debug_indent
                
                
                Severity: Minor
                Found in lib/rubyXL/objects/relationships.rb - About 2 hrs 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 parse has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def parse(node, known_namespaces = nil)
                      case node
                      when String, IO, Zip::InputStream then node = Nokogiri::XML.parse(node)
                      end
                
                
                Severity: Minor
                Found in lib/rubyXL/objects/ooxml_object.rb - About 2 hrs to fix

                  Method delete_column has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def delete_column(column_index = 0)
                        validate_workbook
                        validate_nonnegative(column_index)
                  
                        # Delete column
                  Severity: Minor
                  Found in lib/rubyXL/convenience_methods/worksheet.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 delete_cell has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def delete_cell(row_index = 0, column_index=0, shift=nil)
                        validate_workbook
                        validate_nonnegative(row_index)
                        validate_nonnegative(column_index)
                  
                  
                  Severity: Minor
                  Found in lib/rubyXL/convenience_methods/worksheet.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_column has a Cognitive Complexity of 15 (exceeds 5 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

                  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_xml has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def write_xml(xml = nil, node_name_override = nil)
                        if xml.nil? then
                          seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
                          seed_xml.encoding = 'UTF-8'
                  
                  
                  Severity: Minor
                  Found in lib/rubyXL/objects/ooxml_object.rb - About 1 hr to fix

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

                        def delete_row(row_index=0)
                          validate_workbook
                          validate_nonnegative(row_index)
                    
                          deleted = sheet_data.rows.delete_at(row_index)
                    Severity: Minor
                    Found in lib/rubyXL/convenience_methods/worksheet.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

                    Severity
                    Category
                    Status
                    Source
                    Language