ArturSpirin/test_junkie

View on GitHub
test_junkie/parallels.py

Summary

Maintainability
B
4 hrs
Test Coverage

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

    Function run_test_in_a_thread has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Wontfix

        def run_test_in_a_thread(func, suite, test, parameter, class_parameter, before_class_error, cancel):
    Severity: Minor
    Found in test_junkie/parallels.py - About 45 mins to fix

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

          def suite_qualifies(self, suite):
      Severity: Critical
      Found in test_junkie/parallels.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 49 to the 15 allowed.
      Open

          def test_qualifies(self, test):
      Severity: Critical
      Found in test_junkie/parallels.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 ParallelProcessor.__PARALLELS[reverse_suite]["thread"].is_alive():
      Severity: Major
      Found in test_junkie/parallels.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:
          # ...
      

      Merge this if statement with the enclosing one.
      Open

                      if ParallelProcessor.__PARALLELS[restriction]["thread"].is_alive():
      Severity: Major
      Found in test_junkie/parallels.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:
          # ...
      

      Merge this if statement with the enclosing one.
      Open

                              if test_mapping["thread"].is_alive():
      Severity: Major
      Found in test_junkie/parallels.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:
          # ...
      

      Merge this if statement with the enclosing one.
      Open

                                  if test_mapping["thread"].is_alive():
      Severity: Major
      Found in test_junkie/parallels.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:
          # ...
      

      Remove this commented out code.
      Open

              # self.__test_limit = int(kwargs.get("test_multithreading_limit", 1))
      Severity: Major
      Found in test_junkie/parallels.py by sonar-python

      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"

      Remove this commented out code.
      Open

              # self.__suite_limit = int(kwargs.get("suite_multithreading_limit", 1))
      Severity: Major
      Found in test_junkie/parallels.py by sonar-python

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

              def _build_reverse_restriction():
                  """
                  Bidirectional parallel restriction will be automatically added.
                  If suite `A` is restricted to run when suite `B` is running - suite `B` will be automatically restricted
                  to run when suite `A` is running
      Severity: Major
      Found in test_junkie/parallels.py and 1 other location - About 6 hrs to fix
      test_junkie/parallels.py on lines 99..113

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

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

              def _build_reverse_restriction():
                  """
                  Bidirectional parallel restriction will be automatically added.
                  If suite `A` is restricted to run when suite `B` is running - suite `B` will be automatically restricted
                  to run when suite `A` is running
      Severity: Major
      Found in test_junkie/parallels.py and 1 other location - About 6 hrs to fix
      test_junkie/parallels.py on lines 161..175

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

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

                      for reverse_suite in reverse_suites:
                          if ParallelProcessor.__PARALLELS.get(reverse_suite, None) is not None:
                              if ParallelProcessor.__PARALLELS[reverse_suite]["thread"].is_alive():
                                  LogJunkie.debug("Suite: {} can't run while: {} is running due to reverse restriction."
                                                  .format(suite.get_class_object(), reverse_suite))
      Severity: Major
      Found in test_junkie/parallels.py and 1 other location - About 3 hrs to fix
      test_junkie/parallels.py on lines 120..124

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

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

                  if ParallelProcessor.__PARALLELS.get(restriction, None) is not None:
                      if ParallelProcessor.__PARALLELS[restriction]["thread"].is_alive():
                          LogJunkie.debug("Suite: {} can't run while: {} is running."
                                          .format(suite.get_class_object(), restriction))
                          return False
      Severity: Major
      Found in test_junkie/parallels.py and 1 other location - About 3 hrs to fix
      test_junkie/parallels.py on lines 134..139

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

      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 self.__test_limit == 0 or self.__test_limit is None:
                  LogJunkie.warn("Thread limit for tests cannot be 0 or None, "
                                 "falling back to limit of 1 thread per test case.")
                  self.__test_limit = 1
      Severity: Major
      Found in test_junkie/parallels.py and 1 other location - About 1 hr to fix
      test_junkie/parallels.py on lines 25..28

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

      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 self.__suite_limit == 0 or self.__suite_limit is None:
                  LogJunkie.warn("Thread limit for suites cannot be 0 or None, "
                                 "falling back to limit of 1 thread per test suite.")
                  self.__suite_limit = 1
      Severity: Major
      Found in test_junkie/parallels.py and 1 other location - About 1 hr to fix
      test_junkie/parallels.py on lines 18..21

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

      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 active >= self.__suite_limit:
                  LogJunkie.debug("Suite limit: {}/{}".format(active, self.__suite_limit))
                  return True
      Severity: Minor
      Found in test_junkie/parallels.py and 1 other location - About 35 mins to fix
      test_junkie/parallels.py on lines 92..94

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

      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 active >= self.__test_limit:
                  LogJunkie.debug("Test limit: {}/{}".format(active, self.__test_limit))
                  return True
      Severity: Minor
      Found in test_junkie/parallels.py and 1 other location - About 35 mins to fix
      test_junkie/parallels.py on lines 78..80

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

      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