netdata/netdata

View on GitHub
src/go/collectors/go.d.plugin/modules/envoy/charts.go

Summary

Maintainability
F
4 days
Test Coverage

File charts.go has 823 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// SPDX-License-Identifier: GPL-3.0-or-later

package envoy

import (
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/envoy/charts.go - About 1 day to fix

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

    var (
        listenerDownstreamChartsTmpl = module.Charts{
            listenerDownstreamActiveConnectionsCountChartTmpl.Copy(),
            listenerDownstreamConnectionsRateChartTmpl.Copy(),
            listenerDownstreamDestroyedConnectionsRateChartTmpl.Copy(),
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/envoy/charts.go and 1 other location - About 1 day to fix
    src/go/collectors/go.d.plugin/modules/envoy/charts.go on lines 570..686

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

    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

    var (
        listenerAdminDownstreamChartsTmpl = module.Charts{
            listenerAdminDownstreamActiveConnectionsCountChartTmpl.Copy(),
            listenerAdminDownstreamConnectionsRateChartTmpl.Copy(),
            listenerAdminDownstreamDestroyedConnectionsRateChartTmpl.Copy(),
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/envoy/charts.go and 1 other location - About 1 day to fix
    src/go/collectors/go.d.plugin/modules/envoy/charts.go on lines 688..804

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

    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

        clusterMembershipUpdatesRateChartTmpl = module.Chart{
            ID:       "cluster_membership_updates_%s",
            Title:    "Cluster membership updates",
            Units:    "updates/s",
            Fam:      "cluster membership",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/envoy/charts.go and 2 other locations - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/envoy/charts.go on lines 541..554
    src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 423..436

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

    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

        listenerManagerListenerChangesRateChartTmpl = module.Chart{
            ID:       "listener_manager_listener_changes_%s",
            Title:    "Listener manager listener changes",
            Units:    "listeners/s",
            Fam:      "downstream mgr",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/envoy/charts.go and 2 other locations - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/envoy/charts.go on lines 506..519
    src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 423..436

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

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

        serverStateChartTmpl = module.Chart{
            ID:       "server_state_%s",
            Title:    "Server current state",
            Units:    "state",
            Fam:      "server",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/envoy/charts.go and 11 other locations - About 30 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 246..259
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 530..543
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 544..557
    src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 409..422
    src/go/collectors/go.d.plugin/modules/nvidia_smi/charts.go on lines 221..234
    src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 503..516
    src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 617..630
    src/go/collectors/go.d.plugin/modules/redis/charts.go on lines 88..101
    src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 86..99
    src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 188..201
    src/go/collectors/go.d.plugin/modules/vsphere/charts.go on lines 362..375

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

    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