petspats/pyha

View on GitHub

Showing 108 of 164 total issues

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

def package_files(directory):
    paths = []
    for (path, directories, filenames) in os.walk(directory):
        if 'build' in path.split('/'):
            continue
Severity: Minor
Found in setup.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 get_ram_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_ram_names(self):

        def escape_name(name):
            return escape_reserved_vhdl(name.replace('[', '(').replace(']', ')'))

Severity: Minor
Found in pyha/conversion/top_generator.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 __str__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __str__(self):
        ret = ''
        for i, x in enumerate(self.value):
            # add '.' infront if NameNode
            new = '.{}' if isinstance(x, NameNodeVHDL) and i != 0 else '{}'
Severity: Minor
Found in pyha/conversion/redbaron_transforms.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 transform_multiple_assignment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def transform_multiple_assignment(red_node):
    """ Multi target assigns to single target:
    a, b, c = 1, 2, 3 ->
    a = 1
    b = 2
Severity: Minor
Found in pyha/conversion/redbaron_transforms.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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def main(self, input):
        """
        Args:
            input (DataValid): 36 bits, type not restricted

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 wrap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def wrap(self):
        fmin = self.min_representable()
        fmax = 2 ** self.left  # no need to substract minimal step, 0.9998... -> 1.0 will still be wrapped as max bit pattern
        new_val = (self.val - fmin) % (fmax - fmin) + fmin
        if not self.wrap_is_ok and self.signed:
Severity: Minor
Found in pyha/common/fixed_point.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

Avoid too many return statements within this function.
Open

        return init_vhdl_type(name, PyhaList(current_val.tolist()), PyhaList(initial_val.tolist()), parent)
Severity: Major
Found in pyha/conversion/type_transforms.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return VHDLList(name, list(current_val), list(initial_val), parent)
    Severity: Major
    Found in pyha/conversion/type_transforms.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return VHDLSfix(name, current_val, initial_val, parent)
      Severity: Major
      Found in pyha/conversion/type_transforms.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return current_val._pyha_converter(name, current_val, initial_val, parent)
        Severity: Major
        Found in pyha/conversion/type_transforms.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return None
          Severity: Major
          Found in pyha/conversion/type_transforms.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return VHDLEnum(name, current_val, initial_val, parent)
            Severity: Major
            Found in pyha/conversion/type_transforms.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return f'{two_args[0].strip()} to ({two_args[1].strip()}) - 1'
              Severity: Major
              Found in pyha/conversion/redbaron_transforms.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return VHDLList(name, current_val, initial_val, parent)
                Severity: Major
                Found in pyha/conversion/type_transforms.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return None
                  Severity: Major
                  Found in pyha/conversion/type_transforms.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return None
                    Severity: Major
                    Found in pyha/conversion/type_transforms.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return VHDLComplex(name, current_val, initial_val, parent)
                      Severity: Major
                      Found in pyha/conversion/type_transforms.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return init_vhdl_type(name, PyhaList(current_val), PyhaList(initial_val), parent)
                        Severity: Major
                        Found in pyha/conversion/type_transforms.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return None  # see #216
                          Severity: Major
                          Found in pyha/conversion/type_transforms.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return VHDLList(name, list(current_val), list(current_val), parent)
                            Severity: Major
                            Found in pyha/conversion/type_transforms.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language