librenms/librenms

View on GitHub
includes/html/pages/device/apps/cape.inc.php

Summary

Maintainability
F
6 days
Test Coverage

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

        if ($vars['bypkg'] == 'on') {
            $label = '<span class="pagemenu-selected">On</span>';
            echo generate_link($label, $link_array, ['app' => 'cape', 'bypkg' => 'on', 'bytimeslot' => $vars['bytimeslot'], 'stddev' => $vars['stddev'], 'package' => $vars['package'], 'statsavg' => $vars['statsavg'], 'runstats' => $vars['runstats']]) . ', ' .
            generate_link('Off', $link_array, ['app' => 'cape', 'bypkg' => 'off', 'bytimeslot' => $vars['bytimeslot'], 'stddev' => $vars['stddev'], 'package' => $vars['package'], 'statsavg' => $vars['statsavg'], 'runstats' => $vars['runstats']]);
        } else {
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 2 other locations - About 1 day to fix
includes/html/pages/device/apps/cape.inc.php on lines 72..80
includes/html/pages/device/apps/cape.inc.php on lines 99..107

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

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 ($vars['bytimeslot'] == 'on') {
        $label = '<span class="pagemenu-selected">On</span>';
        echo generate_link($label, $link_array, ['app' => 'cape', 'bytimeslot' => 'on', 'bypkg' => $vars['bypkg'], 'stddev' => $vars['stddev'], 'package' => $vars['package'], 'statsavg' => $vars['statsavg'], 'runstats' => $vars['runstats']]) . ', ' .
        generate_link('Off', $link_array, ['app' => 'cape', 'bytimeslot' => 'off', 'bypkg' => $vars['bypkg'], 'stddev' => $vars['stddev'], 'package' => $vars['package'], 'statsavg' => $vars['statsavg'], 'runstats' => $vars['runstats']]);
    } else {
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 2 other locations - About 1 day to fix
includes/html/pages/device/apps/cape.inc.php on lines 85..93
includes/html/pages/device/apps/cape.inc.php on lines 99..107

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

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 ($vars['stddev'] == 'on') {
        $label = '<span class="pagemenu-selected">On</span>';
        echo generate_link($label, $link_array, ['app' => 'cape', 'stddev' => 'on', 'bypkg' => $vars['bypkg'], 'bytimeslot' => $vars['bytimeslot'], 'package' => $vars['package'], 'statsavg' => $vars['statsavg'], 'runstats' => $vars['runstats']]) . ', ' .
        generate_link('Off', $link_array, ['app' => 'cape', 'stddev' => 'off', 'bypkg' => $vars['bypkg'], 'bytimeslot' => $vars['bytimeslot'], 'package' => $vars['package'], 'statsavg' => $vars['statsavg'], 'runstats' => $vars['runstats']]);
    } else {
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 2 other locations - About 1 day to fix
includes/html/pages/device/apps/cape.inc.php on lines 72..80
includes/html/pages/device/apps/cape.inc.php on lines 85..93

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

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

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

        if ($vars['bytimeslot'] == 'on') {
            $graphs['cape_malscore'] = 'Malscore Stats During Time Slot';
            $graphs['cape_anti_issues'] = 'Anti Issues Per Run Stats During Time Slot';
            $graphs['cape_api_calls'] = 'API Calls Per Run Stats During Time Slot';
            $graphs['cape_crash_issues'] = 'Crash Issues Per Run Stats During Time Slot';
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 1 other location - About 2 hrs to fix
includes/html/pages/device/apps/cape.inc.php on lines 132..144

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

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

    if ($vars['bytimeslot'] == 'on') {
        $graphs['cape_malscore'] = 'Malscore Stats During Time Slot';
        $graphs['cape_anti_issues'] = 'Anti Issues Per Run Stats During Time Slot';
        $graphs['cape_api_calls'] = 'API Calls Per Run Stats During Time Slot';
        $graphs['cape_crash_issues'] = 'Crash Issues Per Run Stats During Time Slot';
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 1 other location - About 2 hrs to fix
includes/html/pages/device/apps/cape.inc.php on lines 205..217

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

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

    if ($vars['statsavg'] == 'on') {
        $graphs['cape_anti_issues_avg'] = 'Anti Issues Per Run Average';
        $graphs['cape_api_calls_avg'] = 'API Calls Per Run Stats Average';
        $graphs['cape_crash_issues_avg'] = 'Crash Issues Per Run Average';
        $graphs['cape_domains_avg'] = 'Domains Per Run Stats Average';
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 1 other location - About 2 hrs to fix
includes/html/pages/device/apps/cape.inc.php on lines 192..203

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

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

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

        if ($vars['statsavg'] == 'on') {
            $graphs['cape_anti_issues_avg'] = 'Anti Issues Per Run Average';
            $graphs['cape_api_calls_avg'] = 'API Calls Per Run Stats Average';
            $graphs['cape_crash_issues_avg'] = 'Crash Issues Per Run Average';
            $graphs['cape_domains_avg'] = 'Domains Per Run Stats Average';
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 1 other location - About 2 hrs to fix
includes/html/pages/device/apps/cape.inc.php on lines 145..156

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

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 ($vars['bypkg'] == 'on') {
            $graphs['cape_anti_issues_pkg'] = 'Anti Issues Per Run Stats During Time Slot By Package';
            $graphs['cape_api_calls_pkg'] = 'API Calls Per Run Stats During Time Slot By Package';
            $graphs['cape_crash_issues_pkg'] = 'Crash Issues Per Run Stats During Time Slot By Package';
            $graphs['cape_domains_pkg'] = 'Domains Per Run Stats During Time Slot By Package';
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 1 other location - About 1 hr to fix
includes/html/pages/device/apps/cape.inc.php on lines 168..178

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

        if ($vars['runstats'] == 'on') {
            $graphs['cape_banned'] = 'Banned Run Statuses Averages';
            $graphs['cape_running'] = 'Running Run Statuses Averages';
            $graphs['cape_completed'] = 'Completed Run Statuses Averages';
            $graphs['cape_distributed'] = 'Distributed Run Statuses Averages';
Severity: Major
Found in includes/html/pages/device/apps/cape.inc.php and 1 other location - About 1 hr to fix
includes/html/pages/device/apps/cape.inc.php on lines 180..190

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

There are no issues that match your filters.

Category
Status