mfinzi/OMGchess

View on GitHub
chess/drn.py

Summary

Maintainability
F
1 wk
Test Coverage

File drn.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import pdb

import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
Severity: Minor
Found in chess/drn.py - About 3 hrs to fix

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

        def __init__(self, block, layers, num_classes=1000,
                     channels=(16, 32, 64, 128, 256, 512, 512, 512),
                     out_map=False, out_middle=False, pool_size=28, arch='D'):
            super(DRN, self).__init__()
            self.inplanes = channels[0]
    Severity: Minor
    Found in chess/drn.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        def __init__(self, block, layers, num_classes=1000,
    Severity: Major
    Found in chess/drn.py - About 1 hr to fix

      Function forward has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def forward(self, x):
              y = list()
      
              if self.arch == 'C':
                  x = self.conv1(x)
      Severity: Minor
      Found in chess/drn.py - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _make_layer(self, block, planes, blocks, stride=1, dilation=1,
      Severity: Major
      Found in chess/drn.py - About 50 mins to fix

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

            def __init__(self, inplanes, planes, stride=1, downsample=None,
        Severity: Minor
        Found in chess/drn.py - About 45 mins to fix

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

              def __init__(self, inplanes, planes, stride=1, downsample=None,
          Severity: Minor
          Found in chess/drn.py - About 45 mins to fix

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

                def _make_layer(self, block, planes, blocks, stride=1, dilation=1):
            Severity: Minor
            Found in chess/drn.py - About 35 mins to fix

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

              def conv3x3(in_planes, out_planes, stride=1, padding=1, dilation=1):
              Severity: Minor
              Found in chess/drn.py - About 35 mins to fix

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

                    def _make_layer(self, block, planes, blocks, stride=1, dilation=1,
                                    new_level=True, residual=True):
                        assert dilation == 1 or dilation % 2 == 0
                        downsample = None
                        if stride != 1 or self.inplanes != planes * block.expansion:
                Severity: Minor
                Found in chess/drn.py - About 25 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                        for m in self.modules():
                            if isinstance(m, nn.Conv2d):
                                n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
                                m.weight.data.normal_(0, math.sqrt(2. / n))
                            elif isinstance(m, BatchNorm):
                Severity: Major
                Found in chess/drn.py and 1 other location - About 7 hrs to fix
                chess/drn.py on lines 283..289

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

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

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

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

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

                Refactorings

                Further Reading

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

                        for m in self.modules():
                            if isinstance(m, nn.Conv2d):
                                n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
                                m.weight.data.normal_(0, math.sqrt(2. / n))
                            elif isinstance(m, BatchNorm):
                Severity: Major
                Found in chess/drn.py and 1 other location - About 7 hrs to fix
                chess/drn.py on lines 170..176

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

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

                def drn_d_40(pretrained=False, **kwargs):
                    model = DRN(BasicBlock, [1, 1, 3, 4, 6, 3, 2, 2], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-40']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_d_24(pretrained=False, **kwargs):
                    model = DRN(BasicBlock, [1, 1, 2, 2, 2, 2, 2, 2], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-24']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_c_42(pretrained=False, **kwargs):
                    model = DRN(BasicBlock, [1, 1, 3, 4, 6, 3, 1, 1], arch='C', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-c-42']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_d_54(pretrained=False, **kwargs):
                    model = DRN(Bottleneck, [1, 1, 3, 4, 6, 3, 1, 1], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-54']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_d_56(pretrained=False, **kwargs):
                    model = DRN(Bottleneck, [1, 1, 3, 4, 6, 3, 2, 2], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-56']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_d_22(pretrained=False, **kwargs):
                    model = DRN(BasicBlock, [1, 1, 2, 2, 2, 2, 1, 1], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-22']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_d_105(pretrained=False, **kwargs):
                    model = DRN(Bottleneck, [1, 1, 3, 4, 23, 3, 1, 1], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-105']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 411..415

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

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

                def drn_d_38(pretrained=False, **kwargs):
                    model = DRN(BasicBlock, [1, 1, 3, 4, 6, 3, 1, 1], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-38']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_c_58(pretrained=False, **kwargs):
                    model = DRN(Bottleneck, [1, 1, 3, 4, 6, 3, 1, 1], arch='C', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-c-58']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_c_26(pretrained=False, **kwargs):
                    model = DRN(BasicBlock, [1, 1, 2, 2, 2, 2, 1, 1], arch='C', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-c-26']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408
                chess/drn.py on lines 411..415

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

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

                def drn_d_107(pretrained=False, **kwargs):
                    model = DRN(Bottleneck, [1, 1, 3, 4, 23, 3, 2, 2], arch='D', **kwargs)
                    if pretrained:
                        model.load_state_dict(model_zoo.load_url(model_urls['drn-d-107']))
                    return model
                Severity: Major
                Found in chess/drn.py and 10 other locations - About 2 hrs to fix
                chess/drn.py on lines 341..345
                chess/drn.py on lines 348..352
                chess/drn.py on lines 355..359
                chess/drn.py on lines 362..366
                chess/drn.py on lines 369..373
                chess/drn.py on lines 376..380
                chess/drn.py on lines 383..387
                chess/drn.py on lines 390..394
                chess/drn.py on lines 397..401
                chess/drn.py on lines 404..408

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

                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.layer7 = None if layers[6] == 0 else \
                                self._make_layer(BasicBlock, channels[6], layers[6], dilation=2,
                Severity: Major
                Found in chess/drn.py and 1 other location - About 2 hrs to fix
                chess/drn.py on lines 157..158

                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

                            self.layer8 = None if layers[7] == 0 else \
                                self._make_layer(BasicBlock, channels[7], layers[7], dilation=1,
                Severity: Major
                Found in chess/drn.py and 1 other location - About 2 hrs to fix
                chess/drn.py on lines 154..155

                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

                            self.layer8 = None if layers[7] == 0 else \
                                self._make_conv_layers(channels[7], layers[7], dilation=1)
                Severity: Major
                Found in chess/drn.py and 1 other location - About 1 hr to fix
                chess/drn.py on lines 161..162

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 48.

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

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

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

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

                Refactorings

                Further Reading

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

                            self.layer7 = None if layers[6] == 0 else \
                                self._make_conv_layers(channels[6], layers[6], dilation=2)
                Severity: Major
                Found in chess/drn.py and 1 other location - About 1 hr to fix
                chess/drn.py on lines 163..164

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 48.

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

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

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

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

                Refactorings

                Further Reading

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

                        if self.layer6 is not None:
                            x = self.layer6(x)
                            y.append(x)
                Severity: Minor
                Found in chess/drn.py and 2 other locations - About 30 mins to fix
                chess/drn.py on lines 242..244
                chess/drn.py on lines 246..248

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 32.

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

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

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

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

                Refactorings

                Further Reading

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

                        if self.layer8 is not None:
                            x = self.layer8(x)
                            y.append(x)
                Severity: Minor
                Found in chess/drn.py and 2 other locations - About 30 mins to fix
                chess/drn.py on lines 238..240
                chess/drn.py on lines 242..244

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 32.

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

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

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

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

                Refactorings

                Further Reading

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

                        if self.layer7 is not None:
                            x = self.layer7(x)
                            y.append(x)
                Severity: Minor
                Found in chess/drn.py and 2 other locations - About 30 mins to fix
                chess/drn.py on lines 238..240
                chess/drn.py on lines 246..248

                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