lib/roo/excelx/shared_strings.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                    when 'superscript'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                  when 'u'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Operator => should be surrounded by a single space.
    Open

            invalid = { '_x000D_'  => "\n" }
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks that operators have space around them, except for ** which should not have surrounding space.

    Example:

    # bad
    total = 3*4
    "apple"+"juice"
    my_number = 38/4
    a ** b
    
    # good
    total = 3 * 4
    "apple" + "juice"
    my_number = 38 / 4
    a**b

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                  when 'i'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                when 'r'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                    shared_string << r_elem.content if r_elem.name == 't'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

              html_string = '<html>'.dup
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                when 't'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                  when 'vertAlign'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                    case rPr_elem.xpath('@val').first.value
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

              when 'rPr'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

            document.xpath('/sst/si').map do |si|
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                    when 'subscript'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

    require 'roo/excelx/extractor'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                when 'r'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

              html_string << '</html>'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

            invalid = { '_x000D_'  => "\n" }
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                when 't'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

            doc.xpath('/sst/si').map do |si|
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

                  when 'b'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
    Open

              when 't'
    Severity: Minor
    Found in lib/roo/excelx/shared_strings.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    There are no issues that match your filters.

    Category
    Status