mfinzi/OMGchess

View on GitHub

Showing 52 of 52 total issues

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

Severity: Major
Found in PGNeval.py and 1 other location - About 2 days to fix
chess/PGNeval.py on lines 0..41

Duplicated Code

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

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

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

Tuning

This issue has a mass of 220.

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

Severity: Major
Found in chess/PGNeval.py and 1 other location - About 2 days to fix
PGNeval.py on lines 0..41

Duplicated Code

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

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

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

Tuning

This issue has a mass of 220.

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

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

Function main has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    board = chess.Board()
    agent = 
    forced = False
    color = WHITE
Severity: Minor
Found in chess/uci.py - About 5 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

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

    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_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_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_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_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_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_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_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 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_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_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

    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

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

    Severity
    Category
    Status
    Source
    Language