tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File sparse_ops_test.py has 1003 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/sparse_ops/sparse_ops_test.py - About 2 days to fix

    Function _compare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def _compare(self, sp_t, reduction_axes, ndims, keep_dims, do_sum):
        densified = self.evaluate(sparse_ops.sparse_tensor_to_dense(sp_t))
    
        np_ans = densified
        if reduction_axes is None:
    Severity: Minor
    Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py - About 2 hrs 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 _compare has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def _compare(self, sp_t, reduction_axes, ndims, keep_dims, do_sum):
    Severity: Minor
    Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py - About 35 mins to fix

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

        def _testSparseReduceShape(self, sp_t, reduction_axes, ndims, keep_dims,
      Severity: Minor
      Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py - About 35 mins to fix

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

          def _testSparseReduceShape(self, sp_t, reduction_axes, ndims, keep_dims,
                                     do_sum):
            densified = self.evaluate(sparse_ops.sparse_tensor_to_dense(sp_t))
        
            np_op = np.sum
        Severity: Minor
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

          def testCwiseDivAndMul(self):
            np.random.seed(1618)
            sp_shapes = [(10, 10, 10), (5, 5), (1618,), (3, 3, 7)]
            dense_shapes = [(10, 10, 1), (5, 5), (1,), (1, 7)]
        
        
        Severity: Minor
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_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

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

          def testBasic(self):
            with test_util.force_cpu():
              sp_input = self._SparseTensor_2x5x6()
              new_shape = np.array([3, 6, 7], dtype=np.int64)
              sp_output = sparse_ops.sparse_reset_shape(sp_input, new_shape)
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 1 day to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 376..387

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

        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 testInputUnavailableInGraphConstructionOk(self):
            with test_util.force_cpu():
              sp_input = self._SparseTensorValue_2x5x6()
              new_shape = np.array([3, 6, 7], dtype=np.int64)
              sp_output = sparse_ops.sparse_reset_shape(sp_input, new_shape)
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 1 day to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 363..374

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

        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 testInt64(self):
            with test_util.force_cpu():
              sp_input = self._SparseTensor_5x6(dtypes.int64)
              output = sparse_ops.sparse_to_indicator(sp_input, 50)
        
        
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 7 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 75..85

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

        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 testInt32(self):
            with test_util.force_cpu():
              sp_input = self._SparseTensor_5x6(dtypes.int32)
              output = sparse_ops.sparse_to_indicator(sp_input, 50)
        
        
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 7 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 87..97

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

        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 _SparseTensorValue_5x6(self, dtype=np.int32):
            ind = np.array([[0, 0], [1, 0], [1, 3], [1, 4], [3, 2], [3, 3]])
            val = np.array([0, 10, 13, 14, 32, 33])
            shape = np.array([5, 6])
            return sparse_tensor.SparseTensorValue(
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 6 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 55..62

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

        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 _SparseTensor_5x6(self, dtype):
            ind = np.array([[0, 0], [1, 0], [1, 3], [1, 4], [3, 2], [3, 3]])
            val = np.array([0, 10, 13, 14, 32, 33])
            shape = np.array([5, 6])
            return sparse_tensor.SparseTensor(
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 6 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 551..557

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

        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
        tensorflow/python/kernel_tests/array_ops/shape_ops_test.py on lines 35..44
        tensorflow/python/kernel_tests/sparse_ops/sparse_add_op_test.py on lines 35..44

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

        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 _SparseTensor_2x6(self):
            ind = np.array([[0, 0], [1, 0], [1, 3], [1, 4]])
            val = np.array([0, 10, 13, 14])
            shape = np.array([2, 6])
            return sparse_tensor.SparseTensor(
        tensorflow/python/kernel_tests/sparse_ops/sparse_add_op_test.py on lines 72..82
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 42..51
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 56..65

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

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

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

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

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

        Refactorings

        Further Reading

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

              with self.assertRaises(errors.InvalidArgumentError):
                res = sparse_ops.gen_sparse_ops.sparse_reduce_sum(
                    input_indices=[[1, 2], [3, 4]],
                    input_shape=[2**32, 2**31],
                    input_values=[1, 3],
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 959..968
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 969..978

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

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

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

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

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

        Refactorings

        Further Reading

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

              with self.assertRaises(errors.InvalidArgumentError):
                res = sparse_ops.gen_sparse_ops.sparse_reduce_max(
                    input_indices=[[1, 2], [3, 4]],
                    input_shape=[2**32, 2**31],
                    input_values=[1, 3],
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 969..978
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 979..988

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

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

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

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

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

        Refactorings

        Further Reading

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

              with self.assertRaises(errors.InvalidArgumentError):
                res = sparse_ops.gen_sparse_ops.sparse_reduce_max_sparse(
                    input_indices=[[1, 2], [3, 4]],
                    input_shape=[2**32, 2**31],
                    input_values=[1, 3],
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 959..968
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 979..988

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

        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 _AssertResultsNotSorted(self, output, vocab_size):
            self.assertAllEqual(output.indices,
                                [[0, 0], [1, 13], [1, 10], [2, 33], [2, 32], [1, 14]])
            self.assertAllEqual(output.values, [-3, 4, 1, 9, 5, 1])
            self.assertAllEqual(output.dense_shape, [3, vocab_size])
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 136..140

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

        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 _AssertResultsSorted(self, output, vocab_size):
            self.assertAllEqual(output.indices,
                                [[0, 0], [1, 10], [1, 13], [1, 14], [2, 32], [2, 33]])
            self.assertAllEqual(output.values, [-3, 1, 4, 1, 5, 9])
            self.assertAllEqual(output.dense_shape, [3, vocab_size])
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 142..146

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

        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 testInt64AndFloat32NonCanonicalOrder(self):
            vocab_size = 50
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int64, np.float32)
              sp_output = sparse_ops.sparse_merge(
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 179..187

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

        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 testInt32AndFloat32NonCanonicalOrder(self):
            vocab_size = 50
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int32, np.float32)
              sp_output = sparse_ops.sparse_merge(
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 189..197

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

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

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

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

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

        Refactorings

        Further Reading

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

          def testInt64AndFloat32(self):
            vocab_size = [50, 31]
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int64, np.float32)
              sp_output = sparse_ops.sparse_merge(indices, values, vocab_size)
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 268..275
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 277..284

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

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

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

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

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

        Refactorings

        Further Reading

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

          def testInt64AndFloat64Shape(self):
            vocab_size = [50, 31]
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int64, np.float64)
              sp_output = sparse_ops.sparse_merge(indices, values, vocab_size)
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 259..266
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 268..275

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

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

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

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

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

        Refactorings

        Further Reading

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

          def testInt64AndFloat64(self):
            vocab_size = [50, 31]
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int64, np.float64)
              sp_output = sparse_ops.sparse_merge(indices, values, vocab_size)
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 259..266
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 277..284

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

        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 testInt64AndFloat32(self):
            vocab_size = 50
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int64, np.float32)
              sp_output = sparse_ops.sparse_merge(indices, values, vocab_size)
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 3 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 170..177

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

        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 testInt64AndFloat64(self):
            vocab_size = 50
            with test_util.force_cpu():
              indices, values = self._SparseTensor_3x50(np.int64, np.float64)
              sp_output = sparse_ops.sparse_merge(indices, values, vocab_size)
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 1 other location - About 3 hrs to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 161..168

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

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

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

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

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

        Refactorings

        Further Reading

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

              sp_input = sparse_tensor.SparseTensor(
                  indices=np.array([[1, 2], [1, 3], [99, 1], [99, 3]]),
                  values=np.array([1, 3, 2, 4]),
                  dense_shape=np.array([2, 5]))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 695..698
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 712..715

        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

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

              sp_input = sparse_tensor.SparseTensor(
                  indices=np.array([[2, 3], [2, 2], [0, 1], [0, 3]]),
                  values=np.array([1, 3, 2, 4]),
                  dense_shape=np.array([3, 5]))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 695..698
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 764..767

        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

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

              sp_input = sparse_tensor.SparseTensor(
                  indices=np.array([[1, 2], [1, 3], [0, 1], [0, 3]]),
                  values=np.array([1, 3, 2, 4]),
                  dense_shape=np.array([2, 5]))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 712..715
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 764..767

        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

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

          def _assertSparseTensorValueEqual(self, a, b):
            self.assertAllEqual(a.indices, b.indices)
            self.assertAllEqual(a.values, b.values)
            self.assertAllEqual(a.dense_shape, b.dense_shape)
        tensorflow/python/kernel_tests/sparse_ops/sparse_cross_op_test.py on lines 63..66
        tensorflow/python/kernel_tests/sparse_ops/sparse_cross_op_test.py on lines 422..425

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

        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

          _IND_2_5_6 = np.array(
              [[0, 0, 0], [0, 1, 0], [0, 1, 3], [1, 1, 4], [1, 3, 2], [1, 3, 3]],
              dtype=np.int64)
        tensorflow/python/kernel_tests/data_structures/dynamic_partition_op_test.py on lines 61..63

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

                self.assertAllEqual(
                    output.indices,
                    [[0, 0], [1, 0], [1, 3], [1, 4], [2, 0], [3, 2], [3, 3], [4, 0]])
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 180..182
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 295..297
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 641..642
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 670..672
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 167..169

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 45.

        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

              self.assertAllEqual(output.indices, [[0, 0], [1, 0], [1, 3], [1, 4],
                                                   [2, 0], [3, 2], [3, 3], [4, 0]])
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 180..182
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 295..297
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 589..591
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 670..672
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 167..169

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 45.

        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

              self.assertAllEqual(
                  output.indices,
                  [[0, 0], [1, 0], [1, 3], [1, 4], [2, 0], [3, 2], [3, 3], [4, 0]])
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 180..182
        tensorflow/python/kernel_tests/sparse_ops/sparse_concat_op_test.py on lines 295..297
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 589..591
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 641..642
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 167..169

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 45.

        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

              sp_input = sparse_tensor.SparseTensor(
                  indices=np.ones([0, 2]),
                  values=np.ones([0]),
                  dense_shape=np.array([2, 5]))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 747..750

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

        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

              sp_input = sparse_tensor.SparseTensor(
                  indices=np.ones([0, 2]),
                  values=np.ones([0]),
                  dense_shape=np.array([0, 3]))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 730..733

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

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

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

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

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

        Refactorings

        Further Reading

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

              expected_trues = [(0, 0, 1), (0, 1, 10), (0, 1, 12), (1, 0, 103),
                                (1, 1, 149), (1, 1, 150), (1, 2, 122)]
        tensorflow/python/kernel_tests/linalg/tridiagonal_solve_op_test.py on lines 658..659
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1071..1072

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

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

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

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

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

        Refactorings

        Further Reading

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

              for ra in reduction_axes.ravel()[::-1]:
                if do_sum:
                  np_ans = np.sum(np_ans, axis=ra, keepdims=keep_dims)
                else:
                  np_ans = np.max(np_ans, axis=ra, keepdims=keep_dims)
        tensorflow/python/kernel_tests/nn_ops/softmax_op_test.py on lines 70..73
        tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3937..3940

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

        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

            ind = np.array([[0, 0, 1], [0, 1, 0], [0, 1, 2], [1, 0, 3], [1, 1, 0],
                            [1, 1, 1], [1, 1, 2], [1, 2, 2]])
        tensorflow/python/kernel_tests/linalg/tridiagonal_matmul_op_test.py on lines 221..223

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

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

            sp = sparse_tensor.SparseTensor(
                constant_op.constant(ind, dtypes.int64),
                constant_op.constant(val, dtypes.int64),
                constant_op.constant(shape, dtypes.int64))
        tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
        tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 675..678
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 679..682
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1047..1050
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1052..1055
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1077..1080
        tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1082..1085

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

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

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

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

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

        Refactorings

        Further Reading

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

            indices1 = sparse_tensor.SparseTensorValue(
                np.array(ind, np.int64),
                np.array(indices1, indices_dtype), np.array(shape, np.int64))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 123..125
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 126..128
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 238..240
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 244..246

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

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

            values = sparse_tensor.SparseTensorValue(
                np.array(ind, np.int64),
                np.array(values, values_dtype), np.array(shape, np.int64))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 123..125
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 238..240
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 241..243
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 244..246

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

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

            indices = sparse_tensor.SparseTensorValue(
                np.array(ind, np.int64),
                np.array(indices, indices_dtype), np.array(shape, np.int64))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 126..128
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 238..240
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 241..243
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 244..246

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

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

            values = sparse_tensor.SparseTensorValue(
                np.array(ind, np.int64),
                np.array(values, values_dtype), np.array(shape, np.int64))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 123..125
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 126..128
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 238..240
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 241..243

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

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

            indices0 = sparse_tensor.SparseTensorValue(
                np.array(ind, np.int64),
                np.array(indices0, indices_dtype), np.array(shape, np.int64))
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 123..125
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 126..128
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 241..243
        tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 244..246

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

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

            if reduction_axes is None:
              if do_sum:
                np_ans = np.sum(np_ans, keepdims=keep_dims)
              else:
                np_ans = np.max(np_ans, keepdims=keep_dims)
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 4 other locations - About 45 mins to fix
        tensorflow/python/training/input.py on lines 790..793
        tensorflow/python/training/input.py on lines 830..833
        tensorflow/python/training/input.py on lines 875..878
        tensorflow/python/training/input.py on lines 917..920

        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

              self.assertAllEqual(output.indices,
                                  [[0, 1], [0, 3], [1, 0], [2, 3], [2, 2]])
        Severity: Major
        Found in tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py and 5 other locations - About 35 mins to fix
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 121..122
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 130..131
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 134..135
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 213..214
        tensorflow/python/kernel_tests/sparse_ops/sparse_slice_op_test.py on lines 217..218

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 33.

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

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

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

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

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status