tensorflow/tensorflow

View on GitHub
tensorflow/python/ops/structured/structured_tensor_test.py

Summary

Maintainability
F
5 days
Test Coverage

File structured_tensor_test.py has 1644 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2019 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/structured/structured_tensor_test.py - About 4 days to fix

    StructuredTensorTest has 44 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class StructuredTensorTest(test_util.TensorFlowTestCase,
                               parameterized.TestCase):
    
      def assertAllEqual(self, a, b, msg=None):
        if not (isinstance(a, structured_tensor.StructuredTensor) or
    Severity: Minor
    Found in tensorflow/python/ops/structured/structured_tensor_test.py - About 6 hrs to fix

      Function testWithUpdatesDelete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def testWithUpdatesDelete(self):
          pyval = {"a": 12, "b": {"c": 23, "d": {"e": 11}}}
          st = StructuredTensor.from_pyval(pyval)
          updated_st = st.with_updates({("b", "c"): None}, validate=True)
          self.assertNotIn("c", updated_st.field_value("b").field_names())
      Severity: Minor
      Found in tensorflow/python/ops/structured/structured_tensor_test.py - About 1 hr to fix

        Function testFromFieldsErrors has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def testFromFieldsErrors(self,
        Severity: Major
        Found in tensorflow/python/ops/structured/structured_tensor_test.py - About 1 hr to fix

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

            def testFromFields(self,
                               shape,
                               fields,
                               expected_shape=None,
                               nrows=None,
          Severity: Minor
          Found in tensorflow/python/ops/structured/structured_tensor_test.py - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

            def testFromFields(self,
          Severity: Minor
          Found in tensorflow/python/ops/structured/structured_tensor_test.py - About 35 mins to fix

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

              def testFromFieldsErrors(self,
                                       fields,
                                       shape,
                                       nrows=None,
                                       row_partitions=None,
            Severity: Minor
            Found in tensorflow/python/ops/structured/structured_tensor_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

            There are no issues that match your filters.

            Category
            Status