petspats/pyha

View on GitHub

Showing 108 of 164 total issues

Avoid too many return statements within this function.
Open

                        return f"0 to ({len[0]}'length{len[1]}) - 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 f'0 to ({range_pattern[0]}) - 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 array
      Severity: Major
      Found in pyha/common/util.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

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

          def get_object(node):
              """ Parse rebaron AtomTrailers node into Python object (taken from ongoing conversion object)
               Works for object and local scope """
          
              if len(node) > 1 and (node[0].value == 'self' or node[0].value == 'self_next'):
          Severity: Minor
          Found in pyha/conversion/redbaron_transforms.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 resize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def resize(fix: Sfix, left=0, right=-17, size_res=None, overflow_style='wrap', round_style='truncate', wrap_is_ok=False,
                     signed=None) -> Sfix:
              """
              Resize fixed point number.
          
          
          Severity: Minor
          Found in pyha/common/fixed_point.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 plot_time_domain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def plot_time_domain(simulations, name='Time domain'):
              simulations["MODEL"] = np.array(simulations["MODEL"])
              simulations["HARDWARE"] = np.array(simulations["HARDWARE"])
              if is_float(simulations["MODEL"][0]):
                  fig, ax = plt.subplots(2, sharex="all", figsize=figsize, gridspec_kw={'height_ratios': [4, 2]})
          Severity: Minor
          Found in pyha/simulation/plotter.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 to_vhdl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def to_vhdl(self):
                  try:
                      os.makedirs(self.output_dir)
                  except:
                      pass
          Severity: Minor
          Found in pyha/conversion/conversion.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