ArturSpirin/test_junkie

View on GitHub
test_junkie/cli/cli_runner.py

Summary

Maintainability
B
4 hrs
Test Coverage

File cli_runner.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import ast
import imp
import inspect
import os
import sys
Severity: Minor
Found in test_junkie/cli/cli_runner.py - About 2 hrs to fix

    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

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

          def __find_and_register_suite(self, _suite_alias, _source, _file_path):
      Severity: Critical
      Found in test_junkie/cli/cli_runner.py by sonar-python

      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 31 to the 15 allowed.
      Open

          def scan(self):
      Severity: Critical
      Found in test_junkie/cli/cli_runner.py by sonar-python

      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

      Merge this if statement with the enclosing one.
      Open

                          if not self.requested_suites or \
      Severity: Major
      Found in test_junkie/cli/cli_runner.py by sonar-python

      Merging collapsible if statements increases the code's readability.

      Noncompliant Code Example

      if condition1:
          if condition2:
              # ...
      

      Compliant Solution

      if condition1 and condition2:
          # ...
      

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

              except:
                  print("[{status}] Unexpected error during scan for test suites.".format(
                      status=CliUtils.format_color_string(value="ERROR", color="red")))
                  CliUtils.print_color_traceback()
                  exit(120)
      Severity: Minor
      Found in test_junkie/cli/cli_runner.py and 1 other location - About 55 mins to fix
      test_junkie/cli/cli_runner.py on lines 276..280

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

      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

                  except:
                      print("[{status}] Unexpected error during test execution.".format(
                            status=CliUtils.format_color_string(value="ERROR", color="red")))
                      CliUtils.print_color_traceback()
                      exit(120)
      Severity: Minor
      Found in test_junkie/cli/cli_runner.py and 1 other location - About 55 mins to fix
      test_junkie/cli/cli_runner.py on lines 239..243

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

      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

                  print("[{status}] Trying again with assumption that this is your project root: {assumed_root}"
                        .format(status=CliUtils.format_color_string(value="WARNING", color="yellow"),
                                assumed_root=CliUtils.format_color_string(value=possibility, color="yellow")))
      Severity: Minor
      Found in test_junkie/cli/cli_runner.py and 1 other location - About 50 mins to fix
      test_junkie/cli/cli_config.py on lines 15..17

      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

      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

      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

      There are no issues that match your filters.

      Category
      Status