openxml/openxml-xlsx

View on GitHub

Showing 8 of 8 total issues

Method to_xml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        def to_xml(xml)
          xml.font do
            xml.sz val: size
            xml.name val: name
            if styles
Severity: Minor
Found in lib/openxml/xlsx/elements/font.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 to_xml has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def to_xml
          build_standalone_xml do |xml|
            xml.styleSheet(xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", "xmlns:mc" => "http://schemas.openxmlformats.org/markup-compatibility/2006") do
              xml.numFmts(count: formats.length) do
                formats.each_with_index do |format, index|
Severity: Minor
Found in lib/openxml/xlsx/parts/stylesheet.rb - About 1 hr to fix

    Method to_xml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def to_xml
              build_standalone_xml do |xml|
                xml.worksheet(root_namespaces) do
                  xml.sheetViews do
                    xml.sheetView(showGridLines: 0, tabSelected: 1, workbookViewId: 0)
    Severity: Minor
    Found in lib/openxml/xlsx/parts/worksheet.rb - About 1 hr to fix

      Method to_xml has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def to_xml
                build_standalone_xml do |xml|
                  xml.worksheet(root_namespaces) do
                    xml.sheetViews do
                      xml.sheetView(showGridLines: 0, tabSelected: 1, workbookViewId: 0)
      Severity: Minor
      Found in lib/openxml/xlsx/parts/worksheet.rb - About 55 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_xml has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def to_xml(xml)
                attributes = {"r" => id}
                attributes.merge!("s" => style) if style
                attributes.merge!("t" => "s") if type == :string
      
      
      Severity: Minor
      Found in lib/openxml/xlsx/elements/cell.rb - About 55 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 attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def attributes
                {}.tap do |attrs|
                  attrs[:horizontal] = horizontal if horizontal
                  attrs[:vertical] = vertical if vertical
                  attrs[:indent] = indent if indent
      Severity: Minor
      Found in lib/openxml/xlsx/elements/alignment.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(format_id=0, font_id=0, fill_id=0, border_id=0, alignment=nil)
      Severity: Minor
      Found in lib/openxml/xlsx/elements/style.rb - About 35 mins to fix

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

                def to_xml(xml)
                  attributes = {
                    numFmtId: format_id,
                    fontId: font_id,
                    fillId: fill_id,
        Severity: Minor
        Found in lib/openxml/xlsx/elements/style.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

        Severity
        Category
        Status
        Source
        Language