librenms/librenms

View on GitHub
includes/polling/wireless/canopy-generic.inc.php

Summary

Maintainability
F
4 days
Test Coverage

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

    if (strstr($hardware, 'PTP 230')) {
        $dbmRadio = str_replace('"', '', snmp_get($device, 'radioDbmInt.0', '-Ovqn', 'WHISP-SM-MIB'));
        $minRadio = str_replace('"', '', snmp_get($device, 'minRadioDbm.0', '-Ovqn', 'WHISP-SM-MIB'));
        $maxRadio = str_replace('"', '', snmp_get($device, 'maxRadioDbm.0', '-Ovqn', 'WHISP-SM-MIB'));
        $avgRadio = str_replace('"', '', snmp_get($device, 'radioDbmAvg.0', '-Ovqn', 'WHISP-SM-MIB'));
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 1 other location - About 1 day to fix
includes/polling/wireless/cambium-generic.inc.php on lines 223..246

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

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

    if (is_numeric($vertical) && is_numeric($horizontal) && is_numeric($combined)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('vertical', 'GAUGE', -150, 0)
            ->addDataset('horizontal', 'GAUGE', -150, 0)
            ->addDataset('combined', 'GAUGE', -150, 0);
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 1 other location - About 4 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 44..58

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

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

    if (is_numeric($visible) && is_numeric($tracked)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('visible', 'GAUGE', 0, 1000)
            ->addDataset('tracked', 'GAUGE', 0, 1000);
        $fields = [
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 1 other location - About 3 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 151..163

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

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

    if (is_numeric($horizontal) && is_numeric($vertical)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('horizontal', 'GAUGE', -100, 0)
            ->addDataset('vertical', 'GAUGE', -100, 0);
        $fields = [
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 3 other locations - About 2 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 86..98
includes/polling/wireless/cambium-generic.inc.php on lines 181..193
includes/polling/wireless/canopy-generic.inc.php on lines 88..101

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

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

    if (is_numeric($horizontal) && is_numeric($vertical)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('horizontal', 'GAUGE', -100, 100)
            ->addDataset('vertical', 'GAUGE', -100, 100);

Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 3 other locations - About 2 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 86..98
includes/polling/wireless/cambium-generic.inc.php on lines 181..193
includes/polling/wireless/canopy-generic.inc.php on lines 173..185

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

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

    if (is_numeric($horizontal) && is_numeric($vertical)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('horizontal', 'GAUGE', 0, 100)
            ->addDataset('vertical', 'GAUGE', 0, 100);
        $fields = [
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 6 other locations - About 2 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 16..28
includes/polling/wireless/cambium-generic.inc.php on lines 114..126
includes/polling/wireless/cambium-generic.inc.php on lines 197..209
includes/polling/wireless/cambium-generic.inc.php on lines 253..265
includes/polling/wireless/canopy-generic.inc.php on lines 16..29
includes/polling/wireless/canopy-generic.inc.php on lines 265..277

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

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

    if (is_numeric($fecInErrorsCount) && is_numeric($fecOutErrorsCount)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('fecInErrorsCount', 'GAUGE', 0, 100000)
            ->addDataset('fecOutErrorsCount', 'GAUGE', 0, 100000);

Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 6 other locations - About 2 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 16..28
includes/polling/wireless/cambium-generic.inc.php on lines 114..126
includes/polling/wireless/cambium-generic.inc.php on lines 197..209
includes/polling/wireless/cambium-generic.inc.php on lines 253..265
includes/polling/wireless/canopy-generic.inc.php on lines 117..129
includes/polling/wireless/canopy-generic.inc.php on lines 265..277

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

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

    if (is_numeric($registered) && is_numeric($failed)) {
        $rrd_def = RrdDefinition::make()
            ->addDataset('regCount', 'GAUGE', 0, 15000)
            ->addDataset('failed', 'GAUGE', 0, 15000);
        $fields = [
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 6 other locations - About 2 hrs to fix
includes/polling/wireless/cambium-generic.inc.php on lines 16..28
includes/polling/wireless/cambium-generic.inc.php on lines 114..126
includes/polling/wireless/cambium-generic.inc.php on lines 197..209
includes/polling/wireless/cambium-generic.inc.php on lines 253..265
includes/polling/wireless/canopy-generic.inc.php on lines 16..29
includes/polling/wireless/canopy-generic.inc.php on lines 117..129

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

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

    if (is_numeric($ssr)) {
        $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150);
        $fields = [
            'ssr' => $ssr,
        ];
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 3 other locations - About 55 mins to fix
includes/polling/wireless/cambium-generic.inc.php on lines 101..110
includes/polling/wireless/cambium-generic.inc.php on lines 212..221
includes/polling/wireless/canopy-generic.inc.php on lines 104..113

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

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

    if (is_numeric($ssr)) {
        $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150);
        $fields = [
            'ssr' => $ssr,
        ];
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 3 other locations - About 55 mins to fix
includes/polling/wireless/cambium-generic.inc.php on lines 101..110
includes/polling/wireless/cambium-generic.inc.php on lines 212..221
includes/polling/wireless/canopy-generic.inc.php on lines 217..226

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

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

    if (is_numeric($lastLevel)) {
        $rrd_def = RrdDefinition::make()->addDataset('last', 'GAUGE', -100, 0);
        $fields = [
            'last' => $lastLevel,
        ];
Severity: Minor
Found in includes/polling/wireless/canopy-generic.inc.php and 1 other location - About 55 mins to fix
includes/polling/wireless/cambium-generic.inc.php on lines 167..176

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

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

    if (is_numeric($jitter)) {
        $rrd_def = RrdDefinition::make()->addDataset('jitter', 'GAUGE', 0, 20);
        $fields = [
            'jitter' => $jitter,
        ];
Severity: Major
Found in includes/polling/wireless/canopy-generic.inc.php and 3 other locations - About 50 mins to fix
includes/polling/wireless/cambium-generic.inc.php on lines 61..70
includes/polling/wireless/cambium-generic.inc.php on lines 73..82
includes/polling/wireless/cambium-generic.inc.php on lines 138..147

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

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

    if (is_numeric($crcErrors)) {
        $rrd_def = RrdDefinition::make()->addDataset('crcErrors', 'GAUGE', 0, 100000);
        $fields = [
            'crcErrors' => $crcErrors,
        ];
Severity: Minor
Found in includes/polling/wireless/canopy-generic.inc.php and 2 other locations - About 40 mins to fix
includes/polling/wireless/cambium-epmp.inc.php on lines 88..96
includes/polling/wireless/cambium-generic.inc.php on lines 31..39

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

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