Shoobx/shoobx.rml2odt

View on GitHub

Showing 37 of 48 total issues

File flowable.py has 609 lines of code (exceeds 250 allowed). Consider refactoring.
Open

##############################################################################
#
# Copyright (c) 2017 Shoobx, Inc.
# All Rights Reserved.
#
Severity: Major
Found in src/shoobx/rml2odt/flowable.py - About 1 day to fix

    Function process has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(self):
            # Keeps track of the root list (in the case of nested lists)
            # Keeps track of the level of each list
            if (isinstance(self.parent, ListItem) and
                    isinstance(self.parent.parent, type(self))):
    Severity: Minor
    Found in src/shoobx/rml2odt/list.py - About 1 day 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 stylesheet.py has 536 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    ##############################################################################
    #
    # Copyright (c) 2017 Shoobx, Inc.
    # All Rights Reserved.
    #
    Severity: Major
    Found in src/shoobx/rml2odt/stylesheet.py - About 1 day to fix

      File table.py has 403 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ##############################################################################
      #
      # Copyright (c) 2017 Shoobx, Inc.
      # All Rights Reserved.
      #
      Severity: Minor
      Found in src/shoobx/rml2odt/table.py - About 5 hrs to fix

        Function registerListStyle has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        def registerListStyle(doc, name, rmlStyle, attributes=None, ulol=None):
            """Registers an rmlStyle as ODF styles
        
            rmlStyles have information both for ordered and unordered lists,
            ODF styles do not, so we need to register two different, but similar lists.
        Severity: Minor
        Found in src/shoobx/rml2odt/stylesheet.py - 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

        Function process has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self):
                col = len(self.parent.row.childNodes)
                row = self.parent.parent.rowCount - 1
        
                styleMap = self.parent.parent.styleMap
        Severity: Minor
        Found in src/shoobx/rml2odt/table.py - 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

        Function process has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self):
                # determine style attributes to be used in PageTemplate
                args = dict(self.getAttributeValues(attrMapping=self.attrMapping))
                allowed = self.attrMapping.values()
                styleArgs = {}
        Severity: Minor
        Found in src/shoobx/rml2odt/template.py - 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

        Function registerParagraphStyle has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        def registerParagraphStyle(doc, name, rmlStyle):
            if 'style.' in name:
                name = name[6:]
        
            odtStyle = odf.style.Style(name=name, family='paragraph')
        Severity: Minor
        Found in src/shoobx/rml2odt/stylesheet.py - 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

        Function convertLineStyle has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        def convertLineStyle(attrs):
            # ODT line styles discovered by trying:
            # solid, dotted, dashed, fine-dashed, dash-dot, dash-dot-dot,
            # double, double-thin
            # there are plenty left
        Severity: Minor
        Found in src/shoobx/rml2odt/stylesheet.py - 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

        Function process has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self):
                # Make a list instead of a table
                style = self.parent.parent.getRootStyle()
                numlevels = style.getElementsByType(odf.text.ListLevelStyleNumber)
                bulletlevels = style.getElementsByType(odf.text.ListLevelStyleBullet)
        Severity: Minor
        Found in src/shoobx/rml2odt/list.py - 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

        Function getSpanMap has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def getSpanMap(self):
                # prepare a map of spanned cells
                # ODF expects `numbercolumnsspanned` or `numberrowsspanned` on
                # the cell that spans more columns/rows
                # ODF also expects `table:covered-table-cell`
        Severity: Minor
        Found in src/shoobx/rml2odt/table.py - 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

        Function _addSpaceHolders has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def _addSpaceHolders(self, text):
                # ODF also squashes plain spaces, because it's XML
                # need to add text:S tags to keep more than 1 space intact
                # this is required for pre and xpre tags
                span = odf.text.Span()
        Severity: Minor
        Found in src/shoobx/rml2odt/flowable.py - 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

        File list.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        ##############################################################################
        #
        # Copyright (c) 2017 Shoobx, Inc.
        # All Rights Reserved.
        #
        Severity: Minor
        Found in src/shoobx/rml2odt/list.py - About 2 hrs to fix

          Function addSpan has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def addSpan(self, text=None, styleName=None):
                  if text is not None:
                      if self.cleanText:
                          text = self._cleanText(text)
                          span = odf.text.Span(text=text)
          Severity: Minor
          Found in src/shoobx/rml2odt/flowable.py - 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

          Function processSubDirectives has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def processSubDirectives(self, select=None, ignore=None):
                  # Go through all children of the directive and try to process them.
                  for element in self.element.getchildren():
                      tag = element.tag
                      # IN CONTRAST to z3c.rml
          Severity: Minor
          Found in src/shoobx/rml2odt/directive.py - 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

          Function addColumns has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def addColumns(self):
                  attribs = dict(self.getAttributeValues())
                  colWidths = attribs.get('colWidths', [])
          
                  manager = attr.getManager(self)
          Severity: Minor
          Found in src/shoobx/rml2odt/table.py - 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

          Function getRootStyle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def getRootStyle(self):
                  parent = self
                  root = self
                  while True:
                      parent = parent.parent
          Severity: Minor
          Found in src/shoobx/rml2odt/list.py - 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

          Function adjustAttributeValues has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def adjustAttributeValues(self, style, parentName):
                  try:
                      parentElem = self.parent.parent.document.getStyleByName(
                          str(parentName))
                  except AssertionError:
          Severity: Minor
          Found in src/shoobx/rml2odt/stylesheet.py - 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

          Function process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def process(self):
                  self._convertSimpleContent()
          
                  parent_style = self.parent.getRootStyle()
                  fancy_numbering = getattr(parent_style, 'fancy_numbering', False)
          Severity: Minor
          Found in src/shoobx/rml2odt/list.py - 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

          Function _executeCommand has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def _executeCommand(self, stylemap, tagname, styleCommand):
                  attrs = styleCommand.getStyleProps()
          
                  try:
                      # let's first see tags which need special handling
          Severity: Minor
          Found in src/shoobx/rml2odt/table.py - 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