christoph2/pydbc

View on GitHub

Showing 52 of 197 total issues

DbcListener has 58 functions (exceeds 20 allowed). Consider refactoring.
Open

class DbcListener(parser.BaseListener):
    """

    """

Severity: Major
Found in pydbc/dbcListener.py - About 1 day to fix

    LdfListener has 56 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class LdfListener(parser.BaseListener):
    
        def __init__(self, database, logLevel = 'INFO', *args, **kws):
            super(LdfListener, self).__init__(database, logLevel, *args, **kws)
            self.logger = Logger(__name__, level = logLevel)
    Severity: Major
    Found in pydbc/ldfListener.py - About 1 day to fix

      File model.py has 1195 lines of code (exceeds 1000 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      __copyright__ = """
         pySART - Simplified AUTOSAR-Toolkit for Python.
      Severity: Major
      Found in pydbc/db/model.py - About 6 hrs to fix

        Function exitSchedule_table_def has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

            def exitSchedule_table_def(self, ctx):
                self.log_insertion("ScheduleTables")
                ctx.value = [x.value for x in ctx.items]
                for table in ctx.value:
                    name = table['name']
        Severity: Minor
        Found in pydbc/ldfListener.py - About 6 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

        NcfListener has 43 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class NcfListener(parser.BaseListener):
        
            def __init__(self, database, logLevel = 'INFO', *args, **kws):
                super(NcfListener, self).__init__(database, logLevel, *args, **kws)
                self.logger = Logger(__name__, level = logLevel)
        Severity: Minor
        Found in pydbc/ncfListener.py - About 5 hrs to fix

          Function fetch_attributes has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

          def fetch_attributes(db):
              # Attribute structure is currently to inconvenient for ad-hoc queries, so pre-fetch them.
          
              from collections import defaultdict
              from itertools import groupby
          Severity: Minor
          Found in pydbc/db/imex.py - About 5 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 exitAttributeValues has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitAttributeValues(self, ctx):
                  self.log_insertion("AttributeValues")
                  ctx.value = [x.value for x in ctx.items]
                  values = []
                  for attr in ctx.value:
          Severity: Minor
          Found in pydbc/dbcListener.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 exitComments has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitComments(self, ctx):
                  self.log_insertion("Comments")
                  ctx.value = [x.value for x in ctx.items]
                  for comment in ctx.value:
                      tp = comment['type']
          Severity: Minor
          Found in pydbc/dbcListener.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 exitMessages has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitMessages(self, ctx):
                  self.log_insertion("Messages and Signals")
                  ctx.value = [x.value for x in ctx.items]
                  for msg in ctx.value:
                      name = msg['name']
          Severity: Minor
          Found in pydbc/dbcListener.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 exitRelativeAttributeValues has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitRelativeAttributeValues(self, ctx):
                  self.log_insertion("RelativeAttributeValues")
                  items = [x.value for x in ctx.items]
                  ctx.value = items
                  for attr in items:
          Severity: Minor
          Found in pydbc/dbcListener.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 insertAttributeDefinitions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              def insertAttributeDefinitions(self, ctx):
                  self.log_insertion("AttributeDefinitions")
                  ctx.value = [x.value for x in ctx.items]
                  for attr in ctx.value:
                      attrType = attr['type']
          Severity: Minor
          Found in pydbc/dbcListener.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 exitCommand has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitCommand(self, ctx):
                  if ctx.frameName:
                      cmdName = "Frame"
                  else:
                      cmdName = ctx.c.text
          Severity: Minor
          Found in pydbc/ldfListener.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 exitNode_attributes_def has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitNode_attributes_def(self, ctx):
                  self.log_insertion("NodeAttributes")
                  items = [x.value for x in ctx.items]
                  ctx.value = items
                  attrs = ctx.value
          Severity: Minor
          Found in pydbc/ldfListener.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 exitCategories has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitCategories(self, ctx):
                  self.log_insertion("Categories")
                  ctx.value = [x.value for x in ctx.items]
                  for category in ctx.value:
                      print("CAT-VALUE", category)
          Severity: Minor
          Found in pydbc/dbcListener.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 product_id has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def product_id(self, product_id):
                  """
                  """
                  if product_id in ("", ()):
                      self.supplier_id = self.function_id = self.variant = 0
          Severity: Minor
          Found in pydbc/db/model.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 exitSignal_def has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def exitSignal_def(self, ctx):
                  self.log_insertion("Signals")
                  ctx.value = [x.value for x in ctx.items]
                  for signal in ctx.value:
                      #print("SIG:", signal)
          Severity: Minor
          Found in pydbc/ldfListener.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 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, name, protocol_version = None, configured_NAD = None, initial_NAD = None, product_id = (),
          Severity: Major
          Found in pydbc/db/model.py - About 1 hr to fix

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

                def __init__(self, frame_time, d1, d2, d3, d4, d5, d6, d7, d8):
            Severity: Major
            Found in pydbc/db/model.py - About 1 hr to fix

              Function exitLin_description_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def exitLin_description_file(self, ctx):
                      self.value = dict(
                          protocolVersion = ctx.pv.value,
                          languageVersion = ctx.lv.value,
                          fileRevision = ctx.fr.value if ctx.fr else None,
              Severity: Minor
              Found in pydbc/ldfListener.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 exitDiagnostic_definition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def exitDiagnostic_definition(self, ctx):
                      lhs = ctx.lhs.value
                      rhs = ctx.rhs.value if ctx.rhs else None
                      nads = [x.value for x in ctx.nads] if ctx.nads else []
                      dc = ctx.dc.value if ctx.dc else None
              Severity: Minor
              Found in pydbc/ncfListener.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

              Severity
              Category
              Status
              Source
              Language