tensorflow/tensorflow

View on GitHub
tensorflow/python/distribute/vars_test.py

Summary

Maintainability
F
1 mo
Test Coverage

File vars_test.py has 1097 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/python/distribute/vars_test.py - About 2 days to fix

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

      def testAssignOnReadVar(self, distribution, experimental_run_tf_function):
    
        with distribution.scope():
          v_to_assign = variable_v1.VariableV1(
              2., aggregation=variables_lib.VariableAggregation.MEAN)
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testAssignPerReplicaVal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def testAssignPerReplicaVal(self, distribution, experimental_run_tf_function):
    
        if strategy_test_lib.is_tpu_strategy(distribution):
          self.skipTest("Assigning PerReplica values is not supported. See"
                        " sponge/80ba41f8-4220-4516-98ce-bbad48f9f11a.")
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testSaveAndRestoreOnRead has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def testSaveAndRestoreOnRead(self, strategy):
        aggregation = [variable_scope.VariableAggregation.SUM,
                       variable_scope.VariableAggregation.MEAN]
        for agg in aggregation:
          v_normal_restore = variables_lib.Variable(1.0)
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testAssignPerReplicaVal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def testAssignPerReplicaVal(self, distribution, experimental_run_tf_function):
    
        if strategy_test_lib.is_tpu_strategy(distribution):
          self.skipTest("Assigning PerReplica values is not supported. See"
                        " sponge/80ba41f8-4220-4516-98ce-bbad48f9f11a.")
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testAssign has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def testAssign(self, distribution, experimental_run_tf_function):
    
        def assign(fn, v, update_value, cross_replica):
          update_fn = lambda: getattr(v, fn)(update_value)
          if cross_replica:
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testAssignOnWriteVar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def testAssignOnWriteVar(self, distribution, experimental_run_tf_function):
    
        with distribution.scope():
          v_to_assign = variable_v1.VariableV1(
              2., aggregation=variables_lib.VariableAggregation.MEAN)
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testAssignDtypeConversion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def testAssignDtypeConversion(self, distribution,
                                    experimental_run_tf_function):
    
        def assign(fn, v, update_value, cross_replica):
          update_fn = lambda: getattr(v, fn)(update_value)
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testAssign has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def testAssign(self, distribution, experimental_run_tf_function):
    
        def assign(fn, v, update_value, cross_replica):
          update_fn = lambda: getattr(v, fn)(update_value)
          if cross_replica:
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.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 testReadValueInCrossReplicaContext has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def testReadValueInCrossReplicaContext(self, distribution,
                                             experimental_run_tf_function):
        aggregations = [
            variables_lib.VariableAggregation.SUM,
            variables_lib.VariableAggregation.MEAN,
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py - About 55 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

      def testReadValueInCrossReplicaContext(self, distribution,
                                             experimental_run_tf_function):
        aggregations = [
            variables_lib.VariableAggregation.NONE,
            variables_lib.VariableAggregation.SUM,
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

      def testReadValueInReplicaContext(self, distribution,
                                        experimental_run_tf_function):
        aggregations = [
            variables_lib.VariableAggregation.NONE,
            variables_lib.VariableAggregation.SUM,
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

      def testReadValueInReplicaContext(self, distribution,
                                        experimental_run_tf_function):
        aggregations = [
            variables_lib.VariableAggregation.NONE,
            variables_lib.VariableAggregation.SUM,
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

      @combinations.generate(strategy_and_run_tf_function_combinations())
      def testAssignDtypeConversion(self, distribution,
                                    experimental_run_tf_function):
    
        def assign(fn, v, update_value, cross_replica):
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 2 days to fix
    tensorflow/python/distribute/vars_test.py on lines 711..750

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

    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

      @combinations.generate(strategy_and_run_tf_function_combinations())
      def testAssign(self, distribution, experimental_run_tf_function):
    
        def assign(fn, v, update_value, cross_replica):
          update_fn = lambda: getattr(v, fn)(update_value)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 2 days to fix
    tensorflow/python/distribute/vars_test.py on lines 867..907

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

    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

      @combinations.generate(ms_combination)
      def testScatterMin(self, distribution):
        with distribution.scope():
          v1 = variables_lib.Variable(
              [0, 2, 0], aggregation=variables_lib.VariableAggregation.SUM)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 2 other locations - About 2 days to fix
    tensorflow/python/distribute/vars_test.py on lines 599..625
    tensorflow/python/distribute/vars_test.py on lines 627..653

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

    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

      @combinations.generate(ms_combination)
      def testScatterMax(self, distribution):
        with distribution.scope():
          v1 = variables_lib.Variable(
              [0, 0, 0], aggregation=variables_lib.VariableAggregation.SUM)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 2 other locations - About 2 days to fix
    tensorflow/python/distribute/vars_test.py on lines 571..597
    tensorflow/python/distribute/vars_test.py on lines 627..653

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

    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

      @combinations.generate(ms_combination)
      def testScatterUpdate(self, distribution):
        with distribution.scope():
          v1 = variables_lib.Variable(
              [0, 0, 0], aggregation=variables_lib.VariableAggregation.SUM)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 2 other locations - About 2 days to fix
    tensorflow/python/distribute/vars_test.py on lines 571..597
    tensorflow/python/distribute/vars_test.py on lines 599..625

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

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

      def testScatterDiv(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [2., 6., 1.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1208..1224
    tensorflow/python/distribute/vars_test.py on lines 1226..1242
    tensorflow/python/distribute/vars_test.py on lines 1262..1278
    tensorflow/python/distribute/vars_test.py on lines 1280..1296
    tensorflow/python/distribute/vars_test.py on lines 1298..1314
    tensorflow/python/distribute/vars_test.py on lines 1316..1332

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

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

      def testScatterUpdate(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [0., 0., 0.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1208..1224
    tensorflow/python/distribute/vars_test.py on lines 1226..1242
    tensorflow/python/distribute/vars_test.py on lines 1244..1260
    tensorflow/python/distribute/vars_test.py on lines 1262..1278
    tensorflow/python/distribute/vars_test.py on lines 1280..1296
    tensorflow/python/distribute/vars_test.py on lines 1298..1314

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

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

      def testScatterAdd(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [1., 1., 1.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1208..1224
    tensorflow/python/distribute/vars_test.py on lines 1244..1260
    tensorflow/python/distribute/vars_test.py on lines 1262..1278
    tensorflow/python/distribute/vars_test.py on lines 1280..1296
    tensorflow/python/distribute/vars_test.py on lines 1298..1314
    tensorflow/python/distribute/vars_test.py on lines 1316..1332

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

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

      def testScatterMax(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [3., 4., 5.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1208..1224
    tensorflow/python/distribute/vars_test.py on lines 1226..1242
    tensorflow/python/distribute/vars_test.py on lines 1244..1260
    tensorflow/python/distribute/vars_test.py on lines 1262..1278
    tensorflow/python/distribute/vars_test.py on lines 1280..1296
    tensorflow/python/distribute/vars_test.py on lines 1316..1332

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

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

      def testScatterSub(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [1., 1., 1.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1226..1242
    tensorflow/python/distribute/vars_test.py on lines 1244..1260
    tensorflow/python/distribute/vars_test.py on lines 1262..1278
    tensorflow/python/distribute/vars_test.py on lines 1280..1296
    tensorflow/python/distribute/vars_test.py on lines 1298..1314
    tensorflow/python/distribute/vars_test.py on lines 1316..1332

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

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

      def testScatterMin(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [3., 4., 5.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1208..1224
    tensorflow/python/distribute/vars_test.py on lines 1226..1242
    tensorflow/python/distribute/vars_test.py on lines 1244..1260
    tensorflow/python/distribute/vars_test.py on lines 1262..1278
    tensorflow/python/distribute/vars_test.py on lines 1298..1314
    tensorflow/python/distribute/vars_test.py on lines 1316..1332

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

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

      def testScatterMul(self, distribution, aggregation):
        with distribution.scope():
          v = variables_lib.Variable(
              [2., 1., 1.],
              synchronization=variables_lib.VariableSynchronization.ON_READ,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/distribute/vars_test.py on lines 1208..1224
    tensorflow/python/distribute/vars_test.py on lines 1226..1242
    tensorflow/python/distribute/vars_test.py on lines 1244..1260
    tensorflow/python/distribute/vars_test.py on lines 1280..1296
    tensorflow/python/distribute/vars_test.py on lines 1298..1314
    tensorflow/python/distribute/vars_test.py on lines 1316..1332

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

    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

      @combinations.generate(strategy_with_var_policy())
      def testValueInReplicaContext(self, distribution):
        with distribution.scope():
          v = variables_lib.Variable(
              1., aggregation=variables_lib.VariableAggregation.MEAN)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 7 hrs to fix
    tensorflow/python/distribute/vars_test.py on lines 242..258

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

    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

      @combinations.generate(strategy_with_var_policy())
      def testValueInReplicaContextAssignDirectValue(self, distribution,
                                                     use_var_policy):
        with distribution.scope():
          v = variables_lib.Variable(
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 7 hrs to fix
    tensorflow/python/distribute/vars_test.py on lines 225..240

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

    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

        with distribution.scope():
          v_to_assign = variable_v1.VariableV1(
              2., aggregation=variables_lib.VariableAggregation.MEAN)
          v_to_assign_sub = variable_v1.VariableV1(
              -2., aggregation=variables_lib.VariableAggregation.MEAN)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 127..131

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

    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

        with distribution.scope():
          v_to_assign = variable_v1.VariableV1(
              2., aggregation=variables_lib.VariableAggregation.MEAN)
          v_to_assign_sub = variable_v1.VariableV1(
              -2., aggregation=variables_lib.VariableAggregation.MEAN)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 755..759

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

    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

        @def_function.function
        def assign():
          ctx = distribute_lib.get_replica_context()
          replica_id = ctx.replica_id_in_sync_group
          return v.assign(math_ops.cast(replica_id, dtypes.float32))
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 1106..1110

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

    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

          @def_function.function
          def assign():
            ctx = distribute_lib.get_replica_context()
            replica_id = ctx.replica_id_in_sync_group
            return v.assign(math_ops.cast(replica_id, dtypes.float32))
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 353..357

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

    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

      @combinations.generate(
          combinations.combine(
              strategy=[
                  strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
                  strategy_combinations.tpu_strategy,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 417..427

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

    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

      @combinations.generate(
          combinations.combine(
              strategy=[
                  strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
                  strategy_combinations.tpu_strategy,
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 1124..1134

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

    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 assign(v=v):
            ctx = distribute_lib.get_replica_context()
            replica_id = ctx.replica_id_in_sync_group
            return v.assign(math_ops.cast(replica_id, dtypes.float32))
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 1046..1049

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

    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 assign(var=v):
            ctx = distribute_lib.get_replica_context()
            replica_id = ctx.replica_id_in_sync_group
            return var.assign(math_ops.cast(replica_id, dtypes.float32))
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/distribute/vars_test.py on lines 981..984

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

    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 component, value in zip(v._values, results):
            self.assertAllEqual(self.evaluate(component.read_value()), value)
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 50 mins to fix
    tensorflow/python/distribute/vars_test.py on lines 959..960

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

    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 component, value in zip(v._values, results):
            self.assertAllEqual(self.evaluate(component.read_value()), value)
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 50 mins to fix
    tensorflow/python/distribute/vars_test.py on lines 281..282

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

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

        with distribution.scope():
          v = variable_v1.VariableV1(
              15.,
              synchronization=variables_lib.VariableSynchronization.ON_WRITE,
              aggregation=variables_lib.VariableAggregation.ONLY_FIRST_REPLICA)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 7 other locations - About 40 mins to fix
    tensorflow/python/distribute/strategy_common_test.py on lines 418..422
    tensorflow/python/distribute/values_test.py on lines 492..496
    tensorflow/python/distribute/values_test.py on lines 563..567
    tensorflow/python/distribute/vars_test.py on lines 911..915
    tensorflow/python/distribute/vars_test.py on lines 924..928
    tensorflow/python/distribute/vars_test.py on lines 1006..1010
    tensorflow/python/distribute/vars_test.py on lines 1063..1067

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

        with distribution.scope():
          v = variable_v1.VariableV1(
              2.,
              synchronization=variables_lib.VariableSynchronization.ON_WRITE,
              aggregation=variables_lib.VariableAggregation.MEAN)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 7 other locations - About 40 mins to fix
    tensorflow/python/distribute/strategy_common_test.py on lines 418..422
    tensorflow/python/distribute/values_test.py on lines 492..496
    tensorflow/python/distribute/values_test.py on lines 563..567
    tensorflow/python/distribute/vars_test.py on lines 346..350
    tensorflow/python/distribute/vars_test.py on lines 911..915
    tensorflow/python/distribute/vars_test.py on lines 924..928
    tensorflow/python/distribute/vars_test.py on lines 1063..1067

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

        with distribution.scope():
          v = variable_v1.VariableV1(
              0.,
              synchronization=variables_lib.VariableSynchronization.ON_READ,
              aggregation=variables_lib.VariableAggregation.NONE)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 7 other locations - About 40 mins to fix
    tensorflow/python/distribute/strategy_common_test.py on lines 418..422
    tensorflow/python/distribute/values_test.py on lines 492..496
    tensorflow/python/distribute/values_test.py on lines 563..567
    tensorflow/python/distribute/vars_test.py on lines 346..350
    tensorflow/python/distribute/vars_test.py on lines 911..915
    tensorflow/python/distribute/vars_test.py on lines 924..928
    tensorflow/python/distribute/vars_test.py on lines 1006..1010

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

        with distribution.scope():
          v = variable_v1.VariableV1(
              0.,
              synchronization=variables_lib.VariableSynchronization.ON_READ,
              aggregation=variables_lib.VariableAggregation.SUM)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 7 other locations - About 40 mins to fix
    tensorflow/python/distribute/strategy_common_test.py on lines 418..422
    tensorflow/python/distribute/values_test.py on lines 492..496
    tensorflow/python/distribute/values_test.py on lines 563..567
    tensorflow/python/distribute/vars_test.py on lines 346..350
    tensorflow/python/distribute/vars_test.py on lines 924..928
    tensorflow/python/distribute/vars_test.py on lines 1006..1010
    tensorflow/python/distribute/vars_test.py on lines 1063..1067

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

        with distribution.scope():
          v = variable_v1.VariableV1(
              0.,
              synchronization=variables_lib.VariableSynchronization.ON_READ,
              aggregation=variables_lib.VariableAggregation.SUM)
    Severity: Major
    Found in tensorflow/python/distribute/vars_test.py and 7 other locations - About 40 mins to fix
    tensorflow/python/distribute/strategy_common_test.py on lines 418..422
    tensorflow/python/distribute/values_test.py on lines 492..496
    tensorflow/python/distribute/values_test.py on lines 563..567
    tensorflow/python/distribute/vars_test.py on lines 346..350
    tensorflow/python/distribute/vars_test.py on lines 911..915
    tensorflow/python/distribute/vars_test.py on lines 1006..1010
    tensorflow/python/distribute/vars_test.py on lines 1063..1067

    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

          if cross_replica:
            for component in v._values:
              self.assertAllEqual(expected_cross_replica.get(aggregation),
                                  self.evaluate(component.read_value()))
    Severity: Minor
    Found in tensorflow/python/distribute/vars_test.py and 1 other location - About 40 mins to fix
    tensorflow/python/distribute/vars_test.py on lines 803..810

    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

    There are no issues that match your filters.

    Category
    Status