tensorflow/models

View on GitHub
research/deeplab/core/xception_test.py

Summary

Maintainability
F
1 wk
Test Coverage

File xception_test.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Lint as: python2, python3
# Copyright 2018 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Severity: Minor
Found in research/deeplab/core/xception_test.py - About 6 hrs to fix

    Function _xception_small has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def _xception_small(self,
    Severity: Major
    Found in research/deeplab/core/xception_test.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                  if output_stride is None:
                    factor = 1
                  else:
                    factor = nominal_stride // output_stride
                  output = resnet_utils.subsample(output, factor)
      Severity: Major
      Found in research/deeplab/core/xception_test.py - About 45 mins to fix

        Function testUseBoundedAcitvation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def testUseBoundedAcitvation(self):
            global_pool = False
            num_classes = 3
            output_stride = 16
            for use_bounded_activation in (True, False):
        Severity: Minor
        Found in research/deeplab/core/xception_test.py - About 25 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 5 locations. Consider refactoring.
        Open

          def testAtrousFullyConvolutionalValues(self):
            """Verify dense feature extraction with atrous convolution."""
            nominal_stride = 32
            for output_stride in [4, 8, 16, 32, None]:
              with slim.arg_scope(xception.xception_arg_scope()):
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 4 other locations - About 2 days to fix
        research/deeplab/core/resnet_v1_beta_test.py on lines 228..258
        research/deeplab/core/resnet_v1_beta_test.py on lines 475..503
        research/slim/nets/resnet_v1_test.py on lines 468..492
        research/slim/nets/resnet_v2_test.py on lines 385..411

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

        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 3 locations. Consider refactoring.
        Open

          def testUnknownBatchSize(self):
            batch = 2
            height, width = 65, 65
            global_pool = True
            num_classes = 10
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 2 other locations - About 1 day to fix
        research/deeplab/core/resnet_v1_beta_test.py on lines 261..280
        research/deeplab/core/resnet_v1_beta_test.py on lines 506..524

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

        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 5 locations. Consider refactoring.
        Open

          def testAtrousFullyConvolutionalUnknownHeightWidth(self):
            batch = 2
            height, width = 65, 65
            global_pool = False
            output_stride = 8
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 4 other locations - About 1 day to fix
        research/deeplab/core/resnet_v1_beta_test.py on lines 300..318
        research/deeplab/core/resnet_v1_beta_test.py on lines 543..560
        research/slim/nets/resnet_v1_test.py on lines 530..547
        research/slim/nets/resnet_v2_test.py on lines 450..467

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

        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 5 locations. Consider refactoring.
        Open

          def testFullyConvolutionalUnknownHeightWidth(self):
            batch = 2
            height, width = 65, 65
            global_pool = False
            inputs = create_test_input(batch, None, None, 3)
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 4 other locations - About 1 day to fix
        research/deeplab/core/resnet_v1_beta_test.py on lines 282..298
        research/deeplab/core/resnet_v1_beta_test.py on lines 526..541
        research/slim/nets/resnet_v1_test.py on lines 515..528
        research/slim/nets/resnet_v2_test.py on lines 434..448

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

        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 6 locations. Consider refactoring.
        Open

          def testClassificationShapes(self):
            global_pool = True
            num_classes = 3
            inputs = create_test_input(2, 64, 64, 3)
            with slim.arg_scope(xception.xception_arg_scope()):
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 5 other locations - About 1 day to fix
        research/deeplab/core/resnet_v1_beta_test.py on lines 163..182
        research/deeplab/core/resnet_v1_beta_test.py on lines 184..203
        research/deeplab/core/resnet_v1_beta_test.py on lines 413..431
        research/deeplab/core/resnet_v1_beta_test.py on lines 433..451
        research/deeplab/core/xception_test.py on lines 319..338

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

        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 6 locations. Consider refactoring.
        Open

          def testFullyConvolutionalEndpointShapes(self):
            global_pool = False
            num_classes = 3
            inputs = create_test_input(2, 65, 65, 3)
            with slim.arg_scope(xception.xception_arg_scope()):
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 5 other locations - About 1 day to fix
        research/deeplab/core/resnet_v1_beta_test.py on lines 163..182
        research/deeplab/core/resnet_v1_beta_test.py on lines 184..203
        research/deeplab/core/resnet_v1_beta_test.py on lines 413..431
        research/deeplab/core/resnet_v1_beta_test.py on lines 433..451
        research/deeplab/core/xception_test.py on lines 298..317

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

        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

            with slim.arg_scope(xception.xception_arg_scope()):
              _, end_points = self._xception_small(
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 1 other location - About 1 hr to fix
        research/deeplab/core/xception_test.py on lines 219..220

        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

            with slim.arg_scope(xception.xception_arg_scope()):
              logits, end_points = self._xception_small(
        Severity: Major
        Found in research/deeplab/core/xception_test.py and 1 other location - About 1 hr to fix
        research/deeplab/core/xception_test.py on lines 239..240

        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

            with slim.arg_scope(xception.xception_arg_scope()):
              _, end_points0 = xception.xception_65(
        Severity: Minor
        Found in research/deeplab/core/xception_test.py and 1 other location - About 45 mins to fix
        research/deeplab/core/xception_test.py on lines 461..462

        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

            with slim.arg_scope(xception.xception_arg_scope()):
              _, end_points1 = xception.xception_65(
        Severity: Minor
        Found in research/deeplab/core/xception_test.py and 1 other location - About 45 mins to fix
        research/deeplab/core/xception_test.py on lines 456..457

        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