netdata/netdata

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

Summary

Maintainability
C
1 day
Test Coverage

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

        Dims: module.Dims{
            {ID: "message_stats_ack", Name: "ack", Algo: module.Incremental},
            {ID: "message_stats_publish", Name: "publish", Algo: module.Incremental},
            {ID: "message_stats_publish_in", Name: "publish_in", Algo: module.Incremental},
            {ID: "message_stats_publish_out", Name: "publish_out", Algo: module.Incremental},
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go and 2 other locations - About 3 hrs to fix
src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 205..218
src/go/collectors/go.d.plugin/modules/proxysql/charts.go on lines 494..507

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

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

    chartTmplQueueMessagesRate = module.Chart{
        ID:       "queue_%s_vhost_%s_message_stats",
        Title:    "Queue messages rate",
        Units:    "messages/s",
        Fam:      "queue messages",
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go and 1 other location - About 2 hrs to fix
src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go on lines 245..263

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

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

    chartTmplVhostMessagesRate = module.Chart{
        ID:       "vhost_%s_message_stats",
        Title:    "Vhost messages rate",
        Units:    "messages/s",
        Fam:      "vhost messages",
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go and 1 other location - About 2 hrs to fix
src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go on lines 282..300

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

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

func (r *RabbitMQ) addVhostCharts(name string) {
    charts := chartsTmplVhost.Copy()

    for _, chart := range *charts {
        chart.ID = fmt.Sprintf(chart.ID, forbiddenCharsReplacer.Replace(name))
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go and 8 other locations - About 2 hrs to fix
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4592..4608
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4615..4631
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4638..4654
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4661..4677
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4684..4700
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4707..4723
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4730..4746
src/go/collectors/go.d.plugin/modules/windows/charts.go on lines 4753..4769

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

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

    chartObjectsCount = module.Chart{
        ID:       "objects_count",
        Title:    "Objects",
        Units:    "objects",
        Fam:      "objects",
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go and 6 other locations - About 45 mins to fix
src/go/collectors/go.d.plugin/modules/docker/charts.go on lines 47..61
src/go/collectors/go.d.plugin/modules/docker/charts.go on lines 115..129
src/go/collectors/go.d.plugin/modules/mongodb/charts.go on lines 267..281
src/go/collectors/go.d.plugin/modules/nginxplus/charts.go on lines 680..694
src/go/collectors/go.d.plugin/modules/postgres/charts.go on lines 305..319
src/go/collectors/go.d.plugin/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 3 locations. Consider refactoring.
Open

    chartTmplQueueMessagesCount = module.Chart{
        ID:       "queue_%s_vhost_%s_message_count",
        Title:    "Queue messages",
        Units:    "messages",
        Fam:      "queue messages",
Severity: Major
Found in src/go/collectors/go.d.plugin/modules/rabbitmq/charts.go and 2 other locations - About 40 mins to fix
src/go/collectors/go.d.plugin/modules/megacli/charts.go on lines 27..41
src/go/collectors/go.d.plugin/modules/storcli/charts.go on lines 31..45

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