firehol/netdata

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

Summary

Maintainability
F
4 days
Test Coverage

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

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

package clickhouse

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

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

    var (
        chartInsertedBytes = module.Chart{
            ID:       "inserted_bytes",
            Title:    "Inserted data",
            Units:    "bytes/s",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 2 other locations - About 5 hrs to fix
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 617..674
    src/go/plugin/go.d/modules/uwsgi/charts.go on lines 41..98

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

    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

    var (
        chartSelectedBytes = module.Chart{
            ID:       "selected_bytes",
            Title:    "Selected data",
            Units:    "bytes/s",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 2 other locations - About 5 hrs to fix
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 558..615
    src/go/plugin/go.d/modules/uwsgi/charts.go on lines 41..98

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

    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

    func (c *ClickHouse) addDiskCharts(disk *seenDisk) {
        charts := diskChartsTmpl.Copy()
    
        for _, chart := range *charts {
            chart.ID = fmt.Sprintf(chart.ID, disk.disk)
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 2 other locations - About 2 hrs to fix
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 445..461
    src/go/plugin/go.d/modules/megacli/charts.go on lines 135..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 194.

    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 (
        chartUncompressedCacheRequests = module.Chart{
            ID:       "uncompressed_cache_requests",
            Title:    "Uncompressed cache requests",
            Units:    "requests/s",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 1 other location - About 2 hrs to fix
    src/go/plugin/go.d/modules/mysql/charts.go on lines 912..937

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

    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

        chartPartsCount = module.Chart{
            ID:       "parts_count",
            Title:    "Parts",
            Units:    "parts",
            Fam:      "parts",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 1 other location - About 1 hr to fix
    src/go/plugin/go.d/modules/windows/charts.go on lines 3585..3602

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

    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 (
        chartSlowReads = module.Chart{
            ID:       "slow_reads",
            Title:    "Slow reads from a file",
            Units:    "reads/s",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 1 other location - About 1 hr to fix
    src/go/plugin/go.d/modules/nvme/charts.go on lines 215..238

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

    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

        chartConnections = module.Chart{
            ID:       "connections",
            Title:    "Connections",
            Units:    "connections",
            Fam:      "conns",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 11 other locations - About 45 mins to fix
    src/go/plugin/go.d/modules/docker/charts.go on lines 47..61
    src/go/plugin/go.d/modules/docker/charts.go on lines 115..129
    src/go/plugin/go.d/modules/mongodb/charts.go on lines 267..281
    src/go/plugin/go.d/modules/nginxplus/charts.go on lines 680..694
    src/go/plugin/go.d/modules/postgres/charts.go on lines 305..319
    src/go/plugin/go.d/modules/rabbitmq/charts.go on lines 100..114
    src/go/plugin/go.d/modules/riakkv/charts.go on lines 328..342
    src/go/plugin/go.d/modules/riakkv/charts.go on lines 343..357
    src/go/plugin/go.d/modules/riakkv/charts.go on lines 358..372
    src/go/plugin/go.d/modules/uwsgi/charts.go on lines 182..196
    src/go/plugin/go.d/modules/vsphere/charts.go on lines 258..272

    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

        chartFileDescriptorIO = module.Chart{
            ID:       "file_descriptor_io",
            Title:    "Read and written data",
            Units:    "bytes/s",
            Fam:      "io",
    Severity: Minor
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 1 other location - About 40 mins to fix
    src/go/plugin/go.d/modules/snmp/charts.go on lines 36..48

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

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

        chartSelectQueries = module.Chart{
            ID:       "select_queries",
            Title:    "Select queries",
            Units:    "selects/s",
            Fam:      "queries",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 12 other locations - About 35 mins to fix
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 156..168
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 203..215
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 271..283
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 297..309
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 62..74
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 148..160
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 172..184
    src/go/plugin/go.d/modules/mongodb/charts.go on lines 294..306
    src/go/plugin/go.d/modules/nginxunit/charts.go on lines 33..45
    src/go/plugin/go.d/modules/postgres/charts.go on lines 190..202
    src/go/plugin/go.d/modules/postgres/charts.go on lines 630..642
    src/go/plugin/go.d/modules/postgres/charts.go on lines 688..700

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

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

        chartInsertQueries = module.Chart{
            ID:       "insert_queries",
            Title:    "Insert queries",
            Units:    "inserts/s",
            Fam:      "queries",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 12 other locations - About 35 mins to fix
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 156..168
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 203..215
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 271..283
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 284..296
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 62..74
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 148..160
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 172..184
    src/go/plugin/go.d/modules/mongodb/charts.go on lines 294..306
    src/go/plugin/go.d/modules/nginxunit/charts.go on lines 33..45
    src/go/plugin/go.d/modules/postgres/charts.go on lines 190..202
    src/go/plugin/go.d/modules/postgres/charts.go on lines 630..642
    src/go/plugin/go.d/modules/postgres/charts.go on lines 688..700

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

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

        chartQueries = module.Chart{
            ID:       "queries",
            Title:    "Queries",
            Units:    "queries/s",
            Fam:      "queries",
    Severity: Major
    Found in src/go/plugin/go.d/modules/clickhouse/charts.go and 12 other locations - About 35 mins to fix
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 156..168
    src/go/plugin/go.d/modules/cassandra/charts.go on lines 203..215
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 284..296
    src/go/plugin/go.d/modules/clickhouse/charts.go on lines 297..309
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 62..74
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 148..160
    src/go/plugin/go.d/modules/dovecot/charts.go on lines 172..184
    src/go/plugin/go.d/modules/mongodb/charts.go on lines 294..306
    src/go/plugin/go.d/modules/nginxunit/charts.go on lines 33..45
    src/go/plugin/go.d/modules/postgres/charts.go on lines 190..202
    src/go/plugin/go.d/modules/postgres/charts.go on lines 630..642
    src/go/plugin/go.d/modules/postgres/charts.go on lines 688..700

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

    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