tobyqin/xmind2testlink

View on GitHub
xmind2testlink/sharedparser.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function _is_v2_by_guess has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _is_v2_by_guess(d):
    """if any sub topic from testcase node mark with priority, this can be guessed as v2 xmind. """
    for suite_node in d['topics']:
        for testcase_node in suite_node['topics']:
            sub_topics = testcase_node['topics']
Severity: Minor
Found in xmind2testlink/sharedparser.py - About 2 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

Avoid deeply nested control flow statements.
Open

                    if _is_v2_by_marker(_, maker_prefix='priority'):
                        return True
                    else:
                        temp_topics.extend(_['topics'])
                    sub_topics = temp_topics
Severity: Major
Found in xmind2testlink/sharedparser.py - About 45 mins to fix

    Function build_testcase_precondition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def build_testcase_precondition(nodes):
        values = (n['comment'] for n in nodes if n.get('comment', None))
        values = list(_filter_empty_comments(values))
    
        if not values:  # try to get from callout
    Severity: Minor
    Found in xmind2testlink/sharedparser.py - About 35 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 _is_v2_by_marker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _is_v2_by_marker(d, maker_prefix='star'):
        """check if a node have a star maker"""
        if isinstance(d['makers'], list):
            for m in d['makers']:
                if m.startswith(maker_prefix):
    Severity: Minor
    Found in xmind2testlink/sharedparser.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 _filter_empty_comments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _filter_empty_comments(comment_values):
        """comment value like: [[{content:comment1},{content:comment2}],[...]]"""
        for comments in comment_values:
            for comment in comments:
                if comment.get('content'):
    Severity: Minor
    Found in xmind2testlink/sharedparser.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 get_priority has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_priority(d):
        if isinstance(d['makers'], list):
            for m in d['makers']:
                if m.startswith('priority'):
                    return int(m[-1])
    Severity: Minor
    Found in xmind2testlink/sharedparser.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

    There are no issues that match your filters.

    Category
    Status