ArturSpirin/test_junkie

View on GitHub
test_junkie/reporter/html_reporter.py

Summary

Maintainability
C
1 day
Test Coverage

File html_reporter.py has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import copy
import json
import time
import traceback

Severity: Minor
Found in test_junkie/reporter/html_reporter.py - About 3 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                            for status in TestCategory.ALL:
                                data_point.update({status: metrics[status]})
                            data.append(data_point)
    Severity: Major
    Found in test_junkie/reporter/html_reporter.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              for class_param, class_param_data in test_metrics.items():
                                  for param, param_data in class_param_data.items():
      
                                      self.analyzer.analyze(test_id=test_id,
                                                            tracebacks=list(param_data["tracebacks"]),
      Severity: Major
      Found in test_junkie/reporter/html_reporter.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if status not in not_defined:
                                    not_defined.update({status: metrics[status]})
                                else:
                                    not_defined[status] += metrics[status]
                        else:
        Severity: Major
        Found in test_junkie/reporter/html_reporter.py - About 45 mins to fix

          Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.
          Open

              def __get_components_data(self):  # for the stacked bar

          Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

          See

          Refactor this function to reduce its Cognitive Complexity from 105 to the 15 allowed.
          Open

              def __get_table_data(self):  # for data table

          Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

          See

          Remove this commented out code.
          Open

                              # _traceback = _traceback.replace("\n", "<br>").replace("    ", "&emsp;")

          Programmers should not comment out code as it bloats programs and reduces readability.

          Unused code should be deleted and can be retrieved from source control history if required.

          See

          • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
          • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
          • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
          • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

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

                  for suite, metrics in self.suites.items():
                      if suite != "_totals_":
                          data_point = {"duration": Reporter.round(metrics["performance"]),
                                        "measure": suite}
                          for status in TestCategory.ALL:
          Severity: Major
          Found in test_junkie/reporter/html_reporter.py and 1 other location - About 3 hrs to fix
          test_junkie/reporter/html_reporter.py on lines 166..178

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

          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

                          if component is None:  # Not defined components have to be aggregated from all features
                              not_defined["duration"] += metrics["performance"]
                              for status in TestCategory.ALL:
                                  if status not in not_defined:
                                      not_defined.update({status: metrics[status]})
          Severity: Major
          Found in test_junkie/reporter/html_reporter.py and 1 other location - About 3 hrs to fix
          test_junkie/reporter/html_reporter.py on lines 207..213

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

          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

                          if cp.startswith("<") and cp.endswith(">"):  # have to strip the html tags or wont show up
                              cp = "&lt;{}&gt;".format(cp[1:-1])
          Severity: Major
          Found in test_junkie/reporter/html_reporter.py and 1 other location - About 1 hr to fix
          test_junkie/reporter/html_reporter.py on lines 284..285

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

          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

                              if tp.startswith("<") and tp.endswith(">"):  # have to strip the html tags or wont show up
                                  tp = "&lt;{}&gt;".format(tp[1:-1])
          Severity: Major
          Found in test_junkie/reporter/html_reporter.py and 1 other location - About 1 hr to fix
          test_junkie/reporter/html_reporter.py on lines 276..277

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

          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

          There are no issues that match your filters.

          Category
          Status