firehol/netdata

View on GitHub
src/go/plugin/go.d/modules/ceph/charts.go

Summary

Maintainability
C
7 hrs
Test Coverage

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

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

package ceph

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

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

    var clusterCharts = module.Charts{
        clusterStatusChart.Copy(),
        clusterHostsCountChart.Copy(),
        clusterMonitorsCountChart.Copy(),
        clusterOsdsCountChart.Copy(),
    Severity: Major
    Found in src/go/plugin/go.d/modules/ceph/charts.go and 1 other location - About 1 hr to fix
    src/go/plugin/go.d/modules/redis/charts.go on lines 43..73

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

    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

        clusterObjectsByStatusPercentChart = module.Chart{
            ID:       "cluster_objects_by_status",
            Title:    "Ceph Cluster Objects by Status",
            Fam:      "capacity",
            Units:    "percent",
    Severity: Major
    Found in src/go/plugin/go.d/modules/ceph/charts.go and 5 other locations - About 1 hr to fix
    src/go/plugin/go.d/modules/mongodb/charts.go on lines 191..205
    src/go/plugin/go.d/modules/oracledb/charts.go on lines 253..267
    src/go/plugin/go.d/modules/varnish/charts.go on lines 102..116
    src/go/plugin/go.d/modules/varnish/charts.go on lines 117..131
    src/go/plugin/go.d/modules/varnish/charts.go on lines 173..187

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

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

        osdStatusChartTmpl = module.Chart{
            ID:       "osd_%s_status",
            Title:    "Ceph OSD Status",
            Fam:      "osd",
            Units:    "status",
    Severity: Major
    Found in src/go/plugin/go.d/modules/ceph/charts.go and 7 other locations - About 40 mins to fix
    src/go/plugin/go.d/modules/beanstalk/charts.go on lines 148..162
    src/go/plugin/go.d/modules/ceph/charts.go on lines 143..157
    src/go/plugin/go.d/modules/ceph/charts.go on lines 287..301
    src/go/plugin/go.d/modules/megacli/charts.go on lines 28..42
    src/go/plugin/go.d/modules/rabbitmq/charts.go on lines 267..281
    src/go/plugin/go.d/modules/storcli/charts.go on lines 52..66
    src/go/plugin/go.d/modules/typesense/charts.go on lines 72..86

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

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

        clusterOsdsByStatusCountChart = module.Chart{
            ID:       "cluster_osds_by_status_count",
            Title:    "Ceph Cluster OSDs by Status",
            Fam:      "status",
            Units:    "osds",
    Severity: Major
    Found in src/go/plugin/go.d/modules/ceph/charts.go and 7 other locations - About 40 mins to fix
    src/go/plugin/go.d/modules/beanstalk/charts.go on lines 148..162
    src/go/plugin/go.d/modules/ceph/charts.go on lines 287..301
    src/go/plugin/go.d/modules/ceph/charts.go on lines 372..386
    src/go/plugin/go.d/modules/megacli/charts.go on lines 28..42
    src/go/plugin/go.d/modules/rabbitmq/charts.go on lines 267..281
    src/go/plugin/go.d/modules/storcli/charts.go on lines 52..66
    src/go/plugin/go.d/modules/typesense/charts.go on lines 72..86

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

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

        clusterPGsByStatusCountChart = module.Chart{
            ID:       "cluster_pgs_by_status_count",
            Title:    "Ceph Cluster Placement Groups by Status",
            Fam:      "capacity",
            Units:    "pgs",
    Severity: Major
    Found in src/go/plugin/go.d/modules/ceph/charts.go and 7 other locations - About 40 mins to fix
    src/go/plugin/go.d/modules/beanstalk/charts.go on lines 148..162
    src/go/plugin/go.d/modules/ceph/charts.go on lines 143..157
    src/go/plugin/go.d/modules/ceph/charts.go on lines 372..386
    src/go/plugin/go.d/modules/megacli/charts.go on lines 28..42
    src/go/plugin/go.d/modules/rabbitmq/charts.go on lines 267..281
    src/go/plugin/go.d/modules/storcli/charts.go on lines 52..66
    src/go/plugin/go.d/modules/typesense/charts.go on lines 72..86

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

    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