tensorflow/models

View on GitHub
research/object_detection/utils/shape_utils_test.py

Summary

Maintainability
D
2 days
Test Coverage

File shape_utils_test.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2017 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.
# You may obtain a copy of the License at
Severity: Minor
Found in research/object_detection/utils/shape_utils_test.py - About 3 hrs to fix

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

      def test_unequal_static_shape_raises_exception(self):
        shape_a = tf.constant(np.zeros([4, 2, 2, 1]))
        shape_b = tf.constant(np.zeros([4, 2, 3, 1]))
        self.assertRaisesRegex(
            ValueError, 'Unequal shapes',
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 1 other location - About 4 hrs to fix
    research/object_detection/utils/shape_utils_test.py on lines 318..326

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

    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_unequal_static_shape_along_first_dim_raises_exception(self):
        shape_a = tf.constant(np.zeros([4, 2, 2, 1]))
        shape_b = tf.constant(np.zeros([6, 2, 3, 1]))
    
        self.assertRaisesRegexp(
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 1 other location - About 4 hrs to fix
    research/object_detection/utils/shape_utils_test.py on lines 269..276

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

    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

          inputs = tf.constant(
              [
                  [[1, 2], [3, 4]],
                  [[5, 6], [7, 8]],
                  [[9, 10], [11, 12]]
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 5 other locations - About 1 hr to fix
    research/object_detection/core/preprocessor_test.py on lines 1726..1730
    research/object_detection/metrics/coco_tools_test.py on lines 217..220
    research/object_detection/metrics/coco_tools_test.py on lines 240..243
    research/object_detection/metrics/lvis_tools_test.py on lines 102..105
    research/object_detection/metrics/lvis_tools_test.py on lines 125..128

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

        def graph_fn(tensor_a, tensor_b):
          shape_utils.assert_shape_equal(
              shape_utils.combined_static_and_dynamic_shape(tensor_a),
              shape_utils.combined_static_and_dynamic_shape(tensor_b)
          )
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 3 other locations - About 1 hr to fix
    research/object_detection/utils/shape_utils_test.py on lines 295..299
    research/object_detection/utils/shape_utils_test.py on lines 343..348
    research/object_detection/utils/shape_utils_test.py on lines 356..360

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

        def graph_fn(tensor_a, tensor_b):
          shape_utils.assert_shape_equal(
              shape_utils.combined_static_and_dynamic_shape(tensor_a),
              shape_utils.combined_static_and_dynamic_shape(tensor_b))
          return tf.constant(0)
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 3 other locations - About 1 hr to fix
    research/object_detection/utils/shape_utils_test.py on lines 307..313
    research/object_detection/utils/shape_utils_test.py on lines 343..348
    research/object_detection/utils/shape_utils_test.py on lines 356..360

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

        def graph_fn(tensor_a, tensor_b):
          shape_utils.assert_shape_equal_along_first_dimension(
              shape_utils.combined_static_and_dynamic_shape(tensor_a),
              shape_utils.combined_static_and_dynamic_shape(tensor_b))
          return tf.constant(0)
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 3 other locations - About 1 hr to fix
    research/object_detection/utils/shape_utils_test.py on lines 295..299
    research/object_detection/utils/shape_utils_test.py on lines 307..313
    research/object_detection/utils/shape_utils_test.py on lines 343..348

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

        def graph_fn(tensor_a, tensor_b):
          shape_utils.assert_shape_equal_along_first_dimension(
              shape_utils.combined_static_and_dynamic_shape(tensor_a),
              shape_utils.combined_static_and_dynamic_shape(tensor_b))
    
    
    Severity: Major
    Found in research/object_detection/utils/shape_utils_test.py and 3 other locations - About 1 hr to fix
    research/object_detection/utils/shape_utils_test.py on lines 295..299
    research/object_detection/utils/shape_utils_test.py on lines 307..313
    research/object_detection/utils/shape_utils_test.py on lines 356..360

    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

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

        def fn(elems):
          input_tensor, scalar_index_tensor = elems
          return tf.reshape(tf.slice(input_tensor, scalar_index_tensor, [1]), [])
    Severity: Minor
    Found in research/object_detection/utils/shape_utils_test.py and 1 other location - About 40 mins to fix
    research/object_detection/utils/shape_utils_test.py on lines 218..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 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

        def fn(elems):
          input_tensor, scalar_index_tensor = elems
          return tf.reshape(tf.slice(input_tensor, scalar_index_tensor, [1]), [])
    Severity: Minor
    Found in research/object_detection/utils/shape_utils_test.py and 1 other location - About 40 mins to fix
    research/object_detection/utils/shape_utils_test.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 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