c0fec0de/pyebus

View on GitHub

Showing 31 of 31 total issues

File types.py has 747 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Type Engine."""
import datetime
import re

from .util import repr_
Severity: Major
Found in pyebus/types.py - About 1 day to fix

    File ebus.py has 407 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Pythonic EBUS Representation."""
    import asyncio
    import collections
    import logging
    
    
    Severity: Minor
    Found in pyebus/ebus.py - About 5 hrs to fix

      Function notify has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def notify(self, msg):
              """
              Notify about received message.
      
              Raise:
      Severity: Minor
      Found in pyebus/prioritizer.py - About 2 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 filter_msg has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def filter_msg(msg=None, msgdefs=None):
          """Strip Down Message according to `msgdefs`."""
          if msg is not None:
              ident = msg.msgdef.ident
              if msgdefs is not None:
      Severity: Minor
      Found in pyebus/msg.py - About 2 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 respond has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def respond(self, request):
              """Iterate over response for `request`."""
              if request == "quit":  # pragma: no cover
                  yield "connection closed"
                  yield ""
      Severity: Minor
      Found in pyebus/dummy.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 _decodefields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _decodefields(msgdef, valuestr):
              if valuestr not in ("no data stored", "nosignal"):
                  values = valuestr.split(";")
                  fields = []
                  for fielddef in msgdef.fields:
      Severity: Minor
      Found in pyebus/msgdecoder.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 _resolve has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _resolve(self, pattern):
              pat = Pattern.from_str(pattern)
              circuit, name, setprio, fieldname = pat
              for msgdef in self.find(circuit, name):
                  if fieldname is None:
      Severity: Minor
      Found in pyebus/msgdefs.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 print_msg has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def print_msg(msg, skipbroken=False):
          """Formatted output."""
          if msg.valid:
              for field in msg.fields:
                  # if isinstance(field.value, (ValueError))
      Severity: Minor
      Found in pyebus/cli/common.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 iter_virtfielddefs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def iter_virtfielddefs(fielddefs):
          """Iterate over Generic Field Definitions."""
          typeclss = [fielddef.type_.__class__ for fielddef in fielddefs]
          names = [fielddef.name for fielddef in fielddefs]
          if DateType in typeclss and TimeType in typeclss:
      Severity: Minor
      Found in pyebus/virtfielddef.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 _createfields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _createfields(chunks):
          if chunks:
              # determine duplicate names
              fields = []
              dups = collections.defaultdict(lambda: -1)
      Severity: Minor
      Found in pyebus/msgdefdecoder.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 set_defaultprio has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_defaultprio(self, defaultprio):
              """Set Priorities of all messages without a priority value."""
              msgdefs = self._msgdefs
              for circuitmsgdefs in msgdefs.values():
                  for msgdefs in circuitmsgdefs.values():
      Severity: Minor
      Found in pyebus/msgdefs.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in pyebus/ebus.py - About 1 hr to fix

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

            def __new__(cls, circuit, name, children, read=False, prio=None, write=False, update=False, setprio=None):
        Severity: Major
        Found in pyebus/msgdef.py - About 1 hr to fix

          Function _createfield has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _createfield(idx, name, _, __, datatype, dividervalues=None, unit=None, comment=None):
          Severity: Major
          Found in pyebus/msgdefdecoder.py - About 1 hr to fix

            Function _createfield has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def _createfield(idx, name, _, __, datatype, dividervalues=None, unit=None, comment=None):
                if dividervalues and "=" in dividervalues:
                    type_ = EnumType(tuple(pair.split("=", 1)[1] for pair in dividervalues.split(";")))
                else:
                    ebustype = datatype.split(",")[0]
            Severity: Minor
            Found in pyebus/msgdefdecoder.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 decode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def decode(self, value):
                    """Decode `value`."""
                    if value not in ("-", ""):
                        if self.divider and self.divider > 0:
                            value = float(value)
            Severity: Minor
            Found in pyebus/types.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 decode_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def decode_type(typecode, divider=None):
                """
                Get :any:`Type` instance for `typecode`.
            
                Args:
            Severity: Minor
            Found in pyebus/typedecoder.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

            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

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

                def encode(self, value):
                    """Encode `value`."""
                    if value is not None:
                        if self.divider and self.divider > 0:
                            value = float(value)
            Severity: Minor
            Found in pyebus/types.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 msg.msgdef == msgdef or not msg.valid:
                                    return msg
            
            
            Severity: Major
            Found in pyebus/msg.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language