Shoobx/shoobx.rml2odt

View on GitHub

Showing 37 of 48 total issues

Function inputImageIntoCell has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def inputImageIntoCell(self):
        manager = attr.getManager(self)
        paraStyleName = manager.getNextStyleName('ImagePara')
        paraStyle = odf.style.Style(
            family='paragraph',
Severity: Minor
Found in src/shoobx/rml2odt/flowable.py - About 1 hr to fix

    Function _applyAttributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _applyAttributes(self, stylemap, attrs):
            start_col, start_row, end_col, end_row = self._getStartEndPos(attrs)
    
            for col in range(start_col, end_col+1):
                for row in range(start_row, end_row+1):
    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 _doInnerGrid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _doInnerGrid(self, stylemap, attrs):
            start_col, start_row, end_col, end_row = self._getStartEndPos(attrs)
    
            if start_row == end_row and start_col == end_col:
                return
    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 registerParagraphStyle has 26 lines of code (exceeds 25 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 1 hr to fix

      Function _doZebraRows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _doZebraRows(self, stylemap, attrs):
              start_col, start_row, end_col, end_row = self._getStartEndPos(attrs)
              colors = attrs['cellProps']['backgroundcolors']
              for col in range(start_col, end_col+1):
                  idx = 0
      Severity: Minor
      Found in src/shoobx/rml2odt/table.py - 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

      Function getStyleMap has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def getStyleMap(self):
              # prepare a map of styles for each cell in the table
              stylemap = [
                  [_styleCell()
                   for r in range(self.rows)] for c in range(self.columns)]
      Severity: Minor
      Found in src/shoobx/rml2odt/table.py - 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

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

          def process(self):
              # if we have a bulkData tag, let's have first TableBulkData
              # process the data by adding tr and td tags
              # XXX: might be simpler to grasp if this would be done here
              #      and we'd just drop the bulkData child tag
      Severity: Minor
      Found in src/shoobx/rml2odt/table.py - 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

      Avoid deeply nested control flow statements.
      Open

                              if aname.startswith(where):
                                  aname = aname[len(where):]
                                  odtname = self.lineAttributesMapping[aname]
                                  borders[targetAttr][odtname] = avalue
      
      
      Severity: Major
      Found in src/shoobx/rml2odt/table.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if dash[0] in (1, 2):
                                style = 'dotted'
                            elif dash[0] in (3, 4):
                                style = 'fine-dashed'
                            else:
        Severity: Major
        Found in src/shoobx/rml2odt/stylesheet.py - About 45 mins to fix

          Function _doZebraCols has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _doZebraCols(self, stylemap, attrs):
                  start_col, start_row, end_col, end_row = self._getStartEndPos(attrs)
                  colors = attrs['cellProps']['backgroundcolors']
                  idx = 0
                  for col in range(start_col, end_col+1):
          Severity: Minor
          Found in src/shoobx/rml2odt/table.py - 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

          Avoid deeply nested control flow statements.
          Open

                                  if 'bulletFormat' in attrs:
                                      bulletFormat = attrs['bulletFormat']
                                      pre, post = bulletFormat.split('%s')
                                      levelstyle.setAttribute('numprefix', pre)
                                      levelstyle.setAttribute('numsuffix', post)
          Severity: Major
          Found in src/shoobx/rml2odt/list.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if 'start' in attrs:
                                        start = attrs['start']
                                        if isinstance(start, int):
                                            bulletType = None
                                        else:
            Severity: Major
            Found in src/shoobx/rml2odt/list.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if 'bulletType' in attrs:
                                          bulletType = attrs['bulletType']
                                          levelstyle.setAttribute('numformat', bulletType)
              
              
              Severity: Major
              Found in src/shoobx/rml2odt/list.py - About 45 mins to fix

                Function registerListStyle has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def registerListStyle(doc, name, rmlStyle, attributes=None, ulol=None):
                Severity: Minor
                Found in src/shoobx/rml2odt/stylesheet.py - About 35 mins to fix

                  Function _getParaStyle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _getParaStyle(self):
                          # Any childnodes that are paragraphs must have a special style
                          # for indentation purposes.
                          node = top = self
                  
                  
                  Severity: Minor
                  Found in src/shoobx/rml2odt/list.py - 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

                  Function _convertSimpleContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _convertSimpleContent(self):
                          # Check whether we need to create a para element.
                  
                          # Any paragraphs should specifically have the lists paragraph style:
                          para_style = self._getParaStyle()
                  Severity: Minor
                  Found in src/shoobx/rml2odt/list.py - 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

                  Function _doOutline has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _doOutline(self, stylemap, attrs):
                          start_col, start_row, end_col, end_row = self._getStartEndPos(attrs)
                  
                          border = attrs['border']
                  
                  
                  Severity: Minor
                  Found in src/shoobx/rml2odt/table.py - About 25 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