petspats/pyha

View on GitHub
pyha/conversion/type_transforms.py

Summary

Maintainability
D
3 days
Test Coverage

File type_transforms.py has 573 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import copy
import inspect
import logging
import time
from collections import deque
Severity: Major
Found in pyha/conversion/type_transforms.py - About 1 day to fix

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

    def init_vhdl_type(name, current_val, initial_val=None, parent=None):
        from pyha.conversion.conversion import RecursiveConverter
        if type(current_val) == int or type(current_val) == np.int64:
            return VHDLInt(name, current_val, initial_val, parent)
        elif type(current_val) == bool or type(current_val) == np.bool_:
    Severity: Minor
    Found in pyha/conversion/type_transforms.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 __log_none_bounds has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def __log_none_bounds(self):
    
            def get_full_var_name():
                ret = []
                node = self
    Severity: Minor
    Found in pyha/conversion/type_transforms.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 __log_none_bounds has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def __log_none_bounds(self):
    
            def get_full_var_name():
                ret = []
                node = self
    Severity: Minor
    Found in pyha/conversion/type_transforms.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 _pyha_reset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _pyha_reset(self, prefix='self', filter_func=None):
            if filter_func:
                if not filter_func(self):
                    return ''
            ret = ''
    Severity: Minor
    Found in pyha/conversion/type_transforms.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 _pyha_reset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _pyha_reset(self, prefix='self', filter_func=None) -> str:
            if filter_func:
                if not filter_func(self):
                    return ''
    
    
    Severity: Minor
    Found in pyha/conversion/type_transforms.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 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 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

                              Avoid too many return statements within this function.
                              Open

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

                                There are no issues that match your filters.

                                Category
                                Status