christoph2/pydbc

View on GitHub

Showing 197 of 197 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    def __repr__(self):
        return 'LinScheduleTable_Command_ConditionalChangeNad(frame_time = {}, nad = {}, id = {}, byte = {}, mask = {}, inv = {}, new_nad = {})'.format(
            self.frame_time, self.nad, self.id, self.byte, self.mask, self.inv, self.new_nad
Severity: Major
Found in pydbc/db/model.py and 2 other locations - About 45 mins to fix
pydbc/db/model.py on lines 1230..1232
pydbc/db/model.py on lines 1298..1300

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    def exitMessageTransmitters(self, ctx):
        self.log_insertion("NodeTxMessages")
        ctx.value = [x.value for x in ctx.items]
        for transmitter in ctx.value:
            msg = self.MESSAGE_BY_MESSAGE_ID(self.session).params(message_id = transmitter['messageID']).first()
Severity: Minor
Found in pydbc/dbcListener.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 renderTemplate has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def renderTemplate(filename, namespace = {}, leftMargin = 0, rightMargin = 80, formatExceptions = False, encoding = 'utf-8'):
Severity: Minor
Found in pydbc/template.py - About 45 mins to fix

    Function renderTemplateFromText has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def renderTemplateFromText(tmpl, namespace = {}, leftMargin = 0, rightMargin = 80, formatExceptions = True, encoding = 'utf-8'):
    Severity: Minor
    Found in pydbc/template.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if array:
                              conv = float if value_type == ValueType.FLOAT else int
                              value = [conv(x) for x in string_value.split(";")]
                          else:
                              if value_type in (ValueType.INT, ValueType.FLOAT):
      Severity: Major
      Found in pydbc/db/imex.py - About 45 mins to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def __repr__(self):
                return 'LinScheduleTable_Command_AssignFrameIdRange(frame_time = {}, node = {}, frame_index = {}, frame_pid1 = {}, frame_pid2 = {}, frame_pid3 = {}, frame_pid4 = {})'.format(
                    self.frame_time, self.node, self.frame_index, self.frame_pid1, self.frame_pid2, self.frame_pid3, self.frame_pid4
        Severity: Major
        Found in pydbc/db/model.py and 2 other locations - About 45 mins to fix
        pydbc/db/model.py on lines 1190..1192
        pydbc/db/model.py on lines 1230..1232

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                            entry = LinScheduleTable_Command_FreeFormat(frame_time = frame_time, d1 = d1, d2 = d2, d3 = d3,
        Severity: Minor
        Found in pydbc/ldfListener.py and 1 other location - About 45 mins to fix
        pydbc/dbcListener.py on lines 372..372

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        ss = Signal(name = name, bitsize = signalSize, byteorder = byteOrder, sign = sign,
        Severity: Minor
        Found in pydbc/dbcListener.py and 1 other location - About 45 mins to fix
        pydbc/ldfListener.py on lines 617..617

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

            def __init__(self, grammarName, startSymbol, listenerClass, debug = False, logLevel = 'INFO'):
        Severity: Minor
        Found in pydbc/parser.py - About 35 mins to fix

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

          def parseFile(pth, filetype, debug = False, remove_file = False, logLevel = "WARN"):
          Severity: Minor
          Found in pydbc/scripts/vndb_importer.py - About 35 mins to fix

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

                def __init__(self, name, timebase, jitter, bit_length = None, tolerant = None):
            Severity: Minor
            Found in pydbc/db/model.py - About 35 mins to fix

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

                  def __init__(self, min_value, max_value, scale, offset, text_info):
              Severity: Minor
              Found in pydbc/db/model.py - About 35 mins to fix

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        elif ctx.p:
                            value = self.getValue(ctx.p)
                            vtype = "range"
                        elif ctx.b:
                            value = None
                Severity: Minor
                Found in pydbc/ldfListener.py and 1 other location - About 35 mins to fix
                pydbc/ncfListener.py on lines 206..214

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def exitObjectValueTables(self, ctx):
                        self.log_insertion("ObjectValuetables")
                        ctx.value = [x.value for x in ctx.items]
                        for table in ctx.value:
                            tp = table['type']
                Severity: Minor
                Found in pydbc/dbcListener.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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        elif ctx.p:
                            value = ctx.p.value
                            vtype = "range"
                        elif ctx.b:
                            value = None
                Severity: Minor
                Found in pydbc/ncfListener.py and 1 other location - About 35 mins to fix
                pydbc/ldfListener.py on lines 749..757

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def insertReceivers(self, messageId, signalId, receiver):
                        for rcv in receiver:
                            res = self.NODE_BY_NAME(self.session).params(name = rcv).first()
                            if res:
                                nodeId = res.rid
                Severity: Minor
                Found in pydbc/dbcListener.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 parseFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def parseFile(pth, filetype, debug = False, remove_file = False, logLevel = "WARN"):
                    if filetype == FileType.DBC:
                        grammar = 'dbc'
                        start_symbol = 'dbcfile'
                        listenerClass = DbcListener
                Severity: Minor
                Found in pydbc/scripts/vndb_importer.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

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                            if not msg:
                                self.logger.error("While inserting message transmitters: message '{}' does not exist.".format(transmitter['messageID']))
                                continue
                Severity: Major
                Found in pydbc/dbcListener.py and 3 other locations - About 30 mins to fix
                pydbc/dbcListener.py on lines 710..712
                pydbc/dbcListener.py on lines 787..789
                pydbc/dbcListener.py on lines 791..793

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                            if not ad:
                                self.logger.error("While inserting attribute values: attribute definition named '{}' does not exist.".format(attr['name']))
                                continue
                Severity: Major
                Found in pydbc/dbcListener.py and 3 other locations - About 30 mins to fix
                pydbc/dbcListener.py on lines 272..274
                pydbc/dbcListener.py on lines 787..789
                pydbc/dbcListener.py on lines 791..793

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                            if not ad:
                                self.logger.error("While inserting relative attribute values: node '{}' does not exist.".format(attr['nodeName']))
                                continue
                Severity: Major
                Found in pydbc/dbcListener.py and 3 other locations - About 30 mins to fix
                pydbc/dbcListener.py on lines 272..274
                pydbc/dbcListener.py on lines 710..712
                pydbc/dbcListener.py on lines 787..789

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language