tensorflow/tensorflow

View on GitHub
tensorflow/python/distribute/metrics_v1_test.py

Summary

Maintainability
F
1 wk
Test Coverage

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

# 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.
# You may obtain a copy of the License at
Severity: Minor
Found in tensorflow/python/distribute/metrics_v1_test.py - About 3 hrs to fix

    MetricsV1Test has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MetricsV1Test(test.TestCase, parameterized.TestCase):
    
      def _test_metric(self, distribution, dataset_fn, metric_fn, expected_fn):
        with ops.Graph().as_default(), distribution.scope():
          iterator = distribution.make_input_fn_iterator(lambda _: dataset_fn())
    Severity: Minor
    Found in tensorflow/python/distribute/metrics_v1_test.py - About 2 hrs to fix

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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testTrueNegativesAtThresholds(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 4 other locations - About 7 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 260..271
      tensorflow/python/distribute/metrics_v1_test.py on lines 312..323
      tensorflow/python/distribute/metrics_v1_test.py on lines 338..349
      tensorflow/python/distribute/metrics_v1_test.py on lines 364..375

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testFalseNegativesAtThresholds(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 4 other locations - About 7 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 286..297
      tensorflow/python/distribute/metrics_v1_test.py on lines 312..323
      tensorflow/python/distribute/metrics_v1_test.py on lines 338..349
      tensorflow/python/distribute/metrics_v1_test.py on lines 364..375

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testPrecisionAtThreshold(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 4 other locations - About 7 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 260..271
      tensorflow/python/distribute/metrics_v1_test.py on lines 286..297
      tensorflow/python/distribute/metrics_v1_test.py on lines 312..323
      tensorflow/python/distribute/metrics_v1_test.py on lines 338..349

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testTruePositivesAtThresholds(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 4 other locations - About 7 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 260..271
      tensorflow/python/distribute/metrics_v1_test.py on lines 286..297
      tensorflow/python/distribute/metrics_v1_test.py on lines 312..323
      tensorflow/python/distribute/metrics_v1_test.py on lines 364..375

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testFalsePositivesAtThresholds(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 4 other locations - About 7 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 260..271
      tensorflow/python/distribute/metrics_v1_test.py on lines 286..297
      tensorflow/python/distribute/metrics_v1_test.py on lines 338..349
      tensorflow/python/distribute/metrics_v1_test.py on lines 364..375

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testRecall(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 403..414

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testMeanSquaredError(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 377..388

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testPrecision(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 5 other locations - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 247..258
      tensorflow/python/distribute/metrics_v1_test.py on lines 273..284
      tensorflow/python/distribute/metrics_v1_test.py on lines 299..310
      tensorflow/python/distribute/metrics_v1_test.py on lines 325..336
      tensorflow/python/distribute/metrics_v1_test.py on lines 416..427

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testTruePositives(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 5 other locations - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 247..258
      tensorflow/python/distribute/metrics_v1_test.py on lines 273..284
      tensorflow/python/distribute/metrics_v1_test.py on lines 299..310
      tensorflow/python/distribute/metrics_v1_test.py on lines 351..362
      tensorflow/python/distribute/metrics_v1_test.py on lines 416..427

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testTrueNegatives(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 5 other locations - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 247..258
      tensorflow/python/distribute/metrics_v1_test.py on lines 299..310
      tensorflow/python/distribute/metrics_v1_test.py on lines 325..336
      tensorflow/python/distribute/metrics_v1_test.py on lines 351..362
      tensorflow/python/distribute/metrics_v1_test.py on lines 416..427

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testRootMeanSquaredError(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 5 other locations - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 247..258
      tensorflow/python/distribute/metrics_v1_test.py on lines 273..284
      tensorflow/python/distribute/metrics_v1_test.py on lines 299..310
      tensorflow/python/distribute/metrics_v1_test.py on lines 325..336
      tensorflow/python/distribute/metrics_v1_test.py on lines 351..362

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testFalsePositives(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 5 other locations - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 247..258
      tensorflow/python/distribute/metrics_v1_test.py on lines 273..284
      tensorflow/python/distribute/metrics_v1_test.py on lines 325..336
      tensorflow/python/distribute/metrics_v1_test.py on lines 351..362
      tensorflow/python/distribute/metrics_v1_test.py on lines 416..427

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

      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

        @combinations.generate(all_combinations() + tpu_combinations())
        def testFalseNegatives(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 5 other locations - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 273..284
      tensorflow/python/distribute/metrics_v1_test.py on lines 299..310
      tensorflow/python/distribute/metrics_v1_test.py on lines 325..336
      tensorflow/python/distribute/metrics_v1_test.py on lines 351..362
      tensorflow/python/distribute/metrics_v1_test.py on lines 416..427

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

      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

        @combinations.generate(all_combinations())
        def testSpecificityAtSensitivity(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 429..440

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

      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

        @combinations.generate(all_combinations())
        def testSensitivityAtSpecificity(self, distribution):
          def _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 442..453

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

      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 _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
            return metrics.auc(labels, predictions, num_thresholds=8, curve="ROC",
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 235..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 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 _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
            return metrics.auc(labels, predictions, num_thresholds=8, curve="PR",
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 221..224

      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 _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
            return metrics.mean_iou(
                labels, predictions, num_classes=5)
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 165..169

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

      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 _metric_fn(x):
            labels = x["labels"]
            predictions = x["predictions"]
            return metrics.mean_per_class_accuracy(
                labels, predictions, num_classes=5)
      Severity: Major
      Found in tensorflow/python/distribute/metrics_v1_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/distribute/metrics_v1_test.py on lines 184..188

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

      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