tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py

Summary

Maintainability
F
2 mos
Test Coverage

File cwise_ops_test.py has 1143 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2015 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: Major
Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 2 days to fix

    Function testScalarCompareScalar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def testScalarCompareScalar(self):
        dtypes = [np.float16, np.float32, np.float64, np.int32, np.int64]
        data = [-1, 0, 1]
        for t in dtypes:
          for x in data:
    Severity: Minor
    Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 1 hr 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

    Function testSqrt has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def testSqrt(self):
        for dtype in [np.float16, np.float32, np.float64]:
          fi = np.finfo(dtype)
          for size in [1, 3, 4, 7, 8, 63, 64, 65]:
            # For float32 Eigen uses Carmack's fast vectorized sqrt algorithm.
    Severity: Minor
    Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 1 hr 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

    Function testScalarBroadcast has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def testScalarBroadcast(self):
        c = True
        # where_v2 only
        x = np.random.rand(1, 3, 2) * 100
        y = np.random.rand(1, 1, 1) * 100
    Severity: Minor
    Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 1 hr to fix

      Function _testNan has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def _testNan(self, fn):
          with self.cached_session():
            for c in False, True:
              for a in 7.0, np.nan:
                for b in 5.0, np.nan:
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 1 hr 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

      Function testOverload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def testOverload(self):
          dtypes = [
              dtypes_lib.float16,
              dtypes_lib.float32,
              dtypes_lib.float64,
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 1 hr 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

      Avoid deeply nested control flow statements.
      Open

                  with test_util.use_gpu():
                    tf_y = math_ops.sqrt(x)
                    tf_nan = math_ops.is_nan(tf_y)
                    if value < 0:
                      self.assertAllEqual(np_nan, self.evaluate(tf_nan))
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    with self.subTest(c=c, a=a, b=b):
                      x = fn(c, a, b).eval()
                      y = a if c else b
                      self.assertEqual(np.isnan(x), np.isnan(y))
        
        
        Severity: Major
        Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 45 mins to fix

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

            def _compareGradientX(self,
          Severity: Minor
          Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 45 mins to fix

            Function testScalar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def testScalar(self):
                data = [np.array([True]), np.array([False])]
                for use_gpu in [True, False]:
                  for x in data:
                    with self.subTest(use_gpu=use_gpu, x=x):
            Severity: Minor
            Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 45 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

            Function _compareBinary has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def _compareBinary(self, x, y, np_func, tf_func, use_gpu=False):
            Severity: Minor
            Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 35 mins to fix

              Function _compareGradientY has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def _compareGradientY(self, fn, c, x, y, numeric_gradient_type=None):
              Severity: Minor
              Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 35 mins to fix

                Function _compareBCast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def _compareBCast(self, xs, ys, dtype, np_func, tf_func):
                Severity: Minor
                Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 35 mins to fix

                  Function _compare has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def _compare(self, fn, c, x, y, use_gpu):
                  Severity: Minor
                  Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 35 mins to fix

                    Function _compareBinary has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def _compareBinary(self, x, y, dtype, np_func, tf_func):
                    Severity: Minor
                    Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 35 mins to fix

                      Function _compareGradientX has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def _compareGradientX(self,
                                              fn,
                                              c,
                                              x,
                                              y,
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py - About 25 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

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

                        def testScalarBroadcast(self):
                          c = True
                          # where_v2 only
                          x = np.random.rand(1, 3, 2) * 100
                          y = np.random.rand(1, 1, 1) * 100
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 days to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5230..5260

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

                      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

                            with self.subTest(c=c):
                              x = np.random.rand(1, 3, 2) * 100
                              y = np.random.rand(1, 1, 1) * 100
                              self._testBasicBroadcast(array_ops.where_v2, c, x, y)
                              self._testBasicBroadcast(array_ops.where_v2, c, y, x)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 days to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5298..5327

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

                      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

                            with self.subTest(t=t):
                              x = np.random.rand(1, 3, 2) * 100
                              y = np.random.rand(1, 1, 1) * 100
                              self._compareGradientX(array_ops.where_v2, c, x.astype(t), y.astype(t))
                              x = np.random.rand(1, 3, 2) * 100
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 days to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5356..5378

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

                      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 _compareGradientX(self,
                                              fn,
                                              c,
                                              x,
                                              y,
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 3 days to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5133..5163

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

                      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 _compareGradientY(self, fn, c, x, y, numeric_gradient_type=None):
                          with self.cached_session():
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                            out = fn(c, inx, iny)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 2 days to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5165..5189

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

                      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 _compareGradientX(self, c, x, y, numeric_gradient_type=None):
                          with self.cached_session():
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                            out = array_ops.where(c, inx, iny)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 2 days to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 668..690

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

                      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 _compareGradientY(self, c, x, y, numeric_gradient_type=None):
                          with self.cached_session():
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                            out = array_ops.where(c, inx, iny)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 2 days to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 644..666

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

                      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 testAngle(self):
                          mag = np.random.rand(10).astype(np.float32)
                          angle = (2 * np.pi * np.arange(10) / 10.).astype(np.float32)
                          cplx = mag * np.exp(1j * angle)
                          cplx = np.append(cplx, [1., 1.j, -1., -1.j])
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1150..1159

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

                      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 testAngle64(self):
                          mag = np.random.rand(10).astype(np.float64)
                          angle = (2 * np.pi * np.arange(10) / 100.).astype(np.float64)
                          cplx = mag * np.exp(1j * angle)
                          cplx = np.append(cplx, [1., 1.j, -1., -1.j])
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1139..1148

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

                      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 _compareGradientX(self, func, x, y):
                          with self.cached_session():
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                            out = func(inx, iny)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 811..824
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5009..5023
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5025..5039

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

                      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 _compareGradientY(self, func, x, y):
                          with self.cached_session():
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                            out = func(inx, iny)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 796..809
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5009..5023
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5025..5039

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

                      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

                                with self.subTest(t=t, x=x, y=y):
                                  self.assertEqual(self._compareScalar(math_ops.less, x, y, t), x < y)
                                  self.assertEqual(
                                      self._compareScalar(math_ops.less_equal, x, y, t), x <= y)
                                  self.assertEqual(
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 925..935

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

                      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 _testEmptyTensor(self, fn):
                          c = np.random.randint(0, 3, 0).astype(np.bool_).reshape(1, 3, 0)  # pylint: disable=too-many-function-args
                          x = np.random.rand(1, 3, 0) * 100
                          y = np.random.rand(1, 3, 0) * 100
                          z_expected = np.zeros((1, 3, 0), dtype=np.float32)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5403..5412

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

                      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 _compareBCast(self, xs, ys, dtype, np_func, tf_func):
                          x = np.linspace(-15, 15, np.prod(xs)).astype(dtype).reshape(xs)
                          y = np.linspace(20, -10, np.prod(ys)).astype(dtype).reshape(ys)
                          if dtype in (np.complex64, np.complex128):
                            x -= 1j * x
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 972..979

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

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

                          shapes = [
                              ([1, 3, 2], [1]),
                              ([1, 3, 2], [2]),
                              ([1, 3, 2], [3, 2]),
                              ([1, 3, 2], [3, 1]),
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 982..993
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 270..281
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2654..2665

                      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

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

                          shapes = [
                              ([1, 3, 2], [1]),
                              ([1, 3, 2], [2]),
                              ([1, 3, 2], [3, 2]),
                              ([1, 3, 2], [3, 1]),
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 982..993
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 158..169
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2654..2665

                      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

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

                        def _compare(self, x, y, use_gpu):
                          np_min, np_max = np.minimum(x, y), np.maximum(x, y)
                          with test_util.device(use_gpu=use_gpu):
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 4977..4985

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

                      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 _testScalarBroadcast(self, fn, c, x, y):
                          for t in [
                              np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
                              np.complex128
                          ]:
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 477..487

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

                      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 _testBasicBroadcast(self, fn, c, x, y):
                          for t in [
                              np.float16, np.float32, np.float64, np.int32, np.int64, np.complex64,
                              np.complex128
                          ]:
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 day to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 414..424

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

                      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 testRealImag128(self):
                          real = (np.arange(-3, 3) / 4.).reshape([1, 3, 2]).astype(np.float64)
                          imag = (np.arange(-3, 3) / 5.).reshape([1, 3, 2]).astype(np.float64)
                          cplx = real + 1j * imag
                          self._compareRealImag(cplx, use_gpu=False)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 7 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1114..1119
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1179..1184
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1186..1191

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

                      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 testConj128(self):
                          real = (np.arange(-3, 3) / 4.).reshape([1, 3, 2]).astype(np.float64)
                          imag = (np.arange(-3, 3) / 5.).reshape([1, 3, 2]).astype(np.float64)
                          cplx = real + 1j * imag
                          self._compareConj(cplx, use_gpu=False)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 7 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1114..1119
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1121..1126
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1179..1184

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

                      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 _compare(self, x):
                          np_floor, np_ceil = np.floor(x), np.ceil(x)
                      
                          inx = ops.convert_to_tensor(x)
                          ofloor, oceil = math_ops.floor(inx), math_ops.ceil(inx)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 7 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 865..875

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

                      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 testRealImag64(self):
                          real = (np.arange(-3, 3) / 4.).reshape([1, 3, 2]).astype(np.float32)
                          imag = (np.arange(-3, 3) / 5.).reshape([1, 3, 2]).astype(np.float32)
                          cplx = real + 1j * imag
                          self._compareRealImag(cplx, use_gpu=False)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 7 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1121..1126
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1179..1184
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1186..1191

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

                      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 testConj64(self):
                          real = (np.arange(-3, 3) / 4.).reshape([1, 3, 2]).astype(np.float32)
                          imag = (np.arange(-3, 3) / 5.).reshape([1, 3, 2]).astype(np.float32)
                          cplx = real + 1j * imag
                          self._compareConj(cplx, use_gpu=False)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 3 other locations - About 7 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1114..1119
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1121..1126
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1186..1191

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

                      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

                        @test_util.run_deprecated_v1
                        def testGradients(self):
                          x = np.random.rand(1, 3, 2) * 100.
                          # ensure x != y
                          y = x + (np.random.randint(2, size=x.shape) - .5) * 2  # -1 or +1
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 7 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5041..5049

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

                      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

                            with self.subTest(t=t):
                              xt = x.astype(t)
                              yt = y.astype(t)
                              self._compare(xt, yt, np.less, math_ops.less)
                              self._compare(xt, yt, np.less_equal, math_ops.less_equal)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 7 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 954..962
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5711..5719

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

                        def _compareBinary(self, x, y, np_func, tf_func, use_gpu=False):
                          np_ans = np_func(x, y)
                          with test_util.device(use_gpu=use_gpu):
                            inx = ops.convert_to_tensor(x)
                            iny = ops.convert_to_tensor(y)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 7 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2609..2618

                      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

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

                      def _sparsify(x, thresh=0.5, index_dtype=np.int64):
                        x[x < thresh] = 0
                      
                        non_zero = np.where(x)
                        x_indices = np.vstack(non_zero).astype(index_dtype).T
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 6 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 49..58
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_unary_test.py on lines 42..51

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

                      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 _not(self, x, use_gpu=False):
                          np_ans = np.logical_not(x)
                          with test_util.device(use_gpu=use_gpu):
                            out = math_ops.logical_not(ops.convert_to_tensor(x))
                            tf_val = self.evaluate(out)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 5 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2620..2627

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

                      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

                            with self.subTest(t=t):
                              xt = x.astype(t)
                              yt = y.astype(t)
                              if t == np.float16:
                                # Compare fp16 theoretical gradients to fp32 numerical gradients,
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 5 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5333..5346

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

                      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 _compareScalar(self, func, x, y, dtype):
                          with test_util.use_gpu():
                            out = func(
                                ops.convert_to_tensor(np.array([x]).astype(dtype)),
                                ops.convert_to_tensor(np.array([y]).astype(dtype)))
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 5 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 912..918

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

                      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 _compareAngle(self, cplx, use_gpu):
                          np_angle = np.angle(cplx)
                      
                          with test_util.device(use_gpu=use_gpu):
                            inx = ops.convert_to_tensor(cplx)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1170..1177

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

                      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 _compareConj(self, cplx, use_gpu):
                          np_ans = np.conj(cplx)
                          with test_util.device(use_gpu=use_gpu):
                            inx = ops.convert_to_tensor(cplx)
                            tf_conj = math_ops.conj(inx)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1128..1137

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

                      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 _compare_values(self, x, y=None):
                          y = np.rint(x) if y is None else np.asarray(y)
                      
                          tf_rint = math_ops.rint(x)
                          np_rint = self.evaluate(tf_rint)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 856..863

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

                      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

                            with self.subTest(t=t):
                              xt = x.astype(t)
                              xt -= 1j * xt
                              yt = y.astype(t)
                              yt -= 1j * yt
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 964..970

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

                      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 _compare(self, fn, c, x, y, use_gpu):
                          np_ans = np.where(c, x, y)
                          with test_util.device(use_gpu=use_gpu):
                            out = fn(c, x, y)
                            tf_ans = self.evaluate(out)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5125..5131

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

                      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

                        def _compare(self, x, y, np_func, tf_func):
                          np_ans = np_func(x, y)
                          with test_util.use_gpu():
                            out = tf_func(ops.convert_to_tensor(x), ops.convert_to_tensor(y))
                            tf_ans = self.evaluate(out)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 944..949
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5663..5668

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

                      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

                      def _default_tolerance(dtype):
                        """Returns a sensible default tolerance for comparing results of a given type.
                      
                        Args:
                          dtype: A datatype.
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 61..74
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 88..101

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

                      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 y in data:
                                with self.subTest(use_gpu=use_gpu, x=x, y=y):
                                  self._compareBinary(x, y, np.logical_and, math_ops.logical_and,
                                                      use_gpu)
                                  self._compareBinary(x, y, np.logical_or, math_ops.logical_or,
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 286..292

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

                      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 use_gpu in [True, False]:
                              with self.subTest(xs=xs, ys=ys, use_gpu=use_gpu):
                                self._compareBinary(x, y, np.logical_and, math_ops.logical_and,
                                                    use_gpu)
                                self._compareBinary(x, y, np.logical_or, math_ops.logical_or, use_gpu)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 250..257

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

                      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

                          for t in [np.float16, np.float32, np.float64]:
                            with self.subTest(t=t):
                              self._compare(x.astype(t), y.astype(t), use_gpu=False)
                              self._compare(x.astype(t), y.astype(t), use_gpu=True)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 760..764
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 782..785

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

                      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

                          for t in [np.float16, np.float32, np.float64, np.int8, np.uint8, np.int16,
                                    np.uint16, np.int32, np.uint32, np.int64, np.uint64]:
                            with self.subTest(t=t):
                              self._compare(x.astype(t), y.astype(t), use_gpu=False)
                              self._compare(x.astype(t), y.astype(t), use_gpu=True)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 774..777
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 782..785

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

                      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

                          for t in [np.float16, np.float32, np.float64, np.int32, np.int64]:
                            with self.subTest(t=t):
                              self._compare(x.astype(t), y.astype(t), use_gpu=False)
                              self._compare(x.astype(t), y.astype(t), use_gpu=True)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 760..764
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 774..777

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

                      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

                            with self.subTest(use_gpu=use_gpu):
                              self._not(x, use_gpu)
                              self._compareBinary(x, y, np.logical_and, math_ops.logical_and, use_gpu)
                              self._compareBinary(x, y, np.logical_or, math_ops.logical_or, use_gpu)
                              self._compareBinary(x, y, np.logical_xor, math_ops.logical_xor, use_gpu)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 3 hrs to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2647..2651

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

                      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

                                with self.subTest(t=t, x=x, y=y):
                                  self.assertEqual(
                                      self._compareScalar(math_ops.equal, x, y, t), x == y)
                                  self.assertEqual(
                                      self._compareScalar(math_ops.not_equal, x, y, t), x != y)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 939..942

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

                      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 _computeLiteralAndTensor(self, x, y, dtype, func):
                          with test_util.force_cpu():
                            iny = ops.convert_to_tensor(y, dtype=dtype)
                            z = func(x, iny)  # Should use __radd__, __rsub__, etc.
                            return self.evaluate(z)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 839..843

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

                      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 _computeTensorAndLiteral(self, x, y, dtype, func):
                          with test_util.force_cpu():
                            inx = ops.convert_to_tensor(x, dtype=dtype)
                            z = func(inx, y)  # Should use __add__, __sub__, etc.
                            return self.evaluate(z)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 845..849

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

                      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

                                  with self.subTest(c=c, a=a, b=b):
                                    x = fn(c, a, b).eval()
                                    y = a if c else b
                                    self.assertEqual(np.isnan(x), np.isnan(y))
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5423..5426

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

                      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

                            with self.subTest(t=t):
                              self._compare(x.astype(t), t(y), use_gpu=False)
                              self._compare(x.astype(t), t(y), use_gpu=True)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5005..5007

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

                      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

                          dtypes = [
                              dtypes_lib.float16,
                              dtypes_lib.float32,
                              dtypes_lib.float64,
                              dtypes_lib.bfloat16,
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/python/ops/ragged/ragged_tensor_test_ops.py on lines 170..184

                      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

                          for dtype in (dtypes_lib.int32, dtypes_lib.int64, dtypes_lib.float16,
                                        dtypes_lib.float32, dtypes_lib.float64):
                            with self.subTest(dtype=dtype):
                              x = array_ops.placeholder(dtype)
                              y = math_ops.conj(x)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1163..1168

                      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

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

                          for dtype in (dtypes_lib.int32, dtypes_lib.int64, dtypes_lib.float32,
                                        dtypes_lib.float64):
                            with self.subTest(dtype=dtype):
                              x = array_ops.placeholder(dtype)
                              y = math_ops.real(x)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1195..1200

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

                            with self.subTest(t=t):
                              xt = x.astype(t)
                              yt = y.astype(t)
                              with self.assertRaises(ValueError):
                                fn(c, xt, yt)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5384..5396

                      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

                          dtypes = [
                              dtypes_lib.float16,
                              dtypes_lib.float32,
                              dtypes_lib.float64,
                              dtypes_lib.uint8,
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 1 hr to fix
                      tensorflow/python/kernel_tests/data_structures/fifo_queue_test.py on lines 585..589

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

                      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

                          with self.cached_session():
                            tf_val = math_ops.polyval(coeffs, x)
                            self.assertAllClose(np_val, self.evaluate(tf_val))
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 50 mins to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1314..1316
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1322..1324

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

                      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

                                with self.cached_session():
                                  tf_val = math_ops.polyval(coeffs, x)
                                  self.assertAllClose(np_val, self.evaluate(tf_val))
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 50 mins to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1289..1291
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1322..1324

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

                      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

                          with self.cached_session():
                            tf_val = math_ops.polyval(coeffs, x)
                            self.assertAllClose(np_val, self.evaluate(tf_val))
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 2 other locations - About 50 mins to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1289..1291
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1314..1316

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

                      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

                            y = np.random.randint(0, 2, np.prod(ys)).astype(np.bool_).reshape(ys)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 5 other locations - About 45 mins to fix
                      tensorflow/python/kernel_tests/array_ops/batchtospace_op_test.py on lines 330..331
                      tensorflow/python/kernel_tests/array_ops/spacetobatch_op_test.py on lines 627..628
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 284..284
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2668..2668
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2669..2669

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

                      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

                            x = np.random.randint(0, 2, np.prod(xs)).astype(np.bool_).reshape(xs)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 5 other locations - About 45 mins to fix
                      tensorflow/python/kernel_tests/array_ops/batchtospace_op_test.py on lines 330..331
                      tensorflow/python/kernel_tests/array_ops/spacetobatch_op_test.py on lines 627..628
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 285..285
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2668..2668
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 2669..2669

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

                      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

                              with self.subTest(t=t, f=f):
                                with self.assertRaisesIncompatibleShapesError(
                                    (ValueError, errors.InvalidArgumentError)):
                                  f(x.astype(t), y.astype(t))
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 45 mins to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_binary_test.py on lines 1037..1040

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

                      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

                        @test_util.run_deprecated_v1
                        def testNan(self):
                          """Verify that nans don't propagate where they shouldn't."""
                          self._testNan(array_ops.where)
                          self._testNan(array_ops.where_v2)
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 45 mins to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5428..5432

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

                      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

                        @test_util.run_deprecated_v1
                        def testConjString(self):
                          x = array_ops.placeholder(dtypes_lib.string)
                          with self.assertRaisesRegex(TypeError,
                                                      r"Expected numeric or variant tensor"):
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 40 mins to fix
                      tensorflow/python/kernel_tests/array_ops/unstack_op_test.py on lines 154..158

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 34.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                        @test_util.run_deprecated_v1
                        def testGradients(self):
                          self._testGradients(array_ops.where)
                          self._testGradients(array_ops.where_v2)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 6 other locations - About 30 mins to fix
                      tensorflow/python/kernel_tests/array_ops/concat_op_test.py on lines 264..267
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 593..596
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 609..612
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5348..5351
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5398..5401
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5414..5417

                      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

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

                        @test_util.run_deprecated_v1
                        def testEmptyTensor(self):
                          self._testEmptyTensor(array_ops.where)
                          self._testEmptyTensor(array_ops.where_v2)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 6 other locations - About 30 mins to fix
                      tensorflow/python/kernel_tests/array_ops/concat_op_test.py on lines 264..267
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 546..549
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 593..596
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5348..5351
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5398..5401
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5414..5417

                      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

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

                        @test_util.run_deprecated_v1
                        def testShapeMismatch(self):
                          self._testShapeMismatch(array_ops.where)
                          self._testShapeMismatch(array_ops.where_v2)
                      Severity: Major
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 6 other locations - About 30 mins to fix
                      tensorflow/python/kernel_tests/array_ops/concat_op_test.py on lines 264..267
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 546..549
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 609..612
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5348..5351
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5398..5401
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5414..5417

                      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

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

                          data = (np.arange(-3, 3) / 4.).reshape(1, 3, 2).astype(dtype)
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 30 mins to fix
                      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 878..878

                      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

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

                                jacob_t, jacob_n = gradient_checker.compute_gradient(
                                    x_, list(x.shape), z, [1], x_init_value=x, delta=epsilon)
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 30 mins to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1273..1274

                      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

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

                            jacob_t, jacob_n = gradient_checker.compute_gradient(
                                inp, list(data.shape), loss, [1], x_init_value=data, delta=epsilon)
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 30 mins to fix
                      tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 1237..1238

                      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