c0fec0de/pyebus

View on GitHub

Showing 31 of 31 total issues

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

def get_icon(fielddef, state=None):
    """
    Return Appropriate mdi-icon_ for `fielddef` at `state`.

    .. _mdi-icon: https://materialdesignicons.com/
Severity: Minor
Found in pyebus/icon.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

Consider simplifying this complex logical expression.
Open

        if (self.circuit, self.name, self.children) == (msgdef.circuit, msgdef.name, msgdef.children):
            return self.replace(
                read=self.read or msgdef.read,
                prio=self.prio or msgdef.prio,
                write=self.write or msgdef.write,
Severity: Major
Found in pyebus/msgdef.py - About 40 mins to fix

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

        def __new__(cls, name, type_, func, unit=None, comment=None):
    Severity: Minor
    Found in pyebus/msgdef.py - About 35 mins to fix

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

          def __init__(
      Severity: Minor
      Found in pyebus/dummyconnection.py - About 35 mins to fix

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

            def __new__(cls, idx, name, type_, unit=None, comment=None):
        Severity: Minor
        Found in pyebus/msgdef.py - About 35 mins to fix

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

          def repr_(obj, args=None, kwargs=None):
              """
              Return Python Representation String.
          
              Keyword Args:
          Severity: Minor
          Found in pyebus/util.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 resolve_prio has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def resolve_prio(msgdef, setprio=AUTO):
              """
              Resolve priority specification.
          
              Integer values are just passed through.
          Severity: Minor
          Found in pyebus/msgdef.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 None
          Severity: Major
          Found in pyebus/icon.py - About 30 mins to fix

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

                def __sub__(self, other):
                    if self.__class__ is other.__class__:
                        msgdefs = MsgDefs()
                        othermsgs = tuple(other)
                        for msgdef in self:
            Severity: Minor
            Found in pyebus/msgdefs.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 _split has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _split(line):
                values = []
                regex = re.compile(r'"(([^"]|"")+)"(,|$)|([^\,]*)(,|$)')
                for mat in regex.finditer(line):
                    groups = mat.groups()
            Severity: Minor
            Found in pyebus/msgdefdecoder.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 decodetype has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def decodetype(type_):
                """
                Decode Type.
            
                >>> decodetype('r')
            Severity: Minor
            Found in pyebus/msgdefdecoder.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