tensorflow/tensorflow

View on GitHub
tensorflow/python/checkpoint/checkpoint.py

Summary

Maintainability
F
6 days
Test Coverage

File checkpoint.py has 2092 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Utilities for saving/loading Trackable objects."""
# Copyright 2017 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.
Severity: Major
Found in tensorflow/python/checkpoint/checkpoint.py - About 5 days to fix

    Function node_names has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def node_names(self):
        """Lazily creates a mapping from node id to ("path", "to", "root")."""
        if self._node_name_cache is not None:
          return self._node_name_cache
        path_to_root = {}
    Severity: Minor
    Found in tensorflow/python/checkpoint/checkpoint.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def __init__(self, object_graph_proto, save_path, save_path_tensor, reader,
    Severity: Major
    Found in tensorflow/python/checkpoint/checkpoint.py - About 1 hr to fix

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

      def add_variable(trackable,
      Severity: Minor
      Found in tensorflow/python/checkpoint/checkpoint.py - About 45 mins to fix

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

        def _default_getter(name,
        Severity: Minor
        Found in tensorflow/python/checkpoint/checkpoint.py - About 45 mins to fix

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

            def save(self,
          Severity: Minor
          Found in tensorflow/python/checkpoint/checkpoint.py - About 35 mins to fix

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

              def restore_saveables(
            Severity: Minor
            Found in tensorflow/python/checkpoint/checkpoint.py - About 35 mins to fix

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

                def __init__(self, expect_partial, object_graph_proto, matched_proto_ids,
              Severity: Minor
              Found in tensorflow/python/checkpoint/checkpoint.py - About 35 mins to fix

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

                  def __init__(self, checkpoint, feed_dict, graph_view, options):
                Severity: Minor
                Found in tensorflow/python/checkpoint/checkpoint.py - About 35 mins to fix

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

                    def _trackable_custom_creator(next_creator,
                  Severity: Minor
                  Found in tensorflow/python/checkpoint/checkpoint.py - About 35 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status