ickc/pantable

View on GitHub

Showing 37 of 37 total issues

Avoid deeply nested control flow statements.
Open

                        if i.strip():
                            return table_list
        raise EmptyTableError
Severity: Major
Found in src/pantable/io.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if cell_n_new > 1:
                                temp[j + 1].append((width_int_resid, cell_n_new))
                            else:
                                temp[j + 1].append(width_int_resid)
    
    
    Severity: Major
    Found in src/pantable/ast.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if founds:
                                  found = founds[0]
                                  has_ica = True
                                  ica_temp = found[1]
                                  ica = f'[]{ica_temp}' if ica_temp else ''
      Severity: Major
      Found in src/pantable/ast.py - About 45 mins to fix

        Function table_to_codeblock has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def table_to_codeblock(
        Severity: Minor
        Found in src/pantable/table_to_codeblock.py - About 45 mins to fix

          Function put has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def put(
          Severity: Minor
          Found in src/pantable/ast.py - About 45 mins to fix

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

                def from_panflute_ast(cls, table: Table) -> PanTable:
                    ica_table = Ica(
                        table.identifier,
                        table.classes,
                        table.attributes,
            Severity: Minor
            Found in src/pantable/ast.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 ica_row:
                                        icas_row[i] = f'[]{ica_row}'
                                else:
            Severity: Major
            Found in src/pantable/ast.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if body_list and 'body' not in last_body:
                                          last_body['body'] = temp
                                      else:
                                          body_list.append({'body': temp})
                                  # is_body_head
              Severity: Major
              Found in src/pantable/ast.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if marker:
                                            temp_markers.append(marker)
                                            temp_icas.append(found[0])
                                            temp_idxs.append(i)
                                        # * ignore the case that somone might put 2 attrs side-by-side
                Severity: Major
                Found in src/pantable/ast.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if ica_:
                                              ica = ica_
                                      else:
                  Severity: Major
                  Found in src/pantable/ast.py - About 45 mins to fix

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

                    def convert_texts(
                    Severity: Minor
                    Found in src/pantable/util.py - About 35 mins to fix

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

                          def to_spec(self, size: int) -> Spec:
                              '''to Spec
                      
                              assume normalized self.
                              '''
                      Severity: Minor
                      Found in src/pantable/ast.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 to_pantable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def to_pantable(self) -> PanTable:
                              '''return a PanTable representation of self
                              '''
                              cells = self.cells
                              contents = cells.contents
                      Severity: Minor
                      Found in src/pantable/ast.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 to_panflute_ast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def to_panflute_ast(self) -> CodeBlock:
                              '''return a panflute AST representation
                      
                              TODO: handle differently if include exists and writable
                              need to be able to configure pantable2csv on write location
                      Severity: Minor
                      Found in src/pantable/ast.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

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

                      def get_yaml_dumper():
                          try:
                              from yamlloader.ordereddict.dumpers import CSafeDumper as Dumper
                          except ImportError:
                              try:
                      Severity: Minor
                      Found in src/pantable/util.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

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

                          def cannonical(self) -> TableArray:
                              '''return a cell array where spanned cells appeared in cannonical location only
                      
                              top-left corner of the grid is the cannonical location of a spanned cell
                              '''
                      Severity: Minor
                      Found in src/pantable/ast.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

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

                          def panflute_tablecells(self) -> np.ndarray[TableCell]:
                              cells = self.cells
                              contents = cells.contents
                              shape = contents.shape
                              m, n = shape
                      Severity: Minor
                      Found in src/pantable/ast.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