Shoobx/shoobx.junitxml

View on GitHub

Showing 16 of 16 total issues

Function writeXMLReports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def writeXMLReports(self, properties=None):
        testSuiteNode = lxml.etree.Element(
            'testsuite',
            tests=str(self.testSuite.tests),
            errors=str(self.testSuite.errors),
Severity: Minor
Found in src/shoobx/junitxml/formatter.py - About 2 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

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

    def stop_tear_down(self, seconds):
        layer_name = self._last_layer
        self._last_layer = None
        if self.outputSetupTeardown:
            self._record('%s:tearDown' % (layer_name,), seconds)
Severity: Major
Found in src/shoobx/junitxml/formatter.py and 1 other location - About 2 hrs to fix
src/shoobx/junitxml/formatter.py on lines 221..226

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

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

    def stop_set_up(self, seconds):
        layer_name = self._last_layer
        self._last_layer = None
        if self.outputSetupTeardown:
            self._record('%s:setUp' % (layer_name,), seconds)
Severity: Major
Found in src/shoobx/junitxml/formatter.py and 1 other location - About 2 hrs to fix
src/shoobx/junitxml/formatter.py on lines 233..238

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

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

File formatter.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

###############################################################################
#
# Copyright 2017 by Plone Foundation and Shoobx, Inc.
#
###############################################################################
Severity: Minor
Found in src/shoobx/junitxml/formatter.py - About 2 hrs to fix

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

        def test_failure(self, test, seconds, exc_info, stdout=None, stderr=None):
            self._record(test, seconds, failure=exc_info)
            return self.delegate.test_failure(test, seconds, exc_info,
    Severity: Major
    Found in src/shoobx/junitxml/formatter.py and 1 other location - About 1 hr to fix
    src/shoobx/junitxml/formatter.py on lines 197..199

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

    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

        def test_error(self, test, seconds, exc_info, stdout=None, stderr=None):
            self._record(test, seconds, error=exc_info)
            return self.delegate.test_error(test, seconds, exc_info,
    Severity: Major
    Found in src/shoobx/junitxml/formatter.py and 1 other location - About 1 hr to fix
    src/shoobx/junitxml/formatter.py on lines 192..194

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

    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

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

    def filename_to_suite_name_parts(filename):
        # lop off whatever portion of the path we have in common
        # with the current working directory; crude, but about as
        # much as we can do :(
        filenameParts = filename.split(os.path.sep)
    Severity: Minor
    Found in src/shoobx/junitxml/formatter.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

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

                    try:
                        excType, excInstance, tb = testCase.error
                        errorMessage = str(excInstance)
                        stackTrace = ''.join(traceback.format_tb(tb))
    Severity: Major
    Found in src/shoobx/junitxml/formatter.py and 1 other location - About 1 hr to fix
    src/shoobx/junitxml/formatter.py on lines 322..325

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

    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

                    try:
                        excType, excInstance, tb = testCase.failure
                        errorMessage = str(excInstance)
                        stackTrace = ''.join(traceback.format_tb(tb))
    Severity: Major
    Found in src/shoobx/junitxml/formatter.py and 1 other location - About 1 hr to fix
    src/shoobx/junitxml/formatter.py on lines 305..308

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

    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

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, test, time, testClassName, testName, failure=None,
    Severity: Major
    Found in src/shoobx/junitxml/formatter.py - About 50 mins to fix

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

          def test_error(self, test, seconds, exc_info, stdout=None, stderr=None):
      Severity: Minor
      Found in src/shoobx/junitxml/formatter.py - About 35 mins to fix

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

            def test_failure(self, test, seconds, exc_info, stdout=None, stderr=None):
        Severity: Minor
        Found in src/shoobx/junitxml/formatter.py - About 35 mins to fix

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

              def _record(self, test, seconds, failure=None, error=None,
          Severity: Minor
          Found in src/shoobx/junitxml/formatter.py - About 35 mins to fix

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

                def _record(self, test, seconds, failure=None, error=None,
                            extraData=None):
                    for parser in [parse_layer,
                                   parse_doc_file_case,
                                   parse_doc_test_case,
            Severity: Minor
            Found in src/shoobx/junitxml/formatter.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

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

                            errorNode.attrib.update({
                                'message': errorMessage.split('\n')[0],
                                'type': str(excType)
            Severity: Minor
            Found in src/shoobx/junitxml/formatter.py and 1 other location - About 35 mins to fix
            src/shoobx/junitxml/formatter.py on lines 332..334

            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

                            failureNode.attrib.update({
                                'message': errorMessage.split('\n')[0],
                                'type': str(excType)
            Severity: Minor
            Found in src/shoobx/junitxml/formatter.py and 1 other location - About 35 mins to fix
            src/shoobx/junitxml/formatter.py on lines 311..313

            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

            Severity
            Category
            Status
            Source
            Language