librenms/librenms

View on GitHub

Showing 31,484 of 31,484 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

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

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

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

      <?php
      
      use LibreNMS\Config;
      
      $dest = device_by_id_cache($vars['dest']);
      Severity: Major
      Found in includes/html/graphs/smokeping/out.inc.php and 1 other location - About 5 days to fix
      includes/html/graphs/smokeping/in.inc.php on lines 1..97

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

      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
      
      use LibreNMS\Config;
      
      $src = device_by_id_cache($vars['src']);
      Severity: Major
      Found in includes/html/graphs/smokeping/in.inc.php and 1 other location - About 5 days to fix
      includes/html/graphs/smokeping/out.inc.php on lines 1..97

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

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

        Similar 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..218

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

        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 ($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 5 days to fix
        includes/html/pages/device/loadbalancer/ltm_pool_details.inc.php on lines 24..225

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

        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('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 4 days to fix
        includes/polling/applications/nfs-server.inc.php on lines 125..184

        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 4 days to fix
        includes/polling/applications/mysql.inc.php on lines 122..181

        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 settings.php has 1726 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        return [
            'title' => 'Settings',
            'readonly' => 'Set in config.php, remove from config.php to enable.',
        Severity: Major
        Found in lang/en/settings.php - About 4 days to fix

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

          <?php
          
          return [
              'config:get' => [
                  'description' => 'Отримати значення налаштування',
          Severity: Major
          Found in lang/uk/commands.php and 1 other location - About 4 days to fix
          lang/it/commands.php on lines 1..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 844.

          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
          
          return [
              'config:get' => [
                  'description' => 'Get configuration value',
          Severity: Major
          Found in lang/it/commands.php and 1 other location - About 4 days to fix
          lang/uk/commands.php on lines 1..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 844.

          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 settings.php has 1602 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          return [
              'title' => 'Settings',
              'readonly' => 'Set in config.php, remove from config.php to enable.',
          Severity: Major
          Found in lang/it/settings.php - About 4 days to fix

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

            <?php
            
            return [
            
                /*
            Severity: Major
            Found in lang/en/sensors.php and 2 other locations - About 4 days to fix
            lang/it/sensors.php on lines 1..194
            lang/uk/sensors.php on lines 1..194

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

            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

            <?php
            
            return [
            
                /*
            Severity: Major
            Found in lang/uk/sensors.php and 2 other locations - About 4 days to fix
            lang/en/sensors.php on lines 1..194
            lang/it/sensors.php on lines 1..194

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

            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

            <?php
            
            return [
            
                /*
            Severity: Major
            Found in lang/it/sensors.php and 2 other locations - About 4 days to fix
            lang/en/sensors.php on lines 1..194
            lang/uk/sensors.php on lines 1..194

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

            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 settings.php has 1585 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            return [
                'title' => 'Налаштування',
                'readonly' => 'Зазначено у config.php, для увімкнення видаліть з config.php.',
            Severity: Major
            Found in lang/uk/settings.php - About 4 days to fix

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

              $rrd_def = RrdDefinition::make()
                  ->addDataset('af_dcerpc_tcp', 'DERIVE', 0)
                  ->addDataset('af_dcerpc_udp', 'DERIVE', 0)
                  ->addDataset('af_dhcp', 'DERIVE', 0)
                  ->addDataset('af_dns_tcp', 'DERIVE', 0)
              Severity: Major
              Found in includes/polling/applications/suricata.inc.php and 1 other location - About 3 days to fix
              includes/polling/applications/privoxy.inc.php on lines 76..133

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

              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('block_percent', 'GAUGE', 0)
                  ->addDataset('blocks', 'GAUGE', 0)
                  ->addDataset('bytes_to_client', 'GAUGE', 0)
                  ->addDataset('client_cons', 'GAUGE', 0)
              Severity: Major
              Found in includes/polling/applications/privoxy.inc.php and 1 other location - About 3 days to fix
              includes/polling/applications/suricata.inc.php on lines 19..76

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

              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

              <?php
              
              return [
              
                  /*
              Severity: Major
              Found in lang/sr/sensors.php and 3 other locations - About 3 days to fix
              lang/de/sensors.php on lines 1..169
              lang/fr/sensors.php on lines 1..169
              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

              Severity
              Category
              Status
              Source
              Language