ArturSpirin/test_junkie

View on GitHub

Showing 113 of 184 total issues

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

                print("[{status}]\tWasn't able to find config @ {path}. Please check that the file exists."
                      .format(status=CliUtils.format_color_string(value="ERROR", color="red"),
                              path=CliUtils.format_color_string(value=config_name, color="red")))
Severity: Minor
Found in test_junkie/cli/cli_config.py and 1 other location - About 50 mins to fix
test_junkie/cli/cli_runner.py on lines 125..127

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

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

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

                            if suite_retry_attempt > 1:
                                unsuccessful_tests = suite.get_unsuccessful_tests()
                                LogJunkie.debug("There are {} unsuccessful tests that need to be retried"
                                                .format(len(unsuccessful_tests)))
                                if not unsuccessful_tests:
    Severity: Major
    Found in test_junkie/runner.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if data_context == "suites":
                                  details.append("\nSuite: {value} Feature: {feature}"
                                                 .format(value=CliUtils.format_bold_string(primary_key),
                                                         feature=CliUtils.format_bold_string(context["feature"])))
                              else:
      Severity: Major
      Found in test_junkie/cli/cli_audit.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if len(data["data"]["similar"]) > 0:
                                    tb = Reporter.escape(data["traceback"], quote=True)
        
                                    analysis.append(
                                        "{similar_count} test failures due to a similar "
        Severity: Major
        Found in test_junkie/reporter/analyzer.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

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

                        self.__stats[string_class_param][string_param]["exceptions"]\
                            .append(Limiter.parse_exception_object(exception))
            Severity: Minor
            Found in test_junkie/metrics.py and 1 other location - About 45 mins to fix
            test_junkie/metrics.py on lines 126..127

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

            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

            Avoid deeply nested control flow statements.
            Open

                                    if class_param != "None":
                                        print("\t  |__ class parameter: {class_parameter}".format(class_parameter=class_param))
                                    for param, param_data in class_param_data.items():
            Severity: Major
            Found in test_junkie/metrics.py - About 45 mins to fix

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

                  def version(self):
                      print("Test Junkie {} (Python{})\n{}".format(pkg_resources.require("test-junkie")[0].version,
                                                                   sys.version_info[0],
                                                                   DocumentationLinks.DOMAIN))
              Severity: Minor
              Found in test_junkie/cli/cli.py and 1 other location - About 45 mins to fix
              test_junkie/metrics.py on lines 358..359

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

              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 isinstance(match, tuple):
                              for item in match:
                                  if "\nclass " in item:
                                      decorated_classes.append(item.split("\nclass ")[-1].strip())
                          else:
              Severity: Minor
              Found in test_junkie/cli/cli_runner.py and 1 other location - About 45 mins to fix
              test_junkie/cli/cli_runner.py on lines 161..163

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

              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

              Avoid deeply nested control flow statements.
              Open

                                      if test.get_function_name() in self.__settings.tests:
                                          requested = True
                                          break
                          else:
              Severity: Major
              Found in test_junkie/runner.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if inspect.getsource(test.get_function_object()) == inspect.getsource(t):
                                            requested = True
                                            break
                                    else:
                Severity: Major
                Found in test_junkie/runner.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if len(details) >= 5:
                                              section += details
                                      if len(section) > 1:
                  Severity: Major
                  Found in test_junkie/cli/cli_audit.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if Analyzer.is_similar(traceback, key):
                                                self.__analysis["traceback_insights"][key]["similar"].append(test_id)
                                elif traceback and index == 0:
                    Severity: Major
                    Found in test_junkie/reporter/analyzer.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if test_mapping["thread"].is_alive():
                                                      return False
                                  return True
                      Severity: Major
                      Found in test_junkie/parallels.py - About 45 mins to fix

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

                                        for item in match:
                                            if "\nclass " in item:
                                                decorated_classes.append(item.split("\nclass ")[-1].strip())
                        Severity: Minor
                        Found in test_junkie/cli/cli_runner.py and 1 other location - About 45 mins to fix
                        test_junkie/cli/cli_runner.py on lines 160..166

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

                        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

                        Avoid deeply nested control flow statements.
                        Open

                                                    if parse_file(file_path)is True:
                                                        continue
                                    for thread in CliRunner.__SCANNER_THREADS:
                        Severity: Major
                        Found in test_junkie/cli/cli_runner.py - About 45 mins to fix

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

                                      self.__stats[string_class_param][string_param]["tracebacks"]\
                                          .append(Limiter.parse_traceback(formatted_traceback))
                          Severity: Minor
                          Found in test_junkie/metrics.py and 1 other location - About 45 mins to fix
                          test_junkie/metrics.py on lines 124..125

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

                          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

                          Avoid deeply nested control flow statements.
                          Open

                                                      for param, param_data in class_param_data.items():
                          
                                                          test_status = param_data["status"]
                                                          if test_status != TestCategory.SUCCESS:
                                                              test_status = "failure"
                          Severity: Major
                          Found in test_junkie/reporter/xml_reporter.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    while tests:
                                                        for test in list(tests):
                            
                                                            test_start_time = time.time()  # will use in case of a failure in context of this loop
                            
                            
                            Severity: Major
                            Found in test_junkie/runner.py - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language