librenms/librenms

View on GitHub

Showing 12,937 of 12,937 total issues

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

<?php
require 'includes/html/graphs/common.inc.php';

if ($width > '500') {
    $descr_len = $bigdescrlen;
Severity: Major
Found in includes/html/graphs/generic_v3_multiline.inc.php and 1 other location - About 1 wk to fix
includes/html/graphs/generic_v3_multiline_float.inc.php on lines 1..114

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

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
require 'includes/html/graphs/common.inc.php';

if ($width > '500') {
    $descr_len = $bigdescrlen;
Severity: Major
Found in includes/html/graphs/generic_v3_multiline_float.inc.php and 1 other location - About 1 wk to fix
includes/html/graphs/generic_v3_multiline.inc.php on lines 1..114

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

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

Method load_graph_definitions has 1620 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

    <?php
    
    use LibreNMS\Config;
    
    $dest = device_by_id_cache($_GET['dest']);
    Severity: Major
    Found in includes/html/graphs/smokeping/out.inc.php and 1 other location - About 6 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 974.

    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($_GET['src']);
    Severity: Major
    Found in includes/html/graphs/smokeping/in.inc.php and 1 other location - About 6 days to fix
    includes/html/graphs/smokeping/out.inc.php on lines 1..98

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

    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', 'DERIVE', 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 130..189

    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 definitions.php has 2025 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>
     *
     * This program is free software; you can redistribute it and/or modify it under
    Severity: Major
    Found in includes/html/collectd/definitions.php - About 5 days to fix

      File api_functions.inc.php has 1936 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

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

        <?php
        /*
         * LibreNMS
         *
         * This program is free software: you can redistribute it and/or modify it
        Severity: Major
        Found in includes/html/table/mempool.inc.php and 1 other location - About 5 days to fix
        includes/html/table/storage.inc.php on lines 1..115

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

        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
        /*
         * LibreNMS
         *
         * This program is free software: you can redistribute it and/or modify it
        Severity: Major
        Found in includes/html/table/storage.inc.php and 1 other location - About 5 days to fix
        includes/html/table/mempool.inc.php on lines 1..106

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

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

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

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

          <?php
          /*
           * LibreNMS module to display Cisco Class-Based QoS Details
           *
           * Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
          Severity: Major
          Found in includes/html/graphs/port/cbqos_traffic.inc.php and 2 other locations - About 4 days to fix
          includes/html/graphs/port/cbqos_bufferdrops.inc.php on lines 1..99
          includes/html/graphs/port/cbqos_qosdrops.inc.php on lines 1..99

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

          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
          /*
           * LibreNMS module to display Cisco Class-Based QoS Details
           *
           * Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
          Severity: Major
          Found in includes/html/graphs/port/cbqos_qosdrops.inc.php and 2 other locations - About 4 days to fix
          includes/html/graphs/port/cbqos_bufferdrops.inc.php on lines 1..99
          includes/html/graphs/port/cbqos_traffic.inc.php on lines 1..99

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

          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
          /*
           * LibreNMS module to display Cisco Class-Based QoS Details
           *
           * Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
          Severity: Major
          Found in includes/html/graphs/port/cbqos_bufferdrops.inc.php and 2 other locations - About 4 days to fix
          includes/html/graphs/port/cbqos_qosdrops.inc.php on lines 1..99
          includes/html/graphs/port/cbqos_traffic.inc.php on lines 1..99

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

          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 = array ();
              $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..216

          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 = array ();
              $error_poolaction[0] = "Unused";
          includes/html/pages/device/loadbalancer/ltm_vs_pool.inc.php on lines 16..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

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

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/uk/sensors.php and 2 other locations - About 4 days to fix
          resources/lang/en/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 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/zh-TW/sensors.php and 2 other locations - About 4 days to fix
          resources/lang/en/sensors.php on lines 1..169
          resources/lang/uk/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 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
          
              /*
          Severity: Major
          Found in resources/lang/en/sensors.php and 2 other locations - About 4 days to fix
          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

          Severity
          Category
          Status
          Source
          Language