tensorflow/tensorflow

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

Summary

Maintainability
F
1 mo
Test Coverage

File diag_op_test.py has 1022 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/array_ops/diag_op_test.py - About 2 days to fix

    Function testRectangularBatch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def testRectangularBatch(self):
        with self.cached_session():
          # Stores expected num_rows and num_cols (when the other is given).
          # expected[d_lower, d_upper] = (expected_num_rows, expected_num_cols)
          test_list = list()
    Severity: Minor
    Found in tensorflow/python/kernel_tests/array_ops/diag_op_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 repack_diagonals has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def repack_diagonals(packed_diagonals,
                         diag_index,
                         num_rows,
                         num_cols,
                         align=None):
    Severity: Minor
    Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def repack_diagonals(packed_diagonals,
    Severity: Minor
    Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py - About 35 mins to fix

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

        def _testVectorBatch(self, dtype):
          with self.cached_session():
            v_batch = np.array([[1.0, 0.0, 3.0], [4.0, 5.0, 6.0]]).astype(dtype)
            mat_batch = np.array([[[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 3.0]],
                                  [[4.0, 0.0, 0.0], [0.0, 5.0, 0.0],
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_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 testVector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def testVector(self):
          with self.session():
            v = np.array([1.0, 2.0, 3.0])
            mat = np.diag(v)
            v_diag = array_ops.matrix_diag(v)
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_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 testRectangular has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testRectangular(self):
          with self.session():
            v = np.array([3.0, 4.0])
            mat = np.array([[0.0, 1.0, 0.0], [1.0, 0.0, 1.0]])
            expected = np.array([[3.0, 1.0, 0.0], [1.0, 4.0, 1.0]])
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_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

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

        def testRectangular(self):
          with self.session():
            mat = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
            mat_diag = array_ops.matrix_diag_part(mat)
            self.assertAllEqual(mat_diag, np.array([1.0, 5.0]))
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_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

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

        def testRectangularBatch(self):
          with self.session():
            v_batch = np.array([[1.0, 2.0], [4.0, 5.0]])
            mat_batch = np.array([[[1.0, 0.0, 0.0], [0.0, 2.0, 0.0]],
                                  [[4.0, 0.0, 0.0], [0.0, 5.0, 0.0]]])
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_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

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

        def testRectangularBatch(self):
          with self.session():
            v_batch = np.array([[-1.0, -2.0], [-4.0, -5.0]])
            mat_batch = np.array([[[1.0, 0.0, 3.0], [0.0, 2.0, 0.0]],
                                  [[4.0, 0.0, 4.0], [0.0, 5.0, 0.0]]])
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_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

                ]]]]], [[[[[0 + 0j, 0 + 0j], [0 + 0j, 0 + 0j]], [
                    [5.5 + 5.5j, 0 + 0j], [0 + 0j, 0 + 0j]
                ]], [[[0 + 0j, 0 + 0j], [0 + 0j, 0 + 0j]], [[0 + 0j, 6.6 + 6.6j], [
                    0 + 0j, 0 + 0j
                ]]]], [[[[0 + 0j, 0 + 0j], [0 + 0j, 0 + 0j]], [[0 + 0j, 0 + 0j], [
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 2 days to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1023..1030

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

      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

                [[[[[[1.1 + 1.1j, 0 + 0j], [0 + 0j, 0 + 0j]], [[0 + 0j, 0 + 0j], [
                    0 + 0j, 0 + 0j
                ]]], [[[0 + 0j, 2.2 + 2.2j], [0 + 0j, 0 + 0j]], [[0 + 0j, 0 + 0j], [
                    0 + 0j, 0 + 0j
                ]]]], [[[[0 + 0j, 0 + 0j], [3.3 + 3.3j, 0 + 0j]], [[0 + 0j, 0 + 0j], [
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 2 days to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1031..1038

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

      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

                [[[[[[[[1, 0, 0], [0, 0, 0]]], [[[0, 0, 0], [0, 0, 0]]]], [
                    [[[0, 2, 0], [0, 0, 0]]], [[[0, 0, 0], [0, 0, 0]]]
                ], [[[[0, 0, 3], [0, 0, 0]]], [[[0, 0, 0], [0, 0, 0]]]]], [[
                    [[[0, 0, 0], [4, 0, 0]]], [[[0, 0, 0], [0, 0, 0]]]
                ], [[[[0, 0, 0], [0, 5, 0]]], [[[0, 0, 0], [0, 0, 0]]]], [
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1055..1060

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

      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

                ]]]], [[[[[[[0, 0, 0], [0, 0, 0]]], [[[7, 0, 0], [0, 0, 0]]]], [
                    [[[0, 0, 0], [0, 0, 0]]], [[[0, 8, 0], [0, 0, 0]]]
                ], [[[[0, 0, 0], [0, 0, 0]]], [[[0, 0, 9], [0, 0, 0]]]]], [[
                    [[[0, 0, 0], [0, 0, 0]]], [[[0, 0, 0], [10, 0, 0]]]
                ], [[[[0, 0, 0], [0, 0, 0]]], [[[0, 0, 0], [0, 11, 0]]]
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1049..1054

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

      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

                ], [[0 + 0j, 0 + 0j, 3.3 + 3.3j], [0 + 0j, 0 + 0j, 0 + 0j]]], [[
                    [0 + 0j, 0 + 0j, 0 + 0j], [4.4 + 4.4j, 0 + 0j, 0 + 0j]
                ], [[0 + 0j, 0 + 0j, 0 + 0j], [0 + 0j, 5.5 + 5.5j, 0 + 0j]
                   ], [[0 + 0j, 0 + 0j, 0 + 0j], [0 + 0j, 0 + 0j, 6.6 + 6.6j]]]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 994..996

      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

                [[[[1.1 + 1.1j, 0 + 0j, 0 + 0j], [0 + 0j, 0 + 0j, 0 + 0j]], [
                    [0 + 0j, 2.2 + 2.2j, 0 + 0j], [0 + 0j, 0 + 0j, 0 + 0j]
                ], [[0 + 0j, 0 + 0j, 3.3 + 3.3j], [0 + 0j, 0 + 0j, 0 + 0j]]], [[
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 996..999

      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 testRankTwoIntTensor(self):
          x = np.array([[1, 2, 3], [4, 5, 6]])
          expected_ans = np.array([[[[1, 0, 0], [0, 0, 0]], [[0, 2, 0], [0, 0, 0]],
                                    [[0, 0, 3], [0, 0, 0]]],
                                   [[[0, 0, 0], [4, 0, 0]], [[0, 0, 0], [0, 5, 0]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 977..985

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

      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 testRankTwoFloatTensor(self):
          x = np.array([[1.1, 2.2, 3.3], [4.4, 5.5, 6.6]])
          expected_ans = np.array(
              [[[[1.1, 0, 0], [0, 0, 0]], [[0, 2.2, 0], [0, 0, 0]],
                [[0, 0, 3.3], [0, 0, 0]]], [[[0, 0, 0], [4.4, 0, 0]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 968..975

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

      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 diags, (vecs, banded_mat) in tests.items():
                mask = banded_mat[0] == 0
                input_mat = np.random.randint(10, size=mask.shape)
                solution = input_mat * mask + banded_mat[0]
                output = array_ops.matrix_set_diag(
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 618..626

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

      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 _, tests in [tall_cases(align), fat_cases(align)]:
                for diags, (vecs, banded_mat) in tests.items():
                  mask = banded_mat[0] == 0
                  input_mat = np.random.randint(10, size=mask.shape)
                  solution = input_mat * mask + banded_mat[0]
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 590..597

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

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

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

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

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

      Refactorings

      Further Reading

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

          with self.session(use_gpu=False):
            errors = []
            for shape in shapes:
              for dtype in dtypes:
                x1 = constant_op.constant(np.random.rand(*shape), dtype=dtype)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 7 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1165..1176

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

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

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

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

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

      Refactorings

      Further Reading

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

          with self.session(use_gpu=False):
            errors = []
            for shape in shapes:
              for dtype in dtypes:
                x1 = constant_op.constant(np.random.rand(*shape), dtype=dtype)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 7 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1186..1197

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

      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

        tests[-4, -3] = (np.array([[[9, 5],
                                    [6, 0]],
                                   [[7, 8],
                                    [9, 0]]]),
                         np.array([[[0, 0, 0],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 242..255

      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

        tests[1, 2] = (np.array([[[3, 0],
                                  [2, 6]],
                                 [[1, 0],
                                  [2, 3]]]),
                       np.array([[[0, 2, 3],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 196..209

      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

        tests[-2, 0] = (np.array([[[1, 6, 2],
                                   [5, 1, 0],
                                   [9, 0, 0]],
                                  [[4, 9, 5],
                                   [8, 4, 0],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 288..299

      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

        tests[-1, 1] = (np.array([[[2, 7, 3],
                                   [1, 6, 2],
                                   [5, 1, 0]],
                                  [[5, 1, 6],
                                   [4, 9, 5],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 6 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 276..287

      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

          expected_ans = np.array([[[[[[1.1, 0], [0, 0]], [[0, 0], [0, 0]]],
                                     [[[0, 2.2], [0, 0]], [[0, 0], [0, 0]]]],
                                    [[[[0, 0], [3.3, 0]], [[0, 0], [0, 0]]],
                                     [[[0, 0], [0, 4.4]], [[0, 0], [0, 0]]]]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1009..1012

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

      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

                                   [[[[[0, 0], [0, 0]], [[5.5, 0], [0, 0]]],
                                     [[[0, 0], [0, 0]], [[0, 6.6], [0, 0]]]],
                                    [[[[0, 0], [0, 0]], [[0, 0], [7.7, 0]]],
                                     [[[0, 0], [0, 0]], [[0, 0], [0, 8.8]]]]]])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1005..1008

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

      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 diags, pair in tests.items():
                solution, _ = pair
                mat_diag = array_ops.matrix_diag_part(mat[0], k=diags, align=align)
                self.assertEqual(mat_diag.get_shape(), solution[0].shape)
                self.assertAllEqual(mat_diag, solution[0])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 807..813

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

      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 mat, tests in [tall_cases(align), fat_cases(align)]:
                for diags, pair in tests.items():
                  solution, _ = pair
                  mat_diag = array_ops.matrix_diag_part(
                      mat[0], k=diags, align=align)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 789..793

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

      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

                        np.array([[[1, 2, 0, 0, 0],
                                   [6, 7, 8, 0, 0],
                                   [3, 4, 5, 6, 0],
                                   [0, 9, 1, 2, 3],
                                   [0, 0, 6, 7, 8]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 5 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 98..107
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 112..121
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 126..135
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 160..169
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 334..343

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

      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

                           np.array([[[0, 0, 0, 0, 0],
                                      [1, 0, 0, 0, 0],
                                      [5, 2, 0, 0, 0],
                                      [9, 6, 3, 0, 0],
                                      [0, 8, 7, 4, 0]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 5 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 98..107
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 112..121
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 126..135
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 144..153
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 160..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 82.

      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

                         np.array([[[0, 0, 0, 0, 0],
                                    [6, 0, 0, 0, 0],
                                    [0, 4, 0, 0, 0],
                                    [0, 0, 1, 0, 0],
                                    [0, 0, 0, 7, 0]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 5 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 98..107
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 126..135
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 144..153
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 160..169
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 334..343

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

      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

        mat = np.array([[[1, 2, 3, 4, 5],
                         [6, 7, 8, 9, 1],
                         [3, 4, 5, 6, 7],
                         [8, 9, 1, 2, 3],
                         [4, 5, 6, 7, 8]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 5 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 112..121
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 126..135
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 144..153
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 160..169
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 334..343

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

      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

                       np.array([[[0, 0, 3, 4, 5],
                                  [0, 0, 0, 9, 1],
                                  [0, 0, 0, 0, 7],
                                  [0, 0, 0, 0, 0],
                                  [0, 0, 0, 0, 0]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 5 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 98..107
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 112..121
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 126..135
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 144..153
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 334..343

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

      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

                         np.array([[[0, 0, 0, 0, 0],
                                    [0, 0, 0, 0, 0],
                                    [0, 0, 0, 0, 0],
                                    [8, 0, 0, 0, 0],
                                    [4, 5, 0, 0, 0]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 5 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 98..107
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 112..121
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 144..153
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 160..169
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 334..343

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

      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

        @test_util.run_deprecated_v1
        def testSquareBatch(self):
          self._testSquareBatch(dtypes_lib.bfloat16.as_numpy_dtype)
          self._testSquareBatch(np.float32)
          self._testSquareBatch(np.float64)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 2 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 428..435
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 842..849

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 78.

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

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

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

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

      Refactorings

      Further Reading

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

        @test_util.run_deprecated_v1
        def testSquareBatch(self):
          self._testSquareBatch(dtypes_lib.bfloat16.as_numpy_dtype)
          self._testSquareBatch(np.float32)
          self._testSquareBatch(np.float64)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 2 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 428..435
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 656..663

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 78.

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

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

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

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

      Refactorings

      Further Reading

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

        @test_util.run_deprecated_v1
        def testVectorBatch(self):
          self._testVectorBatch(dtypes_lib.bfloat16.as_numpy_dtype)
          self._testVectorBatch(np.float32)
          self._testVectorBatch(np.float64)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 2 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 656..663
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 842..849

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 78.

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

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

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

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

      Refactorings

      Further Reading

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

        def testRankOneFloatTensor(self):
          x = np.array([1.1, 2.2, 3.3])
          expected_ans = np.array([[1.1, 0, 0], [0, 2.2, 0], [0, 0, 3.3]])
          self.diagOp(x, np.float32, expected_ans)
          self.diagOp(x, np.float64, expected_ans)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 947..951

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

      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 testRankOneIntTensor(self):
          x = np.array([1, 2, 3])
          expected_ans = np.array([[1, 0, 0], [0, 2, 0], [0, 0, 3]])
          self.diagOp(x, np.int32, expected_ans)
          self.diagOp(x, np.int64, expected_ans)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 953..957

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

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

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

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

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

      Refactorings

      Further Reading

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

        @test_util.run_deprecated_v1
        def testInvalidShapeAtEval(self):
          with self.session():
            v = array_ops.placeholder(dtype=dtypes_lib.float32)
            with self.assertRaisesOpError("input must be at least 2-dim"):
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 3 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 538..543

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 64.

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

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

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

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

      Refactorings

      Further Reading

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

        @test_util.run_deprecated_v1
        def testInvalidShapeAtEval(self):
          with self.session():
            v = array_ops.placeholder(dtype=dtypes_lib.float32)
            with self.assertRaisesOpError("diagonal must be at least 1-dim"):
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 3 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 889..894

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 64.

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

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

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

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

      Refactorings

      Further Reading

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

                          np.array([[[5, 1, 0, 0],
                                     [9, 6, 2, 0],
                                     [0, 8, 7, 3],
                                     [0, 0, 7, 8]],
                                    [[1, 5, 0, 0],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/linalg/tridiagonal_solve_op_test.py on lines 308..310

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 53.

      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

            mat_set_diag_batch = np.array([[[-1.0, 0.0, 3.0], [0.0, 0.0, 0.0],
                                            [1.0, 0.0, -3.0]],
                                           [[-4.0, 0.0, 4.0], [0.0, -5.0, 0.0],
                                            [2.0, 0.0, -6.0]]]).astype(dtype)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 3 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 396..398
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 631..633
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 818..820

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

            mat_batch = np.array([[[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 3.0]],
                                  [[4.0, 0.0, 0.0], [0.0, 5.0, 0.0],
                                   [0.0, 0.0, 6.0]]]).astype(dtype)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 3 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 631..633
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 635..638
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 818..820

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

            mat_batch = np.array([[[1.0, 0.0, 3.0], [0.0, 2.0, 0.0], [1.0, 0.0, 3.0]],
                                  [[4.0, 0.0, 4.0], [0.0, 5.0, 0.0],
                                   [2.0, 0.0, 6.0]]]).astype(dtype)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 3 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 396..398
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 635..638
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 818..820

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

            mat_batch = np.array([[[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 3.0]],
                                  [[4.0, 0.0, 0.0], [0.0, 5.0, 0.0],
                                   [0.0, 0.0, 6.0]]]).astype(dtype)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 3 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 396..398
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 631..633
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 635..638

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

        tests[-2, 1] = (np.array([[[2, 6, 0],
                                   [1, 5, 9],
                                   [4, 8, 7],
                                   [7, 8, 4]],
                                  [[2, 3, 0],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 2 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 188..195
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 300..307

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

                       np.array([[[1, 0, 0],
                                  [0, 5, 0],
                                  [0, 0, 9],
                                  [0, 0, 0]],
                                 [[3, 0, 0],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 2 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 224..231
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 300..307

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

        tests[0, 3] = (np.array([[[4, 0, 0],
                                  [3, 8, 0],
                                  [2, 7, 3],
                                  [1, 6, 2]],
                                 [[7, 0, 0],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 2 other locations - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 188..195
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 224..231

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

        mat = np.array([[[1, 2, 3, 4],
                         [5, 6, 7, 8],
                         [9, 1, 2, 3]],
                        [[4, 5, 6, 7],
                         [8, 9, 1, 2],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 326..331

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 52.

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

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

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

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

      Refactorings

      Further Reading

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

          vecs = np.array([[[1, 2, 3, 4],  # Input shape: (2, 3, 4)
                            [5, 6, 7, 8],
                            [9, 8, 7, 6]],
                           [[5, 4, 3, 2],
                            [1, 2, 3, 4],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 261..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 52.

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

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

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

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

      Refactorings

      Further Reading

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

            x = np.array(
                [[1.1 + 1.1j, 2.2 + 2.2j, 3.3 + 3.3j],
                 [4.4 + 4.4j, 5.5 + 5.5j, 6.6 + 6.6j]],
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/linalg/linalg_ops_test.py on lines 135..136

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 49.

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

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

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

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

      Refactorings

      Further Reading

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

            expected = {
                (-1, -1): (5, 4),
                (-4, -3): (5, 2),
                (-2, 1): (5, 5),
                (2, 4): (3, 5),
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 470..474

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 39.

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

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

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

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

      Refactorings

      Further Reading

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

            expected = {
                (2, 2): (2, 4),
                (-2, 0): (3, 3),
                (-1, 1): (3, 3),
                (0, 3): (3, 3)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 445..449

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 39.

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

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

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

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

      Refactorings

      Further Reading

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

            x = np.array([1.1 + 1.1j, 2.2 + 2.2j, 3.3 + 3.3j], dtype=dtype)
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 55 mins to fix
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5088..5088

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 37.

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

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

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

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

      Refactorings

      Further Reading

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

            mat_batch = np.array([[[1.0, 0.0, 3.0], [0.0, 2.0, 0.0]],
                                  [[4.0, 0.0, 4.0], [0.0, 5.0, 0.0]]])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 4 other locations - About 50 mins to fix
      tensorflow/python/kernel_tests/array_ops/batch_gather_op_test.py on lines 74..74
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 672..673
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 855..856
      tensorflow/python/kernel_tests/signal/shape_ops_test.py on lines 201..202

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 36.

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

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

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

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

      Refactorings

      Further Reading

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

            mat_batch = np.array([[[1.0, 0.0, 0.0], [0.0, 2.0, 0.0]],
                                  [[4.0, 0.0, 0.0], [0.0, 5.0, 0.0]]])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 4 other locations - About 50 mins to fix
      tensorflow/python/kernel_tests/array_ops/batch_gather_op_test.py on lines 74..74
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 669..670
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 672..673
      tensorflow/python/kernel_tests/signal/shape_ops_test.py on lines 201..202

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 36.

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

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

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

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

      Refactorings

      Further Reading

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

            mat_set_diag_batch = np.array([[[-1.0, 0.0, 3.0], [0.0, -2.0, 0.0]],
                                           [[-4.0, 0.0, 4.0], [0.0, -5.0, 0.0]]])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 4 other locations - About 50 mins to fix
      tensorflow/python/kernel_tests/array_ops/batch_gather_op_test.py on lines 74..74
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 669..670
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 855..856
      tensorflow/python/kernel_tests/signal/shape_ops_test.py on lines 201..202

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 36.

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

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

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

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

      Refactorings

      Further Reading

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

        def diagOp(self, diag, dtype, expected_ans):
          self._diagOp(diag, dtype, expected_ans, False)
          self._diagOp(diag, dtype, expected_ans, True)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 4 other locations - About 35 mins to fix
      tensorflow/python/kernel_tests/array_ops/constant_op_eager_test.py on lines 545..547
      tensorflow/python/kernel_tests/array_ops/constant_op_test.py on lines 732..734
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 1090..1092
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5062..5064

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

        def diagPartOp(self, tensor, dtype, expected_ans):
          self._diagPartOp(tensor, dtype, expected_ans, False)
          self._diagPartOp(tensor, dtype, expected_ans, True)
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 4 other locations - About 35 mins to fix
      tensorflow/python/kernel_tests/array_ops/constant_op_eager_test.py on lines 545..547
      tensorflow/python/kernel_tests/array_ops/constant_op_test.py on lines 732..734
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 938..940
      tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5062..5064

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

          x = np.array([[[1.1, 2.2], [3.3, 4.4]], [[5.5, 6.6], [7.7, 8.8]]])
      Severity: Major
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 8 other locations - About 30 mins to fix
      tensorflow/python/kernel_tests/array_ops/batch_gather_op_test.py on lines 83..83
      tensorflow/python/kernel_tests/distributions/categorical_test.py on lines 423..423
      tensorflow/python/kernel_tests/distributions/categorical_test.py on lines 437..437
      tensorflow/python/kernel_tests/distributions/categorical_test.py on lines 449..449
      tensorflow/python/kernel_tests/linalg/matrix_triangular_solve_op_test.py on lines 136..136
      tensorflow/python/kernel_tests/linalg/matrix_triangular_solve_op_test.py on lines 142..142
      tensorflow/python/ops/numpy_ops/np_math_ops_test.py on lines 361..361
      tensorflow/python/ops/weak_tensor_np_math_ops_test.py on lines 185..185

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 32.

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

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

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

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

      Refactorings

      Further Reading

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

                  v_diags = array_ops.matrix_diag(
                      vecs,
                      k=diags,
                      num_rows=solution.shape[-2],
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 30 mins to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 522..525

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 32.

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

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

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

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

      Refactorings

      Further Reading

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

                  v_diags = array_ops.matrix_diag(
                      vecs,
                      k=diags,
                      num_cols=solution.shape[-1],
      Severity: Minor
      Found in tensorflow/python/kernel_tests/array_ops/diag_op_test.py and 1 other location - About 30 mins to fix
      tensorflow/python/kernel_tests/array_ops/diag_op_test.py on lines 503..506

      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