librenms/librenms

View on GitHub

Showing 16,999 of 17,006 total issues

Method load_graph_definitions has 1568 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function load_graph_definitions($logarithmic = false, $tinylegend = false)
{
    global $GraphDefs, $MetaGraphDefs;

    $Canvas = 'FFFFFF';
Severity: Major
Found in includes/html/collectd/definitions.php - About 1 wk to fix

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

    $rrd_def = RrdDefinition::make()
        ->addDataset('IDBLBSe', 'GAUGE', 0, 125000000000)
        ->addDataset('IBLFh', 'DERIVE', 0, 125000000000)
        ->addDataset('IBLWn', 'DERIVE', 0, 125000000000)
        ->addDataset('SRows', 'COUNTER', 0, 125000000000)
    Severity: Major
    Found in includes/polling/applications/mysql.inc.php and 1 other location - About 6 days to fix
    includes/polling/applications/nfs-server.inc.php on lines 129..188

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

    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

    $rrd_def_array['proc4ops'] = RrdDefinition::make()
            ->addDataset('v4_op0-unused', 'COUNTER', 0, 125000000000)
            ->addDataset('v4_op1-unused', 'COUNTER', 0, 125000000000)
            ->addDataset('v4_op2-future', 'COUNTER', 0, 125000000000)
            ->addDataset('v4_access', 'COUNTER', 0, 125000000000)
    Severity: Major
    Found in includes/polling/applications/nfs-server.inc.php and 1 other location - About 6 days to fix
    includes/polling/applications/mysql.inc.php on lines 116..175

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

    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

    File api_functions.inc.php has 2053 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /*
     * LibreNMS
     *
    Severity: Major
    Found in includes/html/api_functions.inc.php - About 5 days to fix

      File definitions.php has 1971 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      // vim:fenc=utf-8:filetype=php:ts=4
      /*
       * Copyright (C) 2009  Bruno Prémont <bonbons AT linux-vserver.org>
      Severity: Major
      Found in includes/html/collectd/definitions.php - About 5 days to fix

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

        if ($components[$vars['poolid']]['type'] == 'f5-ltm-pool') {
            $array = $components[$vars['poolid']];
            // Define some error messages
            $error_poolaction = [];
            $error_poolaction[0] = 'Unused';
        includes/html/pages/device/loadbalancer/ltm_vs_pool.inc.php on lines 16..200

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

        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 ($components[$vars['poolid']]['type'] == 'f5-ltm-pool') {
            $array = $components[$vars['poolid']];
            // Define some error messages
            $error_poolaction = [];
            $error_poolaction[0] = 'Unused';
        Severity: Major
        Found in includes/html/pages/device/loadbalancer/ltm_vs_pool.inc.php and 1 other location - About 4 days to fix
        includes/html/pages/device/loadbalancer/ltm_pool_details.inc.php on lines 24..208

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

        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

        File functions.php has 1704 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * LibreNMS
         *
        Severity: Major
        Found in includes/functions.php - About 4 days to fix

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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/fr/sensors.php and 5 other locations - About 4 days to fix
          resources/lang/de/sensors.php on lines 1..169
          resources/lang/it/sensors.php on lines 1..169
          resources/lang/uk/sensors.php on lines 1..169
          resources/lang/zh-CN/sensors.php on lines 1..169
          resources/lang/zh-TW/sensors.php on lines 1..169

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

          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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/it/sensors.php and 5 other locations - About 4 days to fix
          resources/lang/de/sensors.php on lines 1..169
          resources/lang/fr/sensors.php on lines 1..169
          resources/lang/uk/sensors.php on lines 1..169
          resources/lang/zh-CN/sensors.php on lines 1..169
          resources/lang/zh-TW/sensors.php on lines 1..169

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

          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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/zh-TW/sensors.php and 5 other locations - About 4 days to fix
          resources/lang/de/sensors.php on lines 1..169
          resources/lang/fr/sensors.php on lines 1..169
          resources/lang/it/sensors.php on lines 1..169
          resources/lang/uk/sensors.php on lines 1..169
          resources/lang/zh-CN/sensors.php on lines 1..169

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

          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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/zh-CN/sensors.php and 5 other locations - About 4 days to fix
          resources/lang/de/sensors.php on lines 1..169
          resources/lang/fr/sensors.php on lines 1..169
          resources/lang/it/sensors.php on lines 1..169
          resources/lang/uk/sensors.php on lines 1..169
          resources/lang/zh-TW/sensors.php on lines 1..169

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

          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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/uk/sensors.php and 5 other locations - About 4 days to fix
          resources/lang/de/sensors.php on lines 1..169
          resources/lang/fr/sensors.php on lines 1..169
          resources/lang/it/sensors.php on lines 1..169
          resources/lang/zh-CN/sensors.php on lines 1..169
          resources/lang/zh-TW/sensors.php on lines 1..169

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

          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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/de/sensors.php and 5 other locations - About 4 days to fix
          resources/lang/fr/sensors.php on lines 1..169
          resources/lang/it/sensors.php on lines 1..169
          resources/lang/uk/sensors.php on lines 1..169
          resources/lang/zh-CN/sensors.php on lines 1..169
          resources/lang/zh-TW/sensors.php on lines 1..169

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

          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

          $rrd_def = RrdDefinition::make()
              ->addDataset('deleted', 'DERIVE', 0)
              ->addDataset('evict_skip', 'DERIVE', 0)
              ->addDataset('mutex_skip', 'DERIVE', 0)
              ->addDataset('recycle_miss', 'DERIVE', 0)
          Severity: Major
          Found in includes/polling/applications/zfs.inc.php and 1 other location - About 4 days to fix
          includes/polling/applications/nfs-v3-stats.inc.php on lines 14..67

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

          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

          $rrd_def = RrdDefinition::make()
              ->addDataset('rc_hits', 'GAUGE', 0)
              ->addDataset('rc_misses', 'GAUGE', 0)
              ->addDataset('rc_nocache', 'GAUGE', 0)
              ->addDataset('fh_lookup', 'GAUGE', 0)
          Severity: Major
          Found in includes/polling/applications/nfs-v3-stats.inc.php and 1 other location - About 4 days to fix
          includes/polling/applications/zfs.inc.php on lines 28..81

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

          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

          <?php
          
          $name = 'fbsd-nfs-server';
          $app_id = $app['app_id'];
          $scale_min = 0;
          Severity: Major
          Found in includes/html/graphs/application/fbsd-nfs-server_stats.inc.php and 1 other location - About 4 days to fix
          includes/html/graphs/application/fbsd-nfs-client_stats.inc.php on lines 1..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 628.

          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

          <?php
          
          $name = 'fbsd-nfs-client';
          $app_id = $app['app_id'];
          $scale_min = 0;
          Severity: Major
          Found in includes/html/graphs/application/fbsd-nfs-client_stats.inc.php and 1 other location - About 4 days to fix
          includes/html/graphs/application/fbsd-nfs-server_stats.inc.php on lines 1..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 628.

          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

                      foreach ($rra as $rra_key => $dses) {
                          if (sizeof($dses)) {
                              foreach ($dses as $dskey => $ds) {
                                  printf(
                                      '%10s %16s %10s %7s %7s ' .
          Severity: Major
          Found in scripts/removespikes.php and 1 other location - About 3 days to fix
          scripts/removespikes.php on lines 676..708

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

          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

                      foreach ($rra as $rra_key => $dses) {
                          if (sizeof($dses)) {
                              foreach ($dses as $dskey => $ds) {
                                  printf(
                                      '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>' .
          Severity: Major
          Found in scripts/removespikes.php and 1 other location - About 3 days to fix
          scripts/removespikes.php on lines 622..654

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

          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

          Severity
          Category
          Status
          Source
          Language