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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Read upRead up
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()
- Read upRead up
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()
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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):
- Read upRead up
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
- Read upRead up
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']
- Read upRead up
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!!!
- Exclude checks
TODO found Open
TODO
- Exclude checks
XXX found Open
XXX,
- Exclude checks
TODO found Open
fname = identifierValue ('=' mid = intValue)? ';' // Note: optional part is required for LIN < 2.1 -- TODO: syn. predicate!
- Exclude checks
TODO found Open
# TODO: check for extID
- Exclude checks
FIXME found Open
notes=FIXME,
- Exclude checks
TODO found Open
# TODO: filename und text parameter ==> Nur noch EINE funktion!!!
- Exclude checks