christoph2/pydbc

View on GitHub

Showing 197 of 197 total issues

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

            if not ad:
                self.logger.error("While inserting relative attribute values: attribute definition '{}' does not exist.".format(attr['attributeName']))
                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 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

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

    def insertAttributeDefaults(self, ctx):
        self.log_insertion("AttributeDefaults")
        defaults = {}
        for item in ctx.items:
            name, value = item.value
Severity: Minor
Found in pydbc/dbcListener.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 exitNode_definition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def exitNode_definition(self, ctx):
        name = ctx.name.value
        g = ctx.g.value if ctx.g else None
        d = ctx.d.value if ctx.d else None
        f = ctx.f.value if ctx.d else None
Severity: Minor
Found in pydbc/ncfListener.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 insertConfigurableFrames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def insertConfigurableFrames(self):
        self.log_insertion("ConfigurableFrames")
        for node, frames in self.configurableFrames.items():
            for frameName, messageID in frames:
                frame = self.UNCONDITIONAL_FRAME_BY_NAME(self.session).params(name = frameName).first()
Severity: Minor
Found in pydbc/ldfListener.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 insertFaultStateSignals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def insertFaultStateSignals(self):
        self.log_insertion("FaultStateSignals")
        for node, signals in self.faultStateSignals.items():
            for signalName in signals:
                signal = self.LIN_SIGNAL_BY_NAME(self.session).params(name = signalName).first()
Severity: Minor
Found in pydbc/ldfListener.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 exitGeneral_definition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def exitGeneral_definition(self, ctx):
        pv = ctx.pv.value
        sup = ctx.sup.value
        fun = ctx.fun.value
        var = ctx.var.value
Severity: Minor
Found in pydbc/ncfListener.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 exitSporadic_frame_def has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def exitSporadic_frame_def(self, ctx):
        self.log_insertion("SporadicFrames")
        ctx.value = [x.value for x in ctx.items]
        for sf in ctx.value:
            #print("*SPOR", sf)
Severity: Minor
Found in pydbc/ldfListener.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, filename = ":memory:", debug = False, logLevel = 'INFO', create = True):
        if filename == ':memory:':
            self.dbname = ""
        else:
            if not filename.lower().endswith(DB_EXTENSION):
Severity: Minor
Found in pydbc/db/__init__.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 exitSignal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def exitSignal(self, ctx):
        byteOrder = self.getValue(ctx.byteOrder)
        if not byteOrder in (0, 1):
            self.logger.error("While parsing signal: Error while parsing signal '{}': byteorder must be either 0 or 1 -- using 0".format(ctx.signalName.value))
            byteOrder = 0
Severity: Minor
Found in pydbc/dbcListener.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 exitEvent_triggered_frame_def has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def exitEvent_triggered_frame_def(self, ctx):
        self.log_insertion("EventTriggeredFrames")
        ctx.value = [x.value for x in ctx.items]
        for ef in ctx.value:
            name = ef['frameName']
Severity: Minor
Found in pydbc/ldfListener.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

TODO found
Open

        # TODO: Process after EVDATA!!!
Severity: Minor
Found in pydbc/dbcListener.py by fixme

TODO found
Open

      TODO
Severity: Minor
Found in .pylintrc by fixme

XXX found
Open

      XXX,
Severity: Minor
Found in .pylintrc by fixme

TODO found
Open

    fname = identifierValue ('=' mid = intValue)? ';' // Note: optional part is required for LIN < 2.1 -- TODO: syn. predicate!
Severity: Minor
Found in pydbc/ldf.g4 by fixme

TODO found
Open

        # TODO: check for extID
Severity: Minor
Found in pydbc/types.py by fixme

FIXME found
Open

notes=FIXME,
Severity: Minor
Found in .pylintrc by fixme

TODO found
Open

    # TODO: filename und text parameter ==> Nur noch EINE funktion!!!
Severity: Minor
Found in pydbc/template.py by fixme
Severity
Category
Status
Source
Language