tensorflow/models

View on GitHub
official/vision/dataloaders/tf_example_label_map_decoder_test.py

Summary

Maintainability
C
1 day
Test Coverage

Function test_result_content has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_result_content(self):
    label_map_dir = self.get_temp_dir()
    label_map_name = 'label_map.csv'
    label_map_path = os.path.join(label_map_dir, label_map_name)
    with open(label_map_path, 'w') as f:
Severity: Minor
Found in official/vision/dataloaders/tf_example_label_map_decoder_test.py - About 1 hr to fix

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

        image_content = [[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
                         [[0, 0, 0], [255, 255, 255], [255, 255, 255], [0, 0, 0]],
                         [[0, 0, 0], [255, 255, 255], [255, 255, 255], [0, 0, 0]],
                         [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]]
    official/vision/dataloaders/tf_example_decoder_test.py on lines 84..87
    official/vision/dataloaders/tf_example_decoder_test.py on lines 212..215

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

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

        mask_content = [[[255, 255, 0, 0],
                         [255, 255, 0, 0],
                         [0, 0, 0, 0],
                         [0, 0, 0, 0]],
                        [[0, 255, 255, 255],
    official/vision/dataloaders/tf_example_decoder_test.py on lines 103..110
    official/vision/dataloaders/tf_example_decoder_test.py on lines 225..232
    research/object_detection/core/batch_multiclass_nms_test.py on lines 453..460
    research/object_detection/core/batch_multiclass_nms_test.py on lines 528..535
    research/object_detection/core/target_assigner_test.py on lines 534..541
    research/object_detection/core/target_assigner_test.py on lines 583..590
    research/object_detection/core/target_assigner_test.py on lines 591..598
    research/object_detection/core/target_assigner_test.py on lines 599..606
    research/object_detection/core/target_assigner_test.py on lines 658..665
    research/object_detection/core/target_assigner_test.py on lines 666..673
    research/object_detection/core/target_assigner_test.py on lines 674..681
    research/object_detection/core/target_assigner_test.py on lines 763..770
    research/object_detection/core/target_assigner_test.py on lines 970..977
    research/object_detection/core/target_assigner_test.py on lines 1025..1032
    research/object_detection/core/target_assigner_test.py on lines 1033..1040
    research/object_detection/core/target_assigner_test.py on lines 1041..1048
    research/object_detection/core/target_assigner_test.py on lines 1107..1114
    research/object_detection/core/target_assigner_test.py on lines 1115..1122
    research/object_detection/core/target_assigner_test.py on lines 1123..1130
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1069..1072
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1159..1162
    research/object_detection/meta_architectures/ssd_meta_arch_test.py on lines 251..254
    research/object_detection/meta_architectures/ssd_meta_arch_test.py on lines 290..301

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

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

        self.assertNDArrayNear(
            [0.25 * image_height * image_width, 0.75 * image_height * image_width],
            results['groundtruth_area'], 1e-4)
    official/vision/dataloaders/tf_example_decoder_test.py on lines 198..200
    official/vision/dataloaders/tf_example_decoder_test.py on lines 289..291

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

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

        masks = [
            tfexample_utils.encode_image(np.uint8(m), fmt='PNG')
            for m in list(mask_content)
    official/vision/dataloaders/tf_example_decoder_test.py on lines 111..113
    official/vision/dataloaders/tf_example_decoder_test.py on lines 233..235

    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

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

        areas = [
            0.25 * image_height * image_width, 0.75 * image_height * image_width
    official/vision/dataloaders/tf_example_decoder_test.py on lines 99..100

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

    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