christoph2/pydbc

View on GitHub

Showing 197 of 197 total issues

Cyclomatic complexity is too high in method exitMessageTransmitters. (6)
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 by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method exitSignalGroups. (6)
Open

    def exitSignalGroups(self, ctx):
        self.log_insertion("SignalGroups")
        items = [x.value for x in ctx.items]
        ctx.value = items
        for group in ctx.value:
Severity: Minor
Found in pydbc/dbcListener.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in function parseFile. (6)
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 by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method exitObjectValueTables. (6)
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 by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

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

        self.EXISTS_NETWORK = self.bakery(lambda session: session.query(literal(True)).filter(Network.name == bindparam('name')))
Severity: Major
Found in pydbc/dbcListener.py and 1 other location - About 1 hr to fix
pydbc/dbcListener.py on lines 90..91

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

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

        self.EXISTS_ATTRIBUTE_DEFINITION = self.bakery(lambda session: session.query(literal(True)).filter(
            Attribute_Definition.name == bindparam('name')))
Severity: Major
Found in pydbc/dbcListener.py and 1 other location - About 1 hr to fix
pydbc/dbcListener.py on lines 94..94

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

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

    try:
        tobj = Template(filename = filename, output_encoding = encoding,  format_exceptions = formatExceptions)
        tobj.render_context(ctx)
    except:
        print(exceptions.text_error_template().render())
Severity: Major
Found in pydbc/template.py and 1 other location - About 1 hr to fix
pydbc/template.py on lines 59..64

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

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

    try:
        tobj = Template(text = tmpl, output_encoding = encoding, format_exceptions = formatExceptions)
        tobj.render_context(ctx)
    except:
        print(exceptions.text_error_template().render())
Severity: Major
Found in pydbc/template.py and 1 other location - About 1 hr to fix
pydbc/template.py on lines 47..52

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

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

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

        self.SCHEDULE_TABLE_BY_NAME = self.bakery(lambda session: session.query(LinScheduleTable).filter(
            LinScheduleTable.name == bindparam('name')))
Severity: Major
Found in pydbc/ldfListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.LIN_NODE_BY_NAME = self.bakery(lambda session: session.query(LinNode).filter(LinNode.name == bindparam('name')))
Severity: Major
Found in pydbc/ldfListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.SIGNAL_BY_RID = self.bakery(lambda session: session.query(Signal).filter(Signal.rid == bindparam('rid')))
Severity: Major
Found in pydbc/dbcListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.ENCODING_TYPE_BY_NAME = self.bakery(lambda session: session.query(LinSignalEncodingType).filter(
            LinSignalEncodingType.name == bindparam("name")))
Severity: Major
Found in pydbc/ldfListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.LIN_SIGNAL_BY_NAME = self.bakery(lambda session: session.query(LinSignal).filter(LinSignal.name == bindparam('name')))
Severity: Major
Found in pydbc/ldfListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.SIGNAL_BY_RID = self.bakery(lambda session: session.query(Signal).filter(Signal.rid == bindparam('rid')))
Severity: Major
Found in pydbc/parser.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109

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

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

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

        self.SIGNAL_BY_NAME = self.bakery(lambda session: session.query(Signal).filter(Signal.name == bindparam('name')))
Severity: Major
Found in pydbc/parser.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.ENVDATA_BY_NAME = self.bakery(lambda session: session.query(EnvironmentVariablesData).filter(
            EnvironmentVariablesData.name == bindparam('name')))
Severity: Major
Found in pydbc/dbcListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 88..88
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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 16 locations. Consider refactoring.
Open

        self.NETWORK_BY_RID = self.bakery(lambda session: session.query(Network).filter(Network.rid == bindparam('rid')))
Severity: Major
Found in pydbc/dbcListener.py and 15 other locations - About 1 hr to fix
pydbc/dbcListener.py on lines 82..82
pydbc/dbcListener.py on lines 83..83
pydbc/dbcListener.py on lines 84..85
pydbc/dbcListener.py on lines 89..89
pydbc/ldfListener.py on lines 111..112
pydbc/ldfListener.py on lines 113..114
pydbc/ldfListener.py on lines 115..116
pydbc/ldfListener.py on lines 117..117
pydbc/ldfListener.py on lines 118..118
pydbc/ldfListener.py on lines 119..119
pydbc/parser.py on lines 106..106
pydbc/parser.py on lines 107..107
pydbc/parser.py on lines 108..108
pydbc/parser.py on lines 109..109
pydbc/parser.py on lines 110..110

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

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