tensorflow/tensorflow

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

Summary

Maintainability
F
2 wks
Test Coverage

File ops.py has 4545 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in tensorflow/python/framework/ops.py - About 1 wk to fix

    _EagerTensorBase has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class _EagerTensorBase(
        tensor_lib.Tensor, internal.NativeObject, core_tf_types.Value):
      """Base class for EagerTensor."""
    
      # __complex__, __int__, __float__ and __index__ may copy the tensor to CPU and
    Severity: Minor
    Found in tensorflow/python/framework/ops.py - About 4 hrs to fix

      Function create_op has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function convert_to_tensor has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Function _create_op_internal has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

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

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

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

              def internal_convert_n_to_tensor(
              Severity: Major
              Found in tensorflow/python/framework/ops.py - About 50 mins to fix

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

                def _create_c_op(graph,
                Severity: Minor
                Found in tensorflow/python/framework/ops.py - About 45 mins to fix

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

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

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

                      def __init__(self, device_name_or_function) -> None:
                        self._device_name_or_function = device_name_or_function
                        self.display_name = str(self._device_name_or_function)
                        self.function = device_name_or_function
                        self.raw_string = None
                    Severity: Minor
                    Found in tensorflow/python/framework/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 value_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def value_text(tensor, is_repr=False) -> AnyStr:
                      """Either the NumPy value or a custom TensorFlow formatting of `tensor`.
                    
                      Custom formatting is used for custom device tensors, e.g. parallel tensors
                      with multiple components on different devices.
                    Severity: Minor
                    Found in tensorflow/python/framework/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