rmtoo/lib/analytics/TopicCohe.py
Function _add_topic_relation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _add_topic_relation(self, topic_a, topic_b):
'''Add the relation between topic_a and topic_b.
(Here only one _ is used because this is used by the unit tests.)'''
# If not there, add the initial count [0, 0]
for topic in [topic_a.name, topic_b.name]:
- 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 topic_set_post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def topic_set_post(self, topic_set):
'''This is call in the TopicsSet post-phase.'''
# pylint: disable=consider-iterating-dictionary
for req_id in self.__req2topics.keys():
req_a = topic_set.get_topic_set().get_requirement_set().\
- 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"