tensorflow/tensorflow

View on GitHub
tensorflow/tools/compatibility/tf_upgrade_v2.py

Summary

Maintainability
F
2 wks
Test Coverage

File tf_upgrade_v2.py has 2113 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2018 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/tools/compatibility/tf_upgrade_v2.py - About 5 days to fix

    Function _string_split_rtype_transformer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _string_split_rtype_transformer(parent, node, full_name, name, logs):
      """Update tf.strings.split arguments: result_type, source."""
      # Remove the "result_type" argument.
      need_to_sparse = True
      for i, kw in enumerate(node.keywords):
    Severity: Minor
    Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 3 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 _pool_seed_transformer has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _pool_seed_transformer(parent, node, full_name, name, logs):
      """Removes seed2 and deterministic, and adds non-zero seed if needed."""
      # This requires that this function uses all kwargs (add to renames!).
      seed_arg = None
      deterministic = False
    Severity: Minor
    Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _string_split_transformer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def _string_split_transformer(parent, node, full_name, name, logs):
      """Update tf.string_split arguments: skip_empty, sep, result_type, source."""
      # Check the skip_empty parameter: if not false, then use compat.v1.
      for i, kw in enumerate(node.keywords):
        if kw.arg == "skip_empty":
    Severity: Minor
    Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _rename_if_arg_found_transformer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _rename_if_arg_found_transformer(parent, node, full_name, name, logs,
                                         arg_name=None,
                                         arg_ok_predicate=None,
                                         remove_if_ok=False,
                                         message=None):
    Severity: Minor
    Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def __init__(self, import_rename=False, upgrade_compat_v1_import=False):
        self.upgrade_compat_v1_import = upgrade_compat_v1_import
    
        # Maps from a function name to a dictionary that describes how to
        # map from an old argument keyword to the new argument keyword.
    Severity: Minor
    Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 1 hr to fix

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

      def _contrib_layers_variance_scaling_initializer_transformer(
          parent, node, full_name, name, logs):
        """Updates references to contrib.layers.variance_scaling_initializer.
      
        Transforms:
      Severity: Minor
      Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _softmax_cross_entropy_with_logits_transformer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _softmax_cross_entropy_with_logits_transformer(
          parent, node, full_name, name, logs):
        """Wrap labels argument with stop_gradients."""
        def _wrap_label(parent, old_value):
          """Wrap labels with tf.stop_gradient."""
      Severity: Minor
      Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _rename_if_arg_found_and_add_loss_reduction_transformer has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _rename_if_arg_found_and_add_loss_reduction_transformer(
      Severity: Major
      Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 1 hr to fix

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

        def _rename_if_any_arg_found_transformer(
        Severity: Major
        Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 1 hr to fix

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

          def _rename_if_arg_found_transformer(parent, node, full_name, name, logs,
          Severity: Major
          Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 1 hr to fix

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

            def _add_argument_transformer(parent, node, full_name, name, logs,
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 50 mins to fix

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

              def _add_summary_recording_cond_transformer(parent, node, full_name, name, logs,
              Severity: Minor
              Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 45 mins to fix

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

                def _contrib_layers_l2_regularizer_transformer(
                    parent, node, full_name, name, logs):
                  """Replace slim l2 regularizer with Keras one, with l=0.5*scale.
                
                  Also drops the scope argument.
                Severity: Minor
                Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _contrib_layers_xavier_initializer_transformer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _contrib_layers_xavier_initializer_transformer(
                Severity: Minor
                Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                  def _add_summary_step_transformer(parent, node, full_name, name, logs):
                  Severity: Minor
                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                    def _cast_transformer(parent, node, full_name, name, logs):
                    Severity: Minor
                    Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                      def _softmax_cross_entropy_with_logits_transformer(
                      Severity: Minor
                      Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                        def _rename_func(node, full_name, new_name, logs, reason):
                        Severity: Minor
                        Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                          def _string_split_transformer(parent, node, full_name, name, logs):
                          Severity: Minor
                          Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                            def _add_uniform_scaling_initializer_transformer(
                            Severity: Minor
                            Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                              def _name_scope_transformer(parent, node, full_name, name, logs):
                              Severity: Minor
                              Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                def _string_split_rtype_transformer(parent, node, full_name, name, logs):
                                Severity: Minor
                                Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                  def _dropout_transformer(parent, node, full_name, name, logs):
                                  Severity: Minor
                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                    def _image_resize_transformer(parent, node, full_name, name, logs):
                                    Severity: Minor
                                    Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                      def _contrib_layers_l2_regularizer_transformer(
                                      Severity: Minor
                                      Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                        def _pool_seed_transformer(parent, node, full_name, name, logs):
                                        Severity: Minor
                                        Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                          def _extract_glimpse_transformer(parent, node, full_name, name, logs):
                                          Severity: Minor
                                          Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                            def _contrib_layers_l1_regularizer_transformer(
                                            Severity: Minor
                                            Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                              def _iterator_transformer(parent, node, full_name, name, logs):
                                              Severity: Minor
                                              Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                                def _contrib_layers_variance_scaling_initializer_transformer(
                                                Severity: Minor
                                                Found in tensorflow/tools/compatibility/tf_upgrade_v2.py - About 35 mins to fix

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

                                                  def _contrib_layers_xavier_initializer_transformer(
                                                      parent, node, full_name, name, logs):
                                                    """Updates references to contrib.layers.xavier_initializer.
                                                  
                                                    Transforms:
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _extract_glimpse_transformer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  def _extract_glimpse_transformer(parent, node, full_name, name, logs):
                                                  
                                                    def _replace_uniform_noise_node(parent, old_value):
                                                      """Replaces old_value with 'uniform' or 'gaussian'."""
                                                      uniform = ast.Str(s="uniform")
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _contrib_layers_l1_regularizer_transformer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  def _contrib_layers_l1_regularizer_transformer(
                                                      parent, node, full_name, name, logs):
                                                    """Replace slim l1 regularizer with Keras one.
                                                  
                                                    This entails renaming the 'scale' arg to 'l' and dropping any
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.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 _image_resize_transformer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  def _image_resize_transformer(parent, node, full_name, name, logs):
                                                    """Transforms image.resize_* to image.resize(..., method=*, ...)."""
                                                    resize_method = name[7:].upper()
                                                    new_arg = ast.keyword(arg="method",
                                                                          value=ast.Attribute(
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.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

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

                                                    if len(node.args) == 2:
                                                      name_arg = ast.keyword(arg="name",
                                                                             value=node.args[-1])
                                                      node.args = node.args[:-1]
                                                      node.keywords.append(name_arg)
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 3 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1809..1813

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

                                                  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

                                                    if len(node.args) == 4:
                                                      pos_arg = ast.keyword(arg="preserve_aspect_ratio",
                                                                            value=node.args[-1])
                                                      node.args = node.args[:-1]
                                                      node.keywords.append(pos_arg)
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 3 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1733..1737

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

                                                  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

                                                  def _is_ast_false(node):
                                                    if hasattr(ast, "NameConstant"):
                                                      return isinstance(node, ast.NameConstant) and node.value is False
                                                    else:
                                                      return isinstance(node, ast.Name) and node.id == "False"
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 3 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1549..1553

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

                                                  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

                                                  def _is_ast_true(node):
                                                    if hasattr(ast, "NameConstant"):
                                                      return isinstance(node, ast.NameConstant) and node.value is True
                                                    else:
                                                      return isinstance(node, ast.Name) and node.id == "True"
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 3 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1556..1560

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

                                                  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

                                                  def _rename_if_arg_found_and_add_loss_reduction_transformer(
                                                      parent,
                                                      node,
                                                      full_name,
                                                      name,
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 2 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1965..2001

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

                                                  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

                                                  def _rename_if_any_arg_found_transformer(
                                                      parent,
                                                      node,
                                                      full_name,
                                                      name,
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 2 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2004..2041

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

                                                  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

                                                    if len(node.args) > 1:
                                                      node.args = node.args[:1]
                                                      logs.append((ast_edits.INFO, node.lineno, node.col_offset,
                                                                   "Dropping scope arg from tf.contrib.layers.l1_regularizer,"
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 2 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2317..2320

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

                                                    if len(node.args) > 1:
                                                      node.args = node.args[:1]
                                                      logs.append((ast_edits.INFO, node.lineno, node.col_offset,
                                                                   "Dropping scope arg from tf.contrib.layers.l2_regularizer,"
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 2 hrs to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2261..2264

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

                                                      self.function_transformers = {
                                                          "*.make_initializable_iterator": _iterator_transformer,
                                                          "*.make_one_shot_iterator": _iterator_transformer,
                                                          "tf.nn.dropout": _dropout_transformer,
                                                          "tf.to_bfloat16": _cast_transformer,
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 1 hr to fix
                                                  tensorflow/tools/compatibility/tf_upgrade.py on lines 101..148

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

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

                                                      for symbol, replacement in all_renames_v2.addons_symbol_mappings.items():
                                                        warning = (
                                                            ast_edits.WARNING, (
                                                                "(Manual edit required) `{}` has been migrated to `{}` in "
                                                                "TensorFlow Addons. The API spec may have changed during the "
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 1 hr to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2_safety.py on lines 35..42

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

                                                  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

                                                    if isinstance(node.func, ast.Attribute):
                                                      node.func.attr = "cast"
                                                    else:
                                                      assert isinstance(node.func, ast.Name)
                                                      node.func.id = "cast"
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 1 hr to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1831..1835

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

                                                  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

                                                    if len(node.args) >= 2:
                                                      new_keywords.append(ast.keyword(arg="seed", value=node.args[1]))
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 1 hr to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2131..2132

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

                                                  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

                                                    if len(node.args) >= 3:
                                                      new_keywords.append(ast.keyword(arg="dtype", value=node.args[2]))
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 1 hr to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2129..2130

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

                                                  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

                                                    if isinstance(node.func, ast.Attribute):
                                                      node.func.attr = "resize"
                                                    else:
                                                      assert isinstance(node.func, ast.Name)
                                                      node.func.id = "resize"
                                                  Severity: Major
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 1 hr to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1745..1749

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

                                                  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

                                                    if scope_keyword:
                                                      logs.append((ast_edits.INFO, node.lineno, node.col_offset,
                                                                   "Dropping scope arg from tf.contrib.layers.l2_regularizer,"
                                                                   " because it is unsupported in tf.keras.regularizers.l2\n"))
                                                      node.keywords.remove(scope_keyword)
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 45 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2256..2260

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

                                                    if scope_keyword:
                                                      logs.append((ast_edits.INFO, node.lineno, node.col_offset,
                                                                   "Dropping scope arg from tf.contrib.layers.l1_regularizer,"
                                                                   " because it is unsupported in tf.keras.regularizers.l1\n"))
                                                      node.keywords.remove(scope_keyword)
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 45 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2312..2316

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

                                                            logs.append((ast_edits.INFO, node.lineno, node.col_offset,
                                                                         "Removed argument %s for function %s" % (
                                                                             arg_name, full_name or name)))
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 40 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1958..1961

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

                                                  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

                                                    logs.append((
                                                        ast_edits.INFO, node.lineno, node.col_offset,
                                                        "Adding `%s` argument to %s in anticipation of it being renamed to "
                                                        "tf.compat.v2.summary.record_if()" % (cond, full_name or name)))
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 1 other location - About 40 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 1616..1618

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

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

                                                    if len(node.args) >= 2:
                                                      _replace_mode(node, node.args[1])
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 2 other locations - About 30 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2213..2214
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2308..2309

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

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

                                                    if len(node.args) >= 1:
                                                      _replace_scale_node(node, node.args[0])
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 2 other locations - About 30 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2211..2212
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2213..2214

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

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

                                                    if len(node.args) >= 3:
                                                      _replace_distribution(node, node.args[2])
                                                  Severity: Minor
                                                  Found in tensorflow/tools/compatibility/tf_upgrade_v2.py and 2 other locations - About 30 mins to fix
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2211..2212
                                                  tensorflow/tools/compatibility/tf_upgrade_v2.py on lines 2308..2309

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

                                                  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