tensorflow/tensorflow

View on GitHub
tensorflow/python/ops/check_ops.py

Summary

Maintainability
F
1 wk
Test Coverage

File check_ops.py has 1864 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 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/check_ops.py - About 5 days to fix

    Function _binary_assert has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _binary_assert(sym, opname, op_func, static_func, x, y, data, summarize,
                       message, name):
      """Generic binary elementwise assertion.
    
      Implements the behavior described in _binary_assert_doc() above.
    Severity: Minor
    Found in tensorflow/python/ops/check_ops.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 _assert_ranks_condition has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _assert_ranks_condition(
        x, ranks, static_condition, dynamic_condition, data, summarize):
      """Assert `x` has a rank that satisfies a given condition.
    
      Args:
    Severity: Minor
    Found in tensorflow/python/ops/check_ops.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 _binary_assert has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _binary_assert(sym, opname, op_func, static_func, x, y, data, summarize,
    Severity: Major
    Found in tensorflow/python/ops/check_ops.py - About 1 hr to fix

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

      def assert_near(
      Severity: Major
      Found in tensorflow/python/ops/check_ops.py - About 1 hr to fix

        Function _assert_rank_condition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def _assert_rank_condition(
            x, rank, static_condition, dynamic_condition, data, summarize):
          """Assert `x` has a rank that satisfies a given condition.
        
          Args:
        Severity: Minor
        Found in tensorflow/python/ops/check_ops.py - About 55 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 assert_rank has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def assert_rank(x, rank, data=None, summarize=None, message=None, name=None):
          """Assert `x` has rank equal to `rank`.
        
          Example of adding a dependency to an operation:
        
        
        Severity: Minor
        Found in tensorflow/python/ops/check_ops.py - About 55 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 assert_near_v2 has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def assert_near_v2(x, y, rtol=None, atol=None, message=None, summarize=None,
        Severity: Major
        Found in tensorflow/python/ops/check_ops.py - About 50 mins to fix

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

          def assert_equal(x, y, data=None, summarize=None, message=None, name=None):  # pylint: disable=missing-docstring
          Severity: Minor
          Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

            def assert_rank(x, rank, data=None, summarize=None, message=None, name=None):
            Severity: Minor
            Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

              def _assert_ranks_condition(
              Severity: Minor
              Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                def assert_rank_in(
                Severity: Minor
                Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                  def assert_greater(x, y, data=None, summarize=None, message=None, name=None):  # pylint: disable=missing-docstring
                  Severity: Minor
                  Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                    def _assert_rank_condition(
                    Severity: Minor
                    Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                      def assert_rank_at_least(
                      Severity: Minor
                      Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                        def assert_less_equal(x, y, data=None, summarize=None, message=None, name=None):
                        Severity: Minor
                        Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if _has_known_value(actual_size) and _has_known_value(specified_size):
                                      if int(actual_size) != int(specified_size):
                                        raise ValueError(
                                            '%s%s.  Tensor %s dimension %s must have size %d.  '
                                            'Received size %d, shape %s' %
                          Severity: Major
                          Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      with ops.control_dependencies(rank_assertions):
                                        actual_size = sizes.actual_sizes[tensor_dim]
                                      if _has_known_value(actual_size) and _has_known_value(specified_size):
                            Severity: Major
                            Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        if _has_known_value(size_symbol):
                                          specified_size = int(size_symbol)
                                          size_check_message = 'Specified explicitly'
                                        else:
                                          specified_size, specified_by_y, specified_at_dim = (
                              Severity: Major
                              Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                          with ops.control_dependencies(rank_assertions):
                                            size = sizes.actual_sizes[tensor_dim]
                                          size_specifications[size_symbol] = (size, sizes.x, tensor_dim)
                                Severity: Major
                                Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                                  def assert_less(x, y, data=None, summarize=None, message=None, name=None):
                                  Severity: Minor
                                  Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                                    def assert_rank_in(
                                        x, ranks, data=None, summarize=None, message=None, name=None):
                                      """Assert `x` has rank in `ranks`.
                                    
                                      Example of adding a dependency to an operation:
                                    Severity: Minor
                                    Found in tensorflow/python/ops/check_ops.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 assert_none_equal has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    def assert_none_equal(
                                    Severity: Minor
                                    Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                if data is None:
                                                  data_ = [
                                                      message_prefix, size_check_message,
                                                      'Tensor %s dimension' % tensor_name(sizes.x), tensor_dim,
                                                      'must have size', specified_size, 'Received shape: ',
                                      Severity: Major
                                      Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                                        def _pretty_print(data_item, summarize):
                                          """Format a data item for use in an error message in eager mode.
                                        
                                          Args:
                                            data_item: One of the items in the "data" argument to an assert_* function.
                                        Severity: Minor
                                        Found in tensorflow/python/ops/check_ops.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 assert_greater_equal has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        def assert_greater_equal(x, y, data=None, summarize=None, message=None,
                                        Severity: Minor
                                        Found in tensorflow/python/ops/check_ops.py - About 45 mins to fix

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

                                          def assert_greater_equal_v2(x, y, message=None, summarize=None, name=None):
                                          Severity: Minor
                                          Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                            def assert_greater_v2(x, y, message=None, summarize=None, name=None):
                                            Severity: Minor
                                            Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                              def assert_non_positive(x, data=None, summarize=None, message=None, name=None):  # pylint: disable=missing-docstring
                                              Severity: Minor
                                              Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                def assert_equal_v2(x, y, message=None, summarize=None, name=None):
                                                Severity: Minor
                                                Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                  def assert_negative(x, data=None, summarize=None, message=None, name=None):  # pylint: disable=missing-docstring
                                                  Severity: Minor
                                                  Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                    def assert_none_equal_v2(x, y, summarize=None, message=None, name=None):
                                                    Severity: Minor
                                                    Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                      def assert_non_negative(x, data=None, summarize=None, message=None, name=None):  # pylint: disable=missing-docstring
                                                      Severity: Minor
                                                      Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                        def assert_shapes_v2(shapes, data=None, summarize=None, message=None,
                                                        Severity: Minor
                                                        Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                          def _make_assert_msg_data(sym, x, y, summarize, test_op):
                                                          Severity: Minor
                                                          Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                            def assert_shapes(shapes, data=None, summarize=None, message=None, name=None):
                                                            Severity: Minor
                                                            Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                              def assert_less_equal_v2(x, y, message=None, summarize=None, name=None):
                                                              Severity: Minor
                                                              Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                                def assert_positive(x, data=None, summarize=None, message=None, name=None):  # pylint: disable=missing-docstring
                                                                Severity: Minor
                                                                Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                                  def assert_less_v2(x, y, message=None, summarize=None, name=None):
                                                                  Severity: Minor
                                                                  Found in tensorflow/python/ops/check_ops.py - About 35 mins to fix

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

                                                                    def assert_rank_at_least(
                                                                        x, rank, data=None, summarize=None, message=None, name=None):
                                                                      """Assert `x` has rank equal to `rank` or higher.
                                                                    
                                                                      Example of adding a dependency to an operation:
                                                                    Severity: Minor
                                                                    Found in tensorflow/python/ops/check_ops.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 assert_near has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                    def assert_near(
                                                                        x, y, rtol=None, atol=None, data=None, summarize=None, message=None,
                                                                        name=None):
                                                                      """Assert the condition `x` and `y` are close element-wise.
                                                                    
                                                                    
                                                                    Severity: Minor
                                                                    Found in tensorflow/python/ops/check_ops.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