tensorflow/models

View on GitHub
official/vision/ops/anchor_test.py

Summary

Maintainability
C
1 day
Test Coverage

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

  def testAnchorGeneration(self, min_level, max_level, num_scales,
Severity: Major
Found in official/vision/ops/anchor_test.py - About 50 mins to fix

    Function testAnchorGenerationAreCentered has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def testAnchorGenerationAreCentered(self, min_level, max_level, num_scales,
    Severity: Minor
    Found in official/vision/ops/anchor_test.py - About 45 mins to fix

      Function testLabelAnchors has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def testLabelAnchors(self, min_level, max_level, num_scales, aspect_ratios,
      Severity: Minor
      Found in official/vision/ops/anchor_test.py - About 45 mins to fix

        Function testAnchorGenerationWithImageSizeAsTensor has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def testAnchorGenerationWithImageSizeAsTensor(self,
        Severity: Minor
        Found in official/vision/ops/anchor_test.py - About 45 mins to fix

          Function testAnchorRpnSample has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def testAnchorRpnSample(self, num_anchors, num_positives,
          Severity: Minor
          Found in official/vision/ops/anchor_test.py - About 45 mins to fix

            Function testEquivalentResult has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def testEquivalentResult(self, min_level, max_level, aspect_ratios,
            Severity: Minor
            Found in official/vision/ops/anchor_test.py - About 45 mins to fix

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

                def testLabelAnchors(self, min_level, max_level, num_scales, aspect_ratios,
                                     anchor_size, has_attribute):
                  input_size = [512, 512]
                  ground_truth_class_id = 2
                  attribute_name = 'depth'
              Severity: Minor
              Found in official/vision/ops/anchor_test.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 3 locations. Consider refactoring.
              Open

                     {'5': [[[-16, -16, 48, 48], [-16, 16, 48, 80]],
                            [[16, -16, 80, 48], [16, 16, 80, 80]]],
                      '6': [[[-32, -32, 96, 96]]]}),
              Severity: Major
              Found in official/vision/ops/anchor_test.py and 2 other locations - About 1 hr to fix
              official/vision/ops/anchor_generator_test.py on lines 114..117
              official/vision/ops/anchor_test.py on lines 101..103

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

              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

                     {'5': [[[-16, -16, 48, 48], [-16, 16, 48, 80]],
                            [[16, -16, 80, 48], [16, 16, 80, 80]]],
                      '6': [[[-32, -32, 96, 96]]]}),
              Severity: Major
              Found in official/vision/ops/anchor_test.py and 2 other locations - About 1 hr to fix
              official/vision/ops/anchor_generator_test.py on lines 114..117
              official/vision/ops/anchor_test.py on lines 67..69

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

              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

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

                     {'5': [[[-16, -16, 48, 48], [-16, 16, 48, 80]],
                            [[16, -16, 80, 48], [16, 16, 80, 80]]]}),
              Severity: Minor
              Found in official/vision/ops/anchor_test.py and 1 other location - About 40 mins to fix
              official/vision/ops/anchor_test.py on lines 97..98

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

              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

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

                     {'5': [[[-16, -16, 48, 48], [-16, 16, 48, 80]],
                            [[16, -16, 80, 48], [16, 16, 80, 80]]]}),
              Severity: Minor
              Found in official/vision/ops/anchor_test.py and 1 other location - About 40 mins to fix
              official/vision/ops/anchor_test.py on lines 63..64

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

              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

                    (5, 5, 1, [1.0], 1.0, [64, 32],
                     {'5': [[[0, 0, 32, 32]],
                            [[32, 0, 64, 32]]]}),
              Severity: Minor
              Found in official/vision/ops/anchor_test.py and 1 other location - About 40 mins to fix
              official/vision/ops/anchor_test.py on lines 83..85

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

              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

                    (5, 5, 1, [1.0], 1.0, [40, 32],
                     {'5': [[[-6, 0, 26, 32]],
                            [[14, 0, 46, 32]]]}),
              Severity: Minor
              Found in official/vision/ops/anchor_test.py and 1 other location - About 40 mins to fix
              official/vision/ops/anchor_test.py on lines 79..81

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

              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