torvalds/linux

View on GitHub
tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py

Summary

Maintainability
F
4 days
Test Coverage

File sharedbuffer_configuration.py has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# SPDX-License-Identifier: GPL-2.0

import subprocess
import json as j

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

    def get_tcbinds(ports, verify_existence=False):
        d = run_json_cmd("devlink sb tc bind show -j -n")
        tcbinds = TcBindList()
        for port in ports:
            err_msg = None
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.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 get_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_value(self, objid):
            if isinstance(objid, Pool):
                if objid["pool"] in [4, 8, 9, 10]:
                    # The threshold type of pools 4, 8, 9 and 10 cannot be changed
                    raise SkipTest()
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.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 do_check_tcbind has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def do_check_tcbind(ports, tcbinds, vp):
        for tcbind in tcbinds:
            pre_tcbinds = get_tcbinds(ports)
            try:
                (pool, th) = vp.get_value(tcbind)
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.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 get_portpools has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_portpools(ports, verify_existence=False):
        d = run_json_cmd("devlink sb port pool -j -n")
        portpools = PortPoolList()
        for port in ports:
            err_msg = None
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.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 do_check_pools has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def do_check_pools(dlname, pools, vp):
        for pool in pools:
            pre_pools = get_pools(dlname)
            try:
                (size, thtype) = vp.get_value(pool)
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.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 get_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_value(self, objid):
            if isinstance(objid, Pool) and objid["pool"] in [4, 8, 9, 10]:
                # The threshold type of pools 4, 8, 9 and 10 cannot be changed
                raise SkipTest()
            if isinstance(objid, TcBind) and objid["tc"] >= 8:
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        def _get_pool(self, direction):
            ing_pools = []
            egr_pools = []
            for pool in self._pools:
                if pool["type"] == "ingress":
    Severity: Minor
    Found in tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def get_portpools(ports, verify_existence=False):
        d = run_json_cmd("devlink sb port pool -j -n")
        portpools = PortPoolList()
        for port in ports:
            err_msg = None
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 249..261

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

    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 get_tcbinds(ports, verify_existence=False):
        d = run_json_cmd("devlink sb tc bind show -j -n")
        tcbinds = TcBindList()
        for port in ports:
            err_msg = None
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 321..333

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

    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 check_portpool(dlname, ports, pools):
        portpools = get_portpools(ports, verify_existence=True)
    
        # Save defaults
        record_vp = RecordValuePicker(portpools)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 290..301

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

    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 check_tcbind(dlname, ports, pools):
        tcbinds = get_tcbinds(ports, verify_existence=True)
    
        # Save defaults
        record_vp = RecordValuePicker(tcbinds)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 357..367

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

    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 __init__(self, port, d):
            super(PortPool, self).__init__(d)
            self["dlportname"] = port.name
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 233..235

    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

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

        def __init__(self, port, d):
            super(TcBind, self).__init__(d)
            self["dlportname"] = port.name
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 307..309

    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

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

            if portpool["threshold"] != th:
                err_msg = "Incorrect threshold (got {}, expected {})".format(portpool["threshold"], th)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 206..207
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 208..209
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 276..277
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 278..279

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

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

            if tcbind["threshold"] != th:
                err_msg = "Incorrect threshold (got {}, expected {})".format(tcbind["threshold"], th)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 206..207
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 208..209
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 276..277
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 345..346

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

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

            if tcbind["pool"] != pool:
                err_msg = "Incorrect pool (got {}, expected {})".format(tcbind["pool"], pool)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 206..207
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 208..209
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 278..279
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 345..346

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

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

            if pool["size"] != size:
                err_msg = "Incorrect pool size (got {}, expected {})".format(pool["size"], size)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 208..209
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 276..277
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 278..279
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 345..346

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

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

            if pool["thtype"] != thtype:
                err_msg = "Incorrect pool threshold type (got {}, expected {})".format(pool["thtype"], thtype)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 206..207
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 276..277
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 278..279
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 345..346

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

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

            log_test("tc bind {}-{} of sb {} set verification".format(tcbind["dlportname"],
                                                                      tcbind["tc"],
                                                                      tcbind["sb"]), err_msg)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 352..354

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

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

            log_test("port pool {}-{} of sb {} set verification".format(portpool["dlportname"],
                                                                        portpool["pool"],
                                                                        portpool["sb"]), err_msg)
    tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py on lines 285..287

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 34.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status