tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/io_ops/reader_ops_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File reader_ops_test.py has 585 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

      def _CreateFiles(self, crlf=False):
        filenames = []
        for i in range(self._num_files):
          fn = os.path.join(self.get_temp_dir(), "text_line.%d.txt" % i)
          filenames.append(fn)
    Severity: Minor
    Found in tensorflow/python/kernel_tests/io_ops/reader_ops_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 testSerializeRestore has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def testSerializeRestore(self):
        reader = io_ops.IdentityReader("test_reader")
        produced = reader.num_records_produced()
        queue = data_flow_ops.FIFOQueue(99, [dtypes.string], shapes=())
        self.evaluate(queue.enqueue_many([["X", "Y", "Z"]]))
    Severity: Minor
    Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py - About 1 hr to fix

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

        def _CreateFiles(self, num_records, gap_bytes):
          filenames = []
          for i in range(self._num_files):
            fn = os.path.join(self.get_temp_dir(), "fixed_length_record.%d.txt" % i)
            filenames.append(fn)
      Severity: Minor
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.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

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

        @test_util.run_deprecated_v1
        def testReadGzipFiles(self):
          options = tf_record.TFRecordOptions(TFRecordCompressionType.GZIP)
          files = self._CreateFiles(options)
      
      
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 667..682

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

      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

        @test_util.run_deprecated_v1
        def testReadZlibFiles(self):
          options = tf_record.TFRecordOptions(TFRecordCompressionType.ZLIB)
          files = self._CreateFiles(options)
      
      
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 684..699

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

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

            with gzip.GzipFile(fn, "wb") as f:
              f.write(b"H" * self._header_bytes)
              if num_overlapped_records > 0:
                all_records_str = "".join([
                    str(i)[0]
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 2 other locations - About 7 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 451..460
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 503..512

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

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

            with open(fn, "wb") as f:
              f.write(b"H" * self._header_bytes)
              if num_overlapped_records > 0:
                all_records_str = "".join([
                    str(i)[0]
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 2 other locations - About 7 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 485..494
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 503..512

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

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

            with open(fn + ".tmp", "wb") as f:
              f.write(b"H" * self._header_bytes)
              if num_overlapped_records > 0:
                all_records_str = "".join([
                    str(i)[0]
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 2 other locations - About 7 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 451..460
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 485..494

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

      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 _CreateFiles(self, options=None, prefix=""):
          filenames = []
          for i in range(self._num_files):
            name = prefix + "tfrecord.%d.txt" % i
            records = [self._Record(i, j) for j in range(self._num_records)]
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/lib/io/tf_record_test.py on lines 74..81

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

      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

          for i in range(self._num_files):
            for j in range(num_overlapped_records):
              k, v = self.evaluate([key, value])
              self.assertAllEqual("%s:%d" % (files[i], j), compat.as_text(k))
              self.assertAllEqual(self._OverlappedRecord(i, j), v)
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 531..535

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

      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

          for i in range(self._num_files):
            for j in range(num_records):
              k, v = self.evaluate([key, value])
              self.assertAllEqual("%s:%d" % (files[i], j), compat.as_text(k))
              self.assertAllEqual(self._Record(i, j), v)
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 557..561

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

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

        def _ZlibCompressFile(self, infile, name="tfrecord.z"):
          # zlib compress the file and write compressed contents to file.
          with open(infile, "rb") as f:
            cdata = zlib.compress(f.read())
      
      
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 3 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 117..123
      tensorflow/python/lib/io/tf_record_test.py on lines 90..98
      tensorflow/python/lib/io/tf_record_test.py on lines 110..116

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

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

        def _ZlibDecompressFile(self, infile, name="tfrecord"):
          with open(infile, "rb") as f:
            cdata = zlib.decompress(f.read())
          fn = os.path.join(self.get_temp_dir(), name)
          with open(fn, "wb") as f:
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 3 other locations - About 4 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 97..105
      tensorflow/python/lib/io/tf_record_test.py on lines 90..98
      tensorflow/python/lib/io/tf_record_test.py on lines 110..116

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

      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 _GzipDecompressFile(self, infile, name="tfrecord"):
          with gzip.GzipFile(infile, "rb") as f:
            cdata = f.read()
          fn = os.path.join(self.get_temp_dir(), name)
          with open(fn, "wb") as f:
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 3 hrs to fix
      tensorflow/python/lib/io/tf_record_test.py on lines 118..124

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

      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 _GzipCompressFile(self, infile, name="tfrecord.gz"):
          # gzip compress the file and write compressed contents to file.
          with open(infile, "rb") as f:
            cdata = f.read()
      
      
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 3 hrs to fix
      tensorflow/python/lib/io/tf_record_test.py on lines 100..108

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

      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 _WriteRecordsToFile(self, records, name="tfrecord", options=None):
          fn = os.path.join(self.get_temp_dir(), name)
          with tf_record.TFRecordWriter(fn, options=options) as writer:
            for r in records:
              writer.write(r)
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 3 hrs to fix
      tensorflow/python/lib/io/tf_record_test.py on lines 83..88

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

      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

        @test_util.run_deprecated_v1
        def testZlibOneEpoch(self):
          for num_records in [0, 7]:
            # gap_bytes=0: hop_bytes=0
            # gap_bytes=1: hop_bytes=record_bytes+1
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 576..583

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

      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

        @test_util.run_deprecated_v1
        def testGzipOneEpoch(self):
          for num_records in [0, 7]:
            # gap_bytes=0: hop_bytes=0
            # gap_bytes=1: hop_bytes=record_bytes+1
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 585..592

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

      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

        def setUp(self):
          super(FixedLengthRecordReaderTest, self).setUp()
          self._num_files = 2
          self._header_bytes = 5
          self._record_bytes = 3
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 2 other locations - About 2 hrs to fix
      tensorflow/python/data/kernel_tests/fixed_length_record_dataset_test.py on lines 35..41
      tensorflow/python/distribute/input_ops_test.py on lines 35..41

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

      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

        @test_util.run_deprecated_v1
        def testZlibOneEpochWithHopBytes(self):
          for num_overlapped_records in [0, 2]:
            files = self._CreateZlibOverlappedRecordFiles(num_overlapped_records)
            self._TestOneEpochWithHopBytes(
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 600..605

      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

        @test_util.run_deprecated_v1
        def testGzipOneEpochWithHopBytes(self):
          for num_overlapped_records in [0, 2]:
            files = self._CreateGzipOverlappedRecordFiles(num_overlapped_records,)
            self._TestOneEpochWithHopBytes(
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 607..612

      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

        def _Record(self, f, r):
          return compat.as_bytes(str(f * 2 + r) * self._record_bytes)
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/data/kernel_tests/fixed_length_record_dataset_test.py on lines 43..44

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

      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 _CreateZlibFiles(self, num_records, gap_bytes):
          filenames = self._CreateFiles(num_records, gap_bytes)
          for fn in filenames:
            # compress inplace.
            self._ZlibCompressFile(fn, fn)
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 464..469

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

      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 _CreateGzipFiles(self, num_records, gap_bytes):
          filenames = self._CreateFiles(num_records, gap_bytes)
          for fn in filenames:
            # compress inplace.
            self._GzipCompressFile(fn, fn)
      Severity: Major
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 472..477

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

      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.assertAllEqual("%s:%d" % (files[i], j + 2), compat.as_text(k))
      Severity: Minor
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 55 mins to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 371..371

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

      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.assertAllEqual("%s:%d" % (files[i], j + 1), compat.as_text(k))
      Severity: Minor
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 1 other location - About 55 mins to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 398..398

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

      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

        def setUp(self):
          super(TextLineReaderTest, self).setUp()
          self._num_files = 2
          self._num_lines = 5
      Severity: Minor
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 2 other locations - About 30 mins to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 73..76
      tensorflow/python/lib/io/tf_record_test.py on lines 66..69

      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

        def setUp(self):
          super(TFCompressionTestCase, self).setUp()
          self._num_files = 2
          self._num_records = 7
      Severity: Minor
      Found in tensorflow/python/kernel_tests/io_ops/reader_ops_test.py and 2 other locations - About 30 mins to fix
      tensorflow/python/kernel_tests/io_ops/reader_ops_test.py on lines 339..342
      tensorflow/python/lib/io/tf_record_test.py on lines 66..69

      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