tobyqin/xmind2testlink

View on GitHub

Showing 13 of 16 total issues

Function xmind_to_suite_v2 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def xmind_to_suite_v2(xmind_file):
    def parse_testcase_list(cases_dict, parent=None):
        if __.is_testcase_topic(cases_dict):
            yield __.parse_testcase(cases_dict, parent)

Severity: Minor
Found in xmind2testlink/xmind_parser.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

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

Function index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def index(download_xml=None):
    g.invalid_files = []
    g.error = None
    g.download_xml = download_xml
    g.filename = None
Severity: Minor
Found in web/application.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

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_step_xml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def build_step_xml(testcase, testcase_element):
        if testcase.steps:
            steps_element = SubElement(testcase_element, Tags.steps)
    
            for step in testcase.steps:
    Severity: Minor
    Found in xmind2testlink/testlink_parser.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 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

    Avoid too many return statements within this function.
    Open

            return render_template('index.html', download_xml=g.download_xml, records=list(get_records()))
    Severity: Major
    Found in web/application.py - About 30 mins to fix

      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 delete_records has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def delete_records(keep=20):
          """Clean up files on server and mark the record as deleted"""
          sql = "SELECT * from records where is_deleted<>1 ORDER BY id desc LIMIT -1 offset {}".format(keep)
          assert isinstance(g.db, sqlite3.Connection)
          c = g.db.cursor()
      Severity: Minor
      Found in web/application.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

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

      def main():
          if len(sys.argv) > 1 and sys.argv[1].endswith('.xmind'):
              xmind = sys.argv[1]
      
              if len(sys.argv) == 3 and sys.argv[2] == '-json':
      Severity: Minor
      Found in xmind2testlink/main.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 to_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_dict(self):
              me = {'name': self.name,
                    'details': self.details,
                    'testcase_list': [],
                    'sub_suites': []}
      Severity: Minor
      Found in xmind2testlink/datatype.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

      Severity
      Category
      Status
      Source
      Language