tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/distributions/laplace_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File laplace_test.py has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 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/kernel_tests/distributions/laplace_test.py - About 3 hrs to fix

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

      def testLaplaceSampleMultiDimensional(self):
        loc_v = np.array([np.arange(1, 101, dtype=np.float32)])  # 1 x 100
        scale_v = np.array([np.arange(1, 11, dtype=np.float32)]).T  # 10 x 1
        laplace = laplace_lib.Laplace(loc=loc_v, scale=scale_v)
        n = 10000
    Severity: Minor
    Found in tensorflow/python/kernel_tests/distributions/laplace_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

      def testLaplaceLogSurvivalFunction(self):
        batch_size = 6
        loc = constant_op.constant([2.0] * batch_size)
        scale = constant_op.constant([3.0] * batch_size)
        loc_v = 2.0
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 117..132
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 134..149

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

    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 testLaplaceLogCDF(self):
        batch_size = 6
        loc = constant_op.constant([2.0] * batch_size)
        scale = constant_op.constant([3.0] * batch_size)
        loc_v = 2.0
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 117..132
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 151..166

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

    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 testLaplaceCDF(self):
        batch_size = 6
        loc = constant_op.constant([2.0] * batch_size)
        scale = constant_op.constant([3.0] * batch_size)
        loc_v = 2.0
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 134..149
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 151..166

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

    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 testLaplaceNonPositiveInitializationParamsRaises(self):
        loc_v = constant_op.constant(0.0, name="loc")
        scale_v = constant_op.constant(-1.0, name="scale")
        with self.assertRaisesOpError("Condition x > 0 did not hold element-wise"):
          laplace = laplace_lib.Laplace(
    Severity: Major
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 1 day to fix
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 343..355

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

    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 _assertIntegral(self, sample_vals, pdf_vals, err=1e-3):
        s_p = zip(sample_vals, pdf_vals)
        prev = (0, 0)
        total = 0
        for k in sorted(s_p, key=lambda x: x[0]):
    Severity: Major
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 1 day to fix
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 333..341

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

    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 testLaplaceShape(self):
        loc = constant_op.constant([3.0] * 5)
        scale = constant_op.constant(11.0)
        laplace = laplace_lib.Laplace(loc=loc, scale=scale)
    
    
    Severity: Major
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 1 day to fix
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 48..56

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

    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 testLaplaceFullyReparameterized(self):
        loc = constant_op.constant(4.0)
        scale = constant_op.constant(3.0)
        with backprop.GradientTape() as tape:
          tape.watch(loc)
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 255..265
    tensorflow/python/kernel_tests/distributions/normal_test.py on lines 445..455

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

    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 testLaplaceEntropy(self):
        loc_v = np.array([1.0, 3.0, 2.5])
        scale_v = np.array([1.0, 4.0, 5.0])
        laplace = laplace_lib.Laplace(loc=loc_v, scale=scale_v)
        self.assertEqual(laplace.entropy().get_shape(), (3,))
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 168..176
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 185..193
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 195..203

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

    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 testLaplaceMean(self):
        loc_v = np.array([1.0, 3.0, 2.5])
        scale_v = np.array([1.0, 4.0, 5.0])
        laplace = laplace_lib.Laplace(loc=loc_v, scale=scale_v)
        self.assertEqual(laplace.mean().get_shape(), (3,))
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 185..193
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 195..203
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 205..213

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

    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 testLaplaceStd(self):
        loc_v = np.array([1.0, 3.0, 2.5])
        scale_v = np.array([1.0, 4.0, 5.0])
        laplace = laplace_lib.Laplace(loc=loc_v, scale=scale_v)
        self.assertEqual(laplace.stddev().get_shape(), (3,))
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 168..176
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 185..193
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 205..213

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

    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 testLaplaceVariance(self):
        loc_v = np.array([1.0, 3.0, 2.5])
        scale_v = np.array([1.0, 4.0, 5.0])
        laplace = laplace_lib.Laplace(loc=loc_v, scale=scale_v)
        self.assertEqual(laplace.variance().get_shape(), (3,))
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 168..176
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 195..203
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 205..213

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

    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

        for ai, a in enumerate(np.reshape(loc_v, [-1])):
          for bi, b in enumerate(np.reshape(scale_v, [-1])):
            s = sample_values[:, bi, ai]
            trials += 1
            fails += 0 if self._kstest(a, b, s) else 1
    Severity: Major
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 5 hrs to fix
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 293..297

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

    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

        self.assertAllClose(
            stats.laplace.var([[7., 11.], [7., 11.]],
                              scale=np.array([[5., 5.], [6., 6.]])),
            sample_vals.var(axis=0),
    Severity: Major
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 2 hrs to fix
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 307..310

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

    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

        self.assertAllClose(
            stats.laplace.mean(
                [[7., 11.], [7., 11.]], scale=np.array([[5., 5.], [6., 6.]])),
            sample_vals.mean(axis=0),
    Severity: Major
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 2 hrs to fix
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 313..316

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

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

    def try_import(name):  # pylint: disable=invalid-name
      module = None
      try:
        module = importlib.import_module(name)
      except ImportError as e:
    tensorflow/python/kernel_tests/distributions/bernoulli_test.py on lines 32..38
    tensorflow/python/kernel_tests/distributions/beta_test.py on lines 32..38
    tensorflow/python/kernel_tests/distributions/dirichlet_test.py on lines 31..37
    tensorflow/python/kernel_tests/distributions/exponential_test.py on lines 30..36
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 32..38
    tensorflow/python/kernel_tests/distributions/normal_test.py on lines 38..44
    tensorflow/python/kernel_tests/distributions/special_math_test.py on lines 35..41
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 33..39
    tensorflow/python/kernel_tests/distributions/uniform_test.py on lines 33..39
    tensorflow/python/kernel_tests/distributions/util_test.py on lines 39..45
    tensorflow/python/kernel_tests/signal/dct_ops_test.py on lines 31..37

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

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

        self._assertIntegral(sample_vals[:, 0, 0], pdf_vals[:, 0, 0], err=0.02)
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 316..316
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 317..317
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 318..318
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 319..319
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 302..302
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 303..303
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 304..304
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 454..454
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 455..455
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 456..456
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 457..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 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 12 locations. Consider refactoring.
    Open

        self._assertIntegral(sample_vals[:, 1, 1], pdf_vals[:, 1, 1], err=0.02)
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 316..316
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 317..317
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 318..318
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 319..319
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 301..301
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 302..302
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 303..303
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 454..454
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 455..455
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 456..456
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 457..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 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 12 locations. Consider refactoring.
    Open

        self._assertIntegral(sample_vals[:, 0, 1], pdf_vals[:, 0, 1], err=0.02)
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 316..316
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 317..317
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 318..318
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 319..319
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 301..301
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 303..303
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 304..304
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 454..454
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 455..455
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 456..456
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 457..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 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 12 locations. Consider refactoring.
    Open

        self._assertIntegral(sample_vals[:, 1, 0], pdf_vals[:, 1, 0], err=0.02)
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 316..316
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 317..317
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 318..318
    tensorflow/python/kernel_tests/distributions/gamma_test.py on lines 319..319
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 301..301
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 302..302
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 304..304
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 454..454
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 455..455
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 456..456
    tensorflow/python/kernel_tests/distributions/student_t_test.py on lines 457..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 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

        self.assertAllClose(
            sample_values.mean(axis=0),
            stats.laplace.mean(loc_bc, scale=scale_bc),
    Severity: Minor
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 55 mins to fix
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 271..273

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

    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

        self.assertAllClose(
            sample_values.var(axis=0),
            stats.laplace.var(loc_bc, scale=scale_bc),
    Severity: Minor
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 55 mins to fix
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 266..268

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

    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

        self.assertAllClose(
            sample_values.mean(),
            stats.laplace.mean(loc_v, scale=scale_v),
    Severity: Minor
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 35 mins to fix
    tensorflow/python/kernel_tests/distributions/laplace_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

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

        self.assertAllClose(
            sample_values.var(),
            stats.laplace.var(loc_v, scale=scale_v),
    Severity: Minor
    Found in tensorflow/python/kernel_tests/distributions/laplace_test.py and 1 other location - About 35 mins to fix
    tensorflow/python/kernel_tests/distributions/laplace_test.py on lines 228..230

    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

    There are no issues that match your filters.

    Category
    Status