weshatheleopard/rubyXL

View on GitHub

Showing 63 of 63 total issues

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 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

    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 add_cell has a Cognitive Complexity of 13 (exceeds 5 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

      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 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 32 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        merged_cells.each { |mc|
                          next if mc.ref.row_range.last < row_index
                
                          in_merged_cell = mc.ref.row_range.first <= row_index
                          mc.ref = RubyXL::Reference.new(
                Severity: Major
                Found in lib/rubyXL/convenience_methods/worksheet.rb and 1 other location - About 1 hr to fix
                lib/rubyXL/convenience_methods/worksheet.rb on lines 110..118

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 48.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        merged_cells.each { |mc|
                          next if mc.ref.col_range.last < column_index
                
                          in_merged_cell = mc.ref.row_range.first < column_index
                          mc.ref = RubyXL::Reference.new(
                Severity: Major
                Found in lib/rubyXL/convenience_methods/worksheet.rb and 1 other location - About 1 hr to fix
                lib/rubyXL/convenience_methods/worksheet.rb on lines 225..233

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 48.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        merged_cells.each { |mc|
                          next if mc.ref.row_range.last < row_index
                
                          in_merged_cell = mc.ref.row_range.first < row_index
                          mc.ref = RubyXL::Reference.new(
                Severity: Major
                Found in lib/rubyXL/convenience_methods/worksheet.rb and 1 other location - About 1 hr to fix
                lib/rubyXL/convenience_methods/worksheet.rb on lines 141..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 48.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      merged_cells.each { |mc|
                        next if mc.ref.col_range.last < column_index
                
                        in_merged_cell = mc.ref.col_range.first <= column_index
                        mc.ref = RubyXL::Reference.new(
                Severity: Major
                Found in lib/rubyXL/convenience_methods/worksheet.rb and 1 other location - About 1 hr to fix
                lib/rubyXL/convenience_methods/worksheet.rb on lines 188..196

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 48.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  ST_TextShapeType        = %w{ textNoShape textPlain textStop textTriangle textTriangleInverted textChevron
                                                textChevronInverted textRingInside textRingOutside textArchUp textArchDown
                                                textCircle textButton textArchUpPour textArchDownPour textCirclePour textButtonPour
                                                textCurveUp textCurveDown textCanUp textCanDown textWave1 textWave2 textDoubleWave1
                                                textWave4 textInflate textDeflate textInflateBottom textDeflateBottom textInflateTop
                Severity: Minor
                Found in lib/rubyXL/objects/simple_types.rb and 1 other location - About 50 mins to fix
                lib/rubyXL/objects/simple_types.rb on lines 208..216

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 43.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  ST_TextAutonumberScheme = %w{ alphaLcParenBoth alphaUcParenBoth alphaLcParenR alphaUcParenR
                                                alphaLcPeriod alphaUcPeriod arabicParenBoth arabicParenR arabicPeriod arabicPlain
                                                romanLcParenBoth romanUcParenBoth romanLcParenR romanUcParenR
                                                romanLcPeriod romanUcPeriod circleNumDbPlain circleNumWdBlackPlain
                                                circleNumWdWhitePlain arabicDbPeriod arabicDbPlain ea1ChsPeriod ea1ChsPlain
                Severity: Minor
                Found in lib/rubyXL/objects/simple_types.rb and 1 other location - About 50 mins to fix
                lib/rubyXL/objects/simple_types.rb on lines 144..151

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 43.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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

                Severity
                Category
                Status
                Source
                Language