tensorflow/models

View on GitHub
official/nlp/modeling/layers/text_layers_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File text_layers_test.py has 457 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2024 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: Minor
Found in official/nlp/modeling/layers/text_layers_test.py - About 7 hrs to fix

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

      def test_special_tokens_in_estimator(self):
        """Tests getting special tokens without an Eager init context."""
        vocab_file = self._make_vocab_file(
            ["[PAD]", "[UNK]", "[CLS]", "[SEP]", "d", "##ef", "abc", "xy"])
    
    
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 3 days to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 97..130

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

    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 test_special_tokens_in_estimator(self):
        """Tests getting special tokens without an Eager init context."""
        vocab_file = self._make_vocab_file(
            ["[PAD]", "[UNK]", "[CLS]", "[SEP]", "d", "##ef", "abc", "xy"])
    
    
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 3 days to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 514..547

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

    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 test_cased(self):
        vocab_file = self._make_vocab_file(
            ["[PAD]", "[UNK]", "[CLS]", "[SEP]", "d", "##ef", "abc", "ABC"])
        bert_tokenize = text_layers.BertTokenizer(
            vocab_file=vocab_file, lower_case=False, tokenize_with_offsets=True)
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 1 day to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 476..488

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

    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 test_cased(self):
        vocab_file = self._make_vocab_file(
            ["[PAD]", "[UNK]", "[CLS]", "[SEP]", "d", "##ef", "abc", "ABC"])
        bert_tokenize = text_layers.FastWordpieceBertTokenizer(
            vocab_file=vocab_file, lower_case=False, tokenize_with_offsets=True)
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 1 day to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 60..72

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

    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

        bert_inputs = bpi([
            tf.ragged.constant([[[111], [112, 113]],
                                [[121, 122, 123], [124, 125, 126], [127, 128]]]),
            tf.ragged.constant([[[211, 212], [213]],
                                [[221, 222], [223, 224, 225], [226, 227, 228]]])
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 4 hrs to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 331..335

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

    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

        bert_inputs = bpi([
            tf.ragged.constant([[[111], [112, 113]],
                                [[121, 122, 123], [124, 125, 126], [127, 128]]]),
            tf.ragged.constant([[[211, 212], [213]],
                                [[221, 222], [223, 224, 225], [226, 227, 228]]])
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 4 hrs to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 389..393

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

    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 _make_vocab_file(self, vocab, filename="vocab.txt"):
        path = os.path.join(
            tempfile.mkdtemp(dir=self.get_temp_dir()),  # New subdir each time.
            filename)
        with tf.io.gfile.GFile(path, "w") as f:
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 4 hrs to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 33..39

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

    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 _make_vocab_file(self, vocab, filename="vocab.txt"):
        path = os.path.join(
            tempfile.mkdtemp(dir=self.get_temp_dir()),  # New subdir each time.
            filename)
        with tf.io.gfile.GFile(path, "w") as f:
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 4 hrs to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 449..455

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

    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 test_special_tokens_complete(self):
        vocab_file = self._make_vocab_file(
            ["foo", "[PAD]", "[UNK]", "[CLS]", "[SEP]", "[MASK]", "xy"])
        bert_tokenize = text_layers.FastWordpieceBertTokenizer(
            vocab_file=vocab_file, lower_case=True)
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 3 hrs to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 74..80

    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

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

      def test_special_tokens_complete(self):
        vocab_file = self._make_vocab_file(
            ["foo", "[PAD]", "[UNK]", "[CLS]", "[SEP]", "[MASK]", "xy"])
        bert_tokenize = text_layers.BertTokenizer(
            vocab_file=vocab_file, lower_case=True)
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 3 hrs to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 490..496

    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

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

        self.assertAllEqual(
            bert_inputs["input_mask"],
            tf.constant([[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
                         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 111, 112, 113, 1002, 211, 212, 1002, 311, 1002],
                         [1001, 121, 122, 123, 124, 125, 126, 1002, 1002, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 111, 112, 113, 1002, 211, 212, 213, 1002, 999],
                         [1001, 121, 122, 123, 124, 125, 126, 127, 1002, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_type_ids"],
            tf.constant([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 111, 112, 113, 1002, 211, 212, 213, 1002, 999],
                         [1001, 121, 122, 123, 124, 1002, 221, 222, 223, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 111, 112, 1002, 211, 212, 1002, 311, 312, 1002],
                         [1001, 121, 122, 1002, 221, 222, 1002, 321, 322, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 11, 12, 13, 1002, 999, 999, 999, 999, 999],
                         [1001, 21, 22, 23, 24, 25, 26, 27, 28, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_type_ids"],
            tf.constant([[0, 0, 0, 0, 0, 1, 1, 1, 1, 0],
                         [0, 0, 0, 0, 0, 0, 1, 1, 1, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_mask"],
            tf.constant([[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
                         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_type_ids"],
            tf.constant([[0, 0, 0, 0, 0, 1, 1, 1, 2, 2],
                         [0, 0, 0, 0, 0, 0, 0, 0, 1, 2]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 11, 12, 13, 1002, 999, 999, 999, 999, 999],
                         [1001, 21, 22, 23, 24, 25, 26, 27, 28, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_mask"],
            tf.constant([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
                         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_mask"],
            tf.constant([[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
                         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_mask"],
            tf.constant([[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
                         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_type_ids"],
            tf.constant([[0, 0, 0, 0, 0, 1, 1, 1, 1, 0],
                         [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_type_ids"],
            tf.constant([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428
    official/nlp/modeling/layers/text_layers_test.py on lines 440..443

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

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

        self.assertAllEqual(
            bert_inputs["input_word_ids"],
            tf.constant([[1001, 11, 12, 13, 1002, 999, 999, 999, 999, 999],
                         [1001, 21, 22, 23, 24, 25, 26, 27, 28, 1002]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 16 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 317..320
    official/nlp/modeling/layers/text_layers_test.py on lines 321..324
    official/nlp/modeling/layers/text_layers_test.py on lines 325..328
    official/nlp/modeling/layers/text_layers_test.py on lines 337..340
    official/nlp/modeling/layers/text_layers_test.py on lines 341..344
    official/nlp/modeling/layers/text_layers_test.py on lines 345..348
    official/nlp/modeling/layers/text_layers_test.py on lines 359..362
    official/nlp/modeling/layers/text_layers_test.py on lines 375..378
    official/nlp/modeling/layers/text_layers_test.py on lines 379..382
    official/nlp/modeling/layers/text_layers_test.py on lines 383..386
    official/nlp/modeling/layers/text_layers_test.py on lines 395..398
    official/nlp/modeling/layers/text_layers_test.py on lines 399..402
    official/nlp/modeling/layers/text_layers_test.py on lines 403..406
    official/nlp/modeling/layers/text_layers_test.py on lines 417..420
    official/nlp/modeling/layers/text_layers_test.py on lines 421..424
    official/nlp/modeling/layers/text_layers_test.py on lines 425..428

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

    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

        flags = dict(
            model_prefix=model_prefix,
            model_type="word",
            input=input_text_file_path,
            pad_id=0, unk_id=1, control_symbols="[CLS],[SEP],[MASK]",
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 1 hr to fix
    official/nlp/data/sentence_prediction_dataloader_test.py on lines 97..106

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

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

        self.assertAllEqual(limit_offsets, tf.ragged.constant([[[3], [5, 7]],
                                                               [[3], [5, 7], [9]]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 5 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 48..49
    official/nlp/modeling/layers/text_layers_test.py on lines 53..54
    official/nlp/modeling/layers/text_layers_test.py on lines 464..465
    official/nlp/modeling/layers/text_layers_test.py on lines 469..470
    official/nlp/modeling/layers/text_layers_test.py on lines 471..472

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

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

        self.assertAllEqual(start_offsets, tf.ragged.constant([[[0], [4, 5]],
                                                               [[0], [4, 5], [8]]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 5 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 48..49
    official/nlp/modeling/layers/text_layers_test.py on lines 53..54
    official/nlp/modeling/layers/text_layers_test.py on lines 55..56
    official/nlp/modeling/layers/text_layers_test.py on lines 464..465
    official/nlp/modeling/layers/text_layers_test.py on lines 471..472

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

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

        self.assertAllEqual(limit_offsets, tf.ragged.constant([[[3], [5, 7]],
                                                               [[3], [5, 7], [9]]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 5 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 48..49
    official/nlp/modeling/layers/text_layers_test.py on lines 53..54
    official/nlp/modeling/layers/text_layers_test.py on lines 55..56
    official/nlp/modeling/layers/text_layers_test.py on lines 464..465
    official/nlp/modeling/layers/text_layers_test.py on lines 469..470

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

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

        self.assertAllEqual(token_ids, tf.ragged.constant([[[6], [4, 5]],
                                                           [[6], [4, 5], [4]]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 5 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 53..54
    official/nlp/modeling/layers/text_layers_test.py on lines 55..56
    official/nlp/modeling/layers/text_layers_test.py on lines 464..465
    official/nlp/modeling/layers/text_layers_test.py on lines 469..470
    official/nlp/modeling/layers/text_layers_test.py on lines 471..472

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

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

        self.assertAllEqual(start_offsets, tf.ragged.constant([[[0], [4, 5]],
                                                               [[0], [4, 5], [8]]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 5 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 48..49
    official/nlp/modeling/layers/text_layers_test.py on lines 55..56
    official/nlp/modeling/layers/text_layers_test.py on lines 464..465
    official/nlp/modeling/layers/text_layers_test.py on lines 469..470
    official/nlp/modeling/layers/text_layers_test.py on lines 471..472

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

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

        self.assertAllEqual(token_ids, tf.ragged.constant([[[6], [4, 5]],
                                                           [[6], [4, 5], [4]]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 5 other locations - About 1 hr to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 48..49
    official/nlp/modeling/layers/text_layers_test.py on lines 53..54
    official/nlp/modeling/layers/text_layers_test.py on lines 55..56
    official/nlp/modeling/layers/text_layers_test.py on lines 469..470
    official/nlp/modeling/layers/text_layers_test.py on lines 471..472

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

    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

        SentencePieceTrainer.Train(
            " ".join(["--{}={}".format(k, v) for k, v in flags.items()]))
    Severity: Minor
    Found in official/nlp/modeling/layers/text_layers_test.py and 1 other location - About 55 mins to fix
    official/nlp/data/sentence_prediction_dataloader_test.py on lines 107..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 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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

        bert_inputs = bpi(
            tf.ragged.constant([[11, 12, 13],
                                [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 2 other locations - About 45 mins to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 372..374
    official/nlp/modeling/layers/text_layers_test.py on lines 437..439

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 35.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

        bert_inputs = bpi(
            tf.ragged.constant([[11, 12, 13],
                                [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 2 other locations - About 45 mins to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 314..316
    official/nlp/modeling/layers/text_layers_test.py on lines 372..374

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 35.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

        bert_inputs = bpi(
            tf.ragged.constant([[11, 12, 13],
                                [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]))
    Severity: Major
    Found in official/nlp/modeling/layers/text_layers_test.py and 2 other locations - About 45 mins to fix
    official/nlp/modeling/layers/text_layers_test.py on lines 314..316
    official/nlp/modeling/layers/text_layers_test.py on lines 437..439

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 35.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status