netdata/netdata

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

Summary

Maintainability
D
2 days
Test Coverage

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

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

package consul

import (
Severity: Minor
Found in src/go/collectors/go.d.plugin/modules/consul/charts.go - About 5 hrs to fix

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

    func (c *Consul) addLeaderCharts() {
        charts := serverLeaderCharts.Copy()
    
        for _, chart := range *charts {
            chart.Labels = []module.Label{
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 605..618

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

    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

    func (c *Consul) addServerAutopilotHealthCharts() {
        charts := serverAutopilotHealthCharts.Copy()
    
        for _, chart := range *charts {
            chart.Labels = []module.Label{
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 1 hr to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 679..692

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

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

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

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

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

    Refactorings

    Further Reading

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

        raftCommitTimeChart = module.Chart{
            ID:       "raft_commit_time",
            Title:    "Raft commit time",
            Units:    "ms",
            Fam:      "transaction timing",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 5 other locations - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 126..138
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 150..162
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 273..285
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 430..442
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 467..479

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

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

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

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

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

    Refactorings

    Further Reading

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

        raftBoltDBStoreLogsTimeChart = module.Chart{
            ID:       "raft_boltdb_store_logs_time",
            Title:    "Raft BoltDB store logs time",
            Units:    "ms",
            Fam:      "boltdb performance",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 5 other locations - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 126..138
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 150..162
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 175..187
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 273..285
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 430..442

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

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

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

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

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

    Refactorings

    Further Reading

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

        kvsApplyTimeChart = module.Chart{
            ID:       "kvs_apply_time",
            Title:    "KVS apply time",
            Units:    "ms",
            Fam:      "transaction timing",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 5 other locations - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 150..162
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 175..187
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 273..285
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 430..442
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 467..479

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

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

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

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

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

    Refactorings

    Further Reading

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

        raftRPCInstallSnapshotTimeChart = module.Chart{
            ID:       "raft_rpc_install_snapshot_time",
            Title:    "Raft RPC install snapshot time",
            Units:    "ms",
            Fam:      "raft replication capacity",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 5 other locations - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 126..138
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 150..162
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 175..187
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 273..285
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 467..479

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

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

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

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

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

    Refactorings

    Further Reading

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

        txnApplyTimeChart = module.Chart{
            ID:       "txn_apply_time",
            Title:    "Transaction apply time",
            Units:    "ms",
            Fam:      "transaction timing",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 5 other locations - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 126..138
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 175..187
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 273..285
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 430..442
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 467..479

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

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

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

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

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

    Refactorings

    Further Reading

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

        raftLeaderLastContactTimeChart = module.Chart{
            ID:       "raft_leader_last_contact_time",
            Title:    "Raft leader last contact time",
            Units:    "ms",
            Fam:      "leadership changes",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 5 other locations - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 126..138
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 150..162
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 175..187
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 430..442
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 467..479

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

    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

        raftThreadFSMSaturationPercChart = module.Chart{
            ID:       "raft_thread_fsm_saturation_perc",
            Title:    "Raft FSM thread saturation",
            Units:    "percentage",
            Fam:      "raft saturation",
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 381..393

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 117.

    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

        raftThreadMainSaturationPercChart = module.Chart{
            ID:       "raft_thread_main_saturation_perc",
            Title:    "Raft main thread saturation",
            Units:    "percentage",
            Fam:      "raft saturation",
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 394..406

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

    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

        networkLanRTTChart = module.Chart{
            ID:       "network_lan_rtt",
            Title:    "Network lan RTT",
            Units:    "ms",
            Fam:      "network rtt",
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 45 mins to fix
    src/go/collectors/go.d.plugin/modules/pihole/charts.go on lines 138..151

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

    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

    func (c *Consul) removeFollowerCharts() {
        s := make(map[string]bool)
        for _, v := range serverFollowerCharts {
            s[v.ID] = true
        }
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 35 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 694..706

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

    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

    func (c *Consul) removeLeaderCharts() {
        s := make(map[string]bool)
        for _, v := range serverLeaderCharts {
            s[v.ID] = true
        }
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 1 other location - About 35 mins to fix
    src/go/collectors/go.d.plugin/modules/consul/charts.go on lines 727..739

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

    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

        autopilotServerSerfStatusChart = module.Chart{
            ID:       "autopilot_server_serf_status",
            Title:    "Autopilot server Serf status",
            Units:    "status",
            Fam:      "autopilot",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/charts.go and 11 other locations - About 30 mins to fix
    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/envoy/charts.go on lines 92..105
    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

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

        serviceHealthCheckStatusChartTmpl = module.Chart{
            ID:       "health_check_%s_status",
            Title:    "Service health check status",
            Units:    "status",
            Fam:      "service health checks",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/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 544..557
    src/go/collectors/go.d.plugin/modules/envoy/charts.go on lines 92..105
    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

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

        nodeHealthCheckStatusChartTmpl = module.Chart{
            ID:       "health_check_%s_status",
            Title:    "Node health check status",
            Units:    "status",
            Fam:      "node health checks",
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/consul/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/envoy/charts.go on lines 92..105
    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