tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/array_ops/slice_op_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File slice_op_test.py has 372 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: Minor
Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py - About 4 hrs to fix

    SliceTest has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SliceTest(test.TestCase):
    
      def testEmpty(self):
        inp = np.random.rand(4, 4).astype("f")
        for k in range(4):
    Severity: Minor
    Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py - About 3 hrs to fix

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

        @test_util.run_without_tensor_float_32("Use FP32 in conv3d.")
        def test3Dimension(self):
          with self.cached_session():
            input_shape = [8, 16, 16, 16, 8]
            total_input_size = 1
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 2 days to fix
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 505..542

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

      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

          slice2_t = a[indices[0]:indices[0] + sizes[0],
                       indices[1]:indices[1] + sizes[1],
                       indices[2]:indices[2] + sizes[2],
                       indices[3]:indices[3] + sizes[3],
                       indices[4]:indices[4] + sizes[4],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 3 other locations - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 304..309
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 560..566
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 571..577

      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

          expected_val = inp[indices[0]:indices[0] + sizes[0],
                             indices[1]:indices[1] + sizes[1],
                             indices[2]:indices[2] + sizes[2],
                             indices[3]:indices[3] + sizes[3],
                             indices[4]:indices[4] + sizes[4],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 3 other locations - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 295..300
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 560..566
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 571..577

      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

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

            with self.cached_session():
              inp = np.random.rand(10).astype("f")
              a = constant_op.constant(inp, shape=[10], dtype=dtypes.float32)
      
              hi = np.random.randint(0, 9)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 1 day to fix
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 488..503

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

      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 testPartialShapeInference(self):
          z = array_ops.zeros((1, 2, 3))
          self.assertAllEqual(z.get_shape().as_list(), [1, 2, 3])
      
          m1 = array_ops.slice(z, [0, 0, 0], [-1, -1, -1])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 1 day to fix
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 584..592

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

      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 testEmpty(self):
          inp = np.random.rand(4, 4).astype("f")
          for k in range(4):
            with self.cached_session():
              a = constant_op.constant(inp, shape=[4, 4], dtype=dtypes.float32)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 7 hrs to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 44..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 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 testInt32(self):
          inp = np.random.rand(4, 4).astype("i")
          for k in range(4):
            with self.cached_session():
              a = constant_op.constant(inp, shape=[4, 4], dtype=dtypes.int32)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 7 hrs to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 35..42

      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 testGradientsAllTape(self):
          # Slice the middle square out of a 4x4 input
          self._testGradientSliceTape([4, 4], [1, 1], [2, 2])
      
          # Slice the upper left square out of a 4x4 input
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 421..438

      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

          with ops.Graph().as_default():
            # Slice the middle square out of a 4x4 input
            self._testGradientSlice([4, 4], [1, 1], [2, 2])
      
            # Slice the upper left square out of a 4x4 input
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 440..457

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 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

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

          for i in range(len(input_shape)):
            slices.append(slice(slice_begin[i], slice_begin[i] + slice_size[i]))
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 344..345

      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

          for i in range(len(input_shape)):
            slices.append(slice(slice_begin[i], slice_begin[i] + slice_size[i]))
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 369..370

      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

          sizes = [
              np.random.randint(0, input_shape[i] - indices[i] + 1) for i in range(6)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 2 hrs to fix
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 555..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 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

            slice_t = array_ops.slice(a_int32,
                                      np.asarray([1]).astype(np.int64),
                                      np.asarray([2]).astype(np.int64))
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 83..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 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

            slice_t = array_ops.slice(a_float32,
                                      np.asarray([1]).astype(np.int64),
                                      np.asarray([2]).astype(np.int64))
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 76..78

      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

              a = constant_op.constant(
                  [float(x) for x in inp.ravel(order="C")],
                  shape=[4, 4],
                  dtype=dtypes.float32)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 2 other locations - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/shape_ops_test.py on lines 522..525
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 473..476

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

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

            a = constant_op.constant(
                [float(x) for x in inp.ravel(order="C")],
                shape=input_shape,
                dtype=dtypes.float32)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 4 other locations - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/shape_ops_test.py on lines 538..541
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 287..289
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 355..357
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 549..552

      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

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

            a = constant_op.constant([float(x) for x in inp.ravel(order="C")],
                                     shape=input_shape,
                                     dtype=dtypes.float32)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 4 other locations - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/shape_ops_test.py on lines 538..541
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 287..289
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 330..333
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 549..552

      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

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

          a = constant_op.constant([float(x) for x in inp.ravel(order="C")],
                                   shape=input_shape,
                                   dtype=dtypes.float32)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 4 other locations - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/shape_ops_test.py on lines 538..541
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 330..333
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 355..357
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 549..552

      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

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

          indices = [0 if x == 0 else np.random.randint(x) for x in input_shape]
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 35 mins to fix
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 554..554

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 33.

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

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

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

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

      Refactorings

      Further Reading

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

              self.assertAllEqual(slice2_val, np.array(inp[:2, :2], dtype=np.float32))
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 35 mins to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 265..265

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 33.

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

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

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

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

      Refactorings

      Further Reading

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

              self.assertAllEqual(slice_val, np.array(inp[:2, :2], dtype=np.float32))
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 1 other location - About 35 mins to fix
      tensorflow/python/kernel_tests/array_ops/slice_op_test.py on lines 266..266

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 33.

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

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

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

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

      Refactorings

      Further Reading

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

            a = constant_op.constant([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/slice_op_test.py and 2 other locations - About 30 mins to fix
      tensorflow/python/kernel_tests/math_ops/banded_triangular_solve_op_test.py on lines 127..127
      tensorflow/python/ops/nn_test.py on lines 1852..1852

      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