hackedteam/vector-edk

View on GitHub
vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py

Summary

Maintainability
F
2 mos
Test Coverage

File case.py has 857 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Test case implementation"""

import collections
import sys
import functools
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 2 days to fix

    TestCase has 58 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TestCase(object):
        """A class whose instances are single test cases.
    
        By default, the test code itself should be placed in a method named
        'runTest'.
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 1 day to fix

      Function assertSequenceEqual has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None):
              """An equality assertion for ordered sequences (like lists and tuples).
      
              For the purposes of this function, a valid ordered sequence type is one
              which can be indexed, has a length, and has an equality operator.
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 6 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 run has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, result=None):
              orig_result = result
              if result is None:
                  result = self.defaultTestResult()
                  startTestRun = getattr(result, 'startTestRun', None)
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 4 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 assertSetEqual has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def assertSetEqual(self, set1, set2, msg=None):
              """A set-specific equality assertion.
      
              Args:
                  set1: The first set to compare.
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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

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

          def assertAlmostEqual(self, first, second, places=None, msg=None, delta=None):
              """Fail if the two objects are unequal as determined by their
                 difference rounded to the given number of decimal places
                 (default 7) and comparing to zero, or by comparing that the
                 between the two objects is more than the given delta.
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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

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

          def assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None):
              """Fail if the two objects are equal as determined by their
                 difference rounded to the given number of decimal places
                 (default 7) and comparing to zero, or by comparing that the
                 between the two objects is less than the given delta.
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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

      Function assertDictContainsSubset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def assertDictContainsSubset(self, expected, actual, msg=None):
              """Checks whether actual is a superset of expected."""
              missing = []
              mismatched = []
              for key, value in expected.iteritems():
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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

      Function assertRaisesRegexp has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def assertRaisesRegexp(self, expected_exception, expected_regexp,
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 35 mins to fix

        Function assertNotAlmostEqual has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None):
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 35 mins to fix

          Function assertAlmostEqual has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def assertAlmostEqual(self, first, second, places=None, msg=None, delta=None):
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py - About 35 mins to fix

            Function assertItemsEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def assertItemsEqual(self, expected_seq, actual_seq, msg=None):
                    """An unordered sequence specific comparison. It asserts that
                    actual_seq and expected_seq have the same element counts.
                    Equivalent to::
            
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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 assertMultiLineEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def assertMultiLineEqual(self, first, second, msg=None):
                    """Assert that two multi-line strings are equal."""
                    self.assertIsInstance(first, basestring,
                            'First argument is not a string')
                    self.assertIsInstance(second, basestring,
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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 __exit__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def __exit__(self, exc_type, exc_value, tb):
                    if exc_type is None:
                        try:
                            exc_name = self.expected.__name__
                        except AttributeError:
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.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

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

            Severity: Major
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/unittest/case.py and 1 other location - About 2 mos to fix
            AppPkg/Applications/Python/Python-2.7.2/Lib/unittest/case.py on lines 0..1070

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

            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