christoph2/pydbc

View on GitHub

Showing 197 of 197 total issues

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

class LinFaultStateSignal(Base, MixInBase):
    """
    """
    node_id = Column(types.Integer,
        ForeignKey("node.rid"),
Severity: Major
Found in pydbc/db/model.py and 1 other location - About 1 day to fix
pydbc/db/model.py on lines 911..932

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 140.

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

class LinSignalRepresentation(Base, MixInBase):
    """
    """
    lin_signal_encoding_type_id = Column(types.Integer,
        ForeignKey("linsignalencodingtype.rid"),
Severity: Major
Found in pydbc/db/model.py and 1 other location - About 1 day to fix
pydbc/db/model.py on lines 1506..1528

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 140.

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

                elif ct == 'DataDump':
                    node_name = cmd['node_name']
                    node = self.nodes.get(node_name)
                    if not node:
                        self.logger.error("While inserting schedule tables: node '{}' does not exist.".format(name))
Severity: Major
Found in pydbc/ldfListener.py and 1 other location - About 1 day to fix
pydbc/ldfListener.py on lines 593..604

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 135.

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

                elif ct == 'AssignFrameIdRange':
                    node_name = cmd['node_name']
                    node = self.nodes.get(node_name)
                    if not node:
                        self.logger.error("While inserting schedule tables: node '{}' does not exist.".format(name))
Severity: Major
Found in pydbc/ldfListener.py and 1 other location - About 1 day to fix
pydbc/ldfListener.py on lines 572..583

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 135.

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

class LinScheduleTable_Command_AssignNad(LinScheduleTable_Command):
    """
    """
    command_id = Column(
        types.Integer,
Severity: Major
Found in pydbc/db/model.py and 1 other location - About 1 day to fix
pydbc/db/model.py on lines 1238..1263

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 132.

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

class LinScheduleTable_Command_SaveConfiguration(LinScheduleTable_Command):
    """
    """
    command_id = Column(
        types.Integer,
Severity: Major
Found in pydbc/db/model.py and 1 other location - About 1 day to fix
pydbc/db/model.py on lines 1134..1159

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 132.

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

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

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

        class Node_TxMessage(Base, MixInBase):
        
            node_id = Column(types.Integer,
                ForeignKey("node.rid", onupdate = "CASCADE", ondelete = "RESTRICT"),
                nullable = False, default = 0, primary_key = True
        Severity: Major
        Found in pydbc/db/model.py and 1 other location - About 6 hrs to fix
        pydbc/db/model.py on lines 242..253

        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 103.

        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

        class Node_TxSig(Base, MixInBase):
        
            node_id = Column(types.Integer,
                ForeignKey("node.rid", onupdate = "CASCADE", ondelete = "RESTRICT"),
                nullable = False, default = 0, primary_key = True
        Severity: Major
        Found in pydbc/db/model.py and 1 other location - About 6 hrs to fix
        pydbc/db/model.py on lines 229..240

        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 103.

        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

            def exitSignal_item(self, ctx):
                sname = self.getValue(ctx.sname)
                ssize = self.getValue(ctx.ssize)
                initValue = self.getValue(ctx.initValue)
                pub = self.getValue(ctx.pub)
        Severity: Major
        Found in pydbc/ldfListener.py and 1 other location - About 6 hrs to fix
        pydbc/ldfListener.py on lines 460..466

        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 101.

        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

            def exitFrame_item(self, ctx):
                fname = self.getValue(ctx.fname)
                fid = self.getValue(ctx.fid)
                p = self.getValue(ctx.p)
                fsize = self.getValue(ctx.fsize)
        Severity: Major
        Found in pydbc/ldfListener.py and 1 other location - About 6 hrs to fix
        pydbc/ldfListener.py on lines 389..395

        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 101.

        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

        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

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

                  elif cmdName == 'DataDump':
                      cmd['node_name'] = ctx.nodeName.value
                      cmd['d1'] = ctx.d1.value
                      cmd['d2'] = ctx.d2.value
                      cmd['d3'] = ctx.d3.value
          Severity: Major
          Found in pydbc/ldfListener.py and 1 other location - About 5 hrs to fix
          pydbc/ldfListener.py on lines 656..662

          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 91.

          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

                  elif cmdName == 'ConditionalChangeNAD':
                      cmd['nad'] = ctx.nad.value
                      cmd['id'] = ctx.id_.value
                      cmd['byte'] = ctx.byte_.value
                      cmd['mask'] = ctx.mask.value
          Severity: Major
          Found in pydbc/ldfListener.py and 1 other location - About 5 hrs to fix
          pydbc/ldfListener.py on lines 663..669

          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 91.

          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

                      for signal_name in sr['signalNames']:
                          signal = self.LIN_SIGNAL_BY_NAME(self.session).params(name = signal_name).first()
                          if not signal:
                              self.logger.error("While inserting signal representations: signal '{}' does not exist.".format(signal_name))
                              continue
          Severity: Major
          Found in pydbc/ldfListener.py and 1 other location - About 5 hrs to fix
          pydbc/dbcListener.py on lines 275..281

          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 88.

          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

                      for name in transmitter['transmitters']:
                          node = self.NODE_BY_NAME(self.session).params(name = name).first()
                          if not node:
                              self.logger.error("While inserting message transmitters: node '{}' does not exist.".format(name))
                              continue
          Severity: Major
          Found in pydbc/dbcListener.py and 1 other location - About 5 hrs to fix
          pydbc/ldfListener.py on lines 791..797

          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 88.

          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