tensorflow/tensorflow

View on GitHub
tensorflow/python/ops/ragged/ragged_bincount_ops_test.py

Summary

Maintainability
F
1 wk
Test Coverage

File ragged_bincount_ops_test.py has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2023 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/ops/ragged/ragged_bincount_ops_test.py - About 1 day to fix

    Function test_ragged_input has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def test_ragged_input(self,
    Severity: Major
    Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py - About 1 hr to fix

      Function test_weights has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def test_weights(
      Severity: Major
      Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py - About 50 mins to fix

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

          def test_binary_output(
        Severity: Minor
        Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py - About 45 mins to fix

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

            def test_axis_neg_1(self, tid, x_factory, minlength, maxlength, expected):
          Severity: Minor
          Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py - About 35 mins to fix

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

              def test_default(self, x_factory, minlength, maxlength, expected, tid=None):
            Severity: Minor
            Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py - About 35 mins to fix

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

                @parameterized.product(
                    (
                        dict(
                            tid="_r2",
                            x_factory=_ragged_factory([[], [1], [2, 2], [3, 3, 3]]),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 1 day to fix
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 516..607

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

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

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

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

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

              Refactorings

              Further Reading

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

              def _adjust_expected_rank1(x, minlength, maxlength):
                """Trim or pad an expected result based on minlength and maxlength."""
                n = len(x)
                if (minlength is not None) and (n < minlength):
                  x = x + [0] * (minlength - n)
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 2 other locations - About 6 hrs to fix
              tensorflow/python/ops/bincount_ops_test.py on lines 31..38
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 32..39

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

              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

                @parameterized.named_parameters(
                    {
                        "testcase_name": "_no_maxlength",
                        "x": [[], [], [3, 0, 1], [], [5, 0, 4, 4]],
                        "expected_indices": [[2, 0], [2, 1], [2, 3], [4, 0], [4, 4], [4, 5]],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 6 hrs to fix
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 202..409

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 98.

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

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

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

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

              Refactorings

              Further Reading

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

                        dict(minlength=None, maxlength=None),
                        dict(minlength=3, maxlength=None),
                        dict(minlength=5, maxlength=None),
                        dict(minlength=None, maxlength=3),
                        dict(minlength=None, maxlength=5),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 11 other locations - About 5 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 209..217
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 263..271
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 332..340
              tensorflow/python/ops/bincount_ops_test.py on lines 196..204
              tensorflow/python/ops/bincount_ops_test.py on lines 240..248
              tensorflow/python/ops/bincount_ops_test.py on lines 301..309
              tensorflow/python/ops/bincount_ops_test.py on lines 373..381
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 444..452
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 491..499
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 571..579
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 657..665

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

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

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

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

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

              Refactorings

              Further Reading

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

                        dict(minlength=None, maxlength=None),
                        dict(minlength=3, maxlength=None),
                        dict(minlength=5, maxlength=None),
                        dict(minlength=None, maxlength=3),
                        dict(minlength=None, maxlength=5),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 11 other locations - About 5 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 170..178
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 209..217
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 332..340
              tensorflow/python/ops/bincount_ops_test.py on lines 196..204
              tensorflow/python/ops/bincount_ops_test.py on lines 240..248
              tensorflow/python/ops/bincount_ops_test.py on lines 301..309
              tensorflow/python/ops/bincount_ops_test.py on lines 373..381
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 444..452
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 491..499
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 571..579
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 657..665

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

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

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

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

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

              Refactorings

              Further Reading

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

                        dict(minlength=None, maxlength=None),
                        dict(minlength=3, maxlength=None),
                        dict(minlength=5, maxlength=None),
                        dict(minlength=None, maxlength=3),
                        dict(minlength=None, maxlength=5),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 11 other locations - About 5 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 170..178
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 263..271
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 332..340
              tensorflow/python/ops/bincount_ops_test.py on lines 196..204
              tensorflow/python/ops/bincount_ops_test.py on lines 240..248
              tensorflow/python/ops/bincount_ops_test.py on lines 301..309
              tensorflow/python/ops/bincount_ops_test.py on lines 373..381
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 444..452
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 491..499
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 571..579
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 657..665

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

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

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

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

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

              Refactorings

              Further Reading

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

                        dict(minlength=None, maxlength=None),
                        dict(minlength=3, maxlength=None),
                        dict(minlength=5, maxlength=None),
                        dict(minlength=None, maxlength=3),
                        dict(minlength=None, maxlength=5),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 11 other locations - About 5 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 170..178
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 209..217
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 263..271
              tensorflow/python/ops/bincount_ops_test.py on lines 196..204
              tensorflow/python/ops/bincount_ops_test.py on lines 240..248
              tensorflow/python/ops/bincount_ops_test.py on lines 301..309
              tensorflow/python/ops/bincount_ops_test.py on lines 373..381
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 444..452
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 491..499
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 571..579
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 657..665

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

              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

                    }, {
                        "testcase_name": "_minlength_larger_values_weights",
                        "x": [[], [], [3, 0, 1], [7], [5, 0, 4, 4]],
                        "minlength": 3,
                        "expected_indices": [[2, 0], [2, 1], [2, 3], [3, 7], [4, 0], [4, 4],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 5 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 457..465

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

              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

                    }, {
                        "testcase_name": "_minlength_weights",
                        "x": [[], [], [3, 0, 1], [7], [5, 0, 4, 4]],
                        "minlength": 9,
                        "expected_indices": [[2, 0], [2, 1], [2, 3], [3, 7], [4, 0], [4, 4],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 5 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 466..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 91.

              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

                @parameterized.product(
                    (
                        dict(
                            tid="_r2",
                            x_factory=_ragged_factory([[], [1], [2, 2], [3, 3, 3]]),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 4 hrs to fix
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 411..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 80.

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

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

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

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

              Refactorings

              Further Reading

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

                @parameterized.product(
                    (
                        dict(
                            tid="_r2",
                            x_factory=_ragged_factory([[], [1], [2, 2], [3, 3, 3]]),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 4 hrs to fix
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 617..685

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 76.

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

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

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

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

              Refactorings

              Further Reading

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

                    }, {
                        "testcase_name": "_minlength_larger_values",
                        "x": [[], [], [3, 0, 1], [7], [5, 0, 4, 4]],
                        "minlength": 3,
                        "expected_indices": [[2, 0], [2, 1], [2, 3], [3, 7], [4, 0], [4, 4],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 3 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 393..400

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 72.

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

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

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

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

              Refactorings

              Further Reading

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

                    }, {
                        "testcase_name": "_minlength",
                        "x": [[], [], [3, 0, 1], [7], [5, 0, 4, 4]],
                        "minlength": 9,
                        "expected_indices": [[2, 0], [2, 1], [2, 3], [3, 7], [4, 0], [4, 4],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 3 hrs to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 401..408

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 72.

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

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

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

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

              Refactorings

              Further Reading

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

                  np_out = np.reshape(
                      np.concatenate([
                          np.bincount(inp[j, :], weights=np_weight[j, :], minlength=size)
                          for j in range(num_rows)
                      ],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 2 other locations - About 3 hrs to fix
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 310..315
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 780..785

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 68.

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

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

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

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

              Refactorings

              Further Reading

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

                  np_out = np.reshape(
                      np.concatenate(
                          [np.bincount(inp[j, :], minlength=size) for j in range(num_rows)],
                          axis=0), (num_rows, size))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 4 other locations - About 2 hrs to fix
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 279..282
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 528..531
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 757..760
              tensorflow/python/ops/bincount_ops_test.py on lines 132..135

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 56.

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

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

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

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

              Refactorings

              Further Reading

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

                @parameterized.product(
                    (
                        dict(
                            tid="_r2",
                            x_factory=_ragged_factory([[], [1], [2, 2], [3, 3, 3]]),
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 1 other location - About 2 hrs to fix
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 480..510

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

              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

                  expected_output = [
                      [0, 0, 0, 0, 0, 0],
                      [0, 0, 0, 0, 0, 0],
                      [1, 1, 0, 1, 0, 0],
                      [0, 0, 0, 0, 0, 0],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 5 other locations - About 1 hr to fix
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 696..698
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 712..714
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 734..736
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 77..82
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 99..104

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

              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

                  expected_output = [
                      [0, 0, 0, 0, 0, 0],
                      [0, 0, 0, 0, 0, 0],
                      [1, 1, 0, 1, 0, 0],
                      [0, 0, 0, 0, 0, 0],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 5 other locations - About 1 hr to fix
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 696..698
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 712..714
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 734..736
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 59..64
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 99..104

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

              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

                  expected_output = [
                      [0, 0, 0, 0, 0, 0],
                      [0, 0, 0, 0, 0, 0],
                      [.2, .3, 0, .1, 0, 0],
                      [0, 0, 0, 0, 0, 0],
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 5 other locations - About 1 hr to fix
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 696..698
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 712..714
              tensorflow/python/kernel_tests/math_ops/bincount_op_test.py on lines 734..736
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 59..64
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 77..82

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

              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 = sparse_ops.from_dense(
                      np.array([[3, 0, 1, 0], [0, 0, 0, 0], [5, 0, 4, 4]], dtype=np.int32))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 8 other locations - About 1 hr to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 545..546
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 700..701
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 720..721
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 727..728
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 729..730
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 736..737
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 738..739
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 744..745

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 42.

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

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

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

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

              Refactorings

              Further Reading

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

                  weights = sparse_ops.from_dense(
                      np.array([[3, 0, 1, 0], [0, 0, 0, 0], [5, 0, 4, 4]], dtype=np.int32))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 8 other locations - About 1 hr to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 531..532
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 700..701
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 720..721
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 727..728
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 729..730
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 736..737
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 738..739
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 744..745

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 42.

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

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

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

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

              Refactorings

              Further Reading

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

                  with self.assertRaisesRegex(errors.InvalidArgumentError,
                                              "must have the same row splits"):
                    self.evaluate(sparse_ops.sparse_bincount(x, weights=weights, axis=-1))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 3 other locations - About 45 mins to fix
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 711..714
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 731..733
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 749..751

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 35.

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

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

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

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

              Refactorings

              Further Reading

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

                  with self.assertRaisesRegex(ValueError, "must be a RaggedTensor"):
                    self.evaluate(sparse_ops.sparse_bincount(x, weights=weights, axis=-1))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 6 other locations - About 35 mins to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 527..528
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 534..535
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 547..548
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 702..703
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 711..717
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 723..724

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

                  with self.assertRaisesRegex(ValueError, "must be a SparseTensor"):
                    self.evaluate(sparse_ops.sparse_bincount(x, weights=weights, axis=-1))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 6 other locations - About 35 mins to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 527..528
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 540..541
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 547..548
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 702..703
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 711..717
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 723..724

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

                  with self.assertRaisesRegex(ValueError, "must be a tf.Tensor"):
                    self.evaluate(sparse_ops.sparse_bincount(x, weights=weights, axis=-1))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 6 other locations - About 35 mins to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 534..535
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 540..541
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 547..548
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 702..703
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 711..717
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 723..724

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

                  with self.assertRaisesRegex(ValueError, "must be a RaggedTensor"):
                    self.evaluate(sparse_ops.sparse_bincount(x, weights=weights, axis=-1))
              Severity: Major
              Found in tensorflow/python/ops/ragged/ragged_bincount_ops_test.py and 6 other locations - About 35 mins to fix
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 527..528
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 534..535
              tensorflow/python/ops/ragged/ragged_bincount_ops_test.py on lines 540..541
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 702..703
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 711..717
              tensorflow/python/ops/sparse_bincount_ops_test.py on lines 723..724

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 33.

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

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

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

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

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status