librenms/librenms

View on GitHub

Showing 1,514 of 31,573 total issues

File Device.php has 798 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Models;

use App\View\SimpleTemplate;
Severity: Major
Found in app/Models/Device.php - About 1 day to fix

    File menu.blade.php has 784 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <nav class="navbar navbar-default {{ $navbar }} navbar-fixed-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse">
                    <span class="sr-only">{{ __('Toggle navigation') }}</span>
    Severity: Major
    Found in resources/views/layouts/menu.blade.php - About 1 day to fix

      File Timos.php has 756 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Timos.php
       *
       * -Description-
      Severity: Major
      Found in LibreNMS/OS/Timos.php - About 1 day to fix

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

        <?php
        
        use LibreNMS\Config;
        use LibreNMS\Enum\PortAssociationMode;
        use LibreNMS\RRD\RrdDefinition;
        Severity: Major
        Found in includes/polling/ports.inc.php - About 1 day to fix

          File bgp-peers.inc.php has 706 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          use Illuminate\Support\Str;
          use LibreNMS\Exceptions\InvalidIpException;
          use LibreNMS\RRD\RrdDefinition;
          Severity: Major
          Found in includes/polling/bgp-peers.inc.php - About 1 day to fix

            Function updateXML has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
            Open

            function updateXML(&$output, &$rra)
            {
                global $numspike, $percent, $avgnan, $method, $total_kills;
                $new_array = [];
            
            
            Severity: Minor
            Found in scripts/removespikes.php - About 1 day to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            File removespikes.php has 696 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #!/usr/bin/php -q
            <?php
            /*
             ex: set tabstop=4 shiftwidth=4 autoindent:
             +-------------------------------------------------------------------------+
            Severity: Major
            Found in scripts/removespikes.php - About 1 day to fix

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

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

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

                <?php
                /*
                 * 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/functions.php - About 1 day to fix

                  Function calculateOverallStatistics has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function calculateOverallStatistics(&$rra, &$samples)
                  {
                      global $percent, $stddev, $ds_min, $ds_max, $var_kills, $std_kills;
                  
                      $rra_num = 0;
                  Severity: Minor
                  Found in scripts/removespikes.php - About 1 day to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  File Ironware.php has 620 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * Ironware.php
                   *
                   * Brocade Ironware OS
                  Severity: Major
                  Found in LibreNMS/OS/Ironware.php - About 1 day to fix

                    Method pollOS has 272 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function pollOS(DataStorageInterface $datastore): void
                        {
                            $data = snmp_get_multi($this->getDeviceArray(), [
                                'panSessionActive.0',
                                'panSessionActiveTcp.0',
                    Severity: Major
                    Found in LibreNMS/OS/Panos.php - About 1 day to fix

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

                      <?php
                      
                      use LibreNMS\RRD\RrdDefinition;
                      
                      $name = 'bind';
                      Severity: Major
                      Found in includes/polling/applications/bind.inc.php - About 1 day to fix

                        Function runAlerts has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function runAlerts()
                            {
                                foreach ($this->loadAlerts('alerts.state != ' . AlertState::ACKNOWLEDGED . ' && alerts.open = 1') as $alert) {
                                    $noiss = false;
                                    $noacc = false;
                        Severity: Minor
                        Found in LibreNMS/Alert/RunAlerts.php - About 1 day to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function wrapper has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def wrapper(
                            wrapper_type,  # Type: str
                            amount_of_workers,  # Type: int
                            config,  # Type: dict
                            log_dir,  # Type: str
                        Severity: Minor
                        Found in LibreNMS/wrapper.py - About 1 day to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        File default.blade.php has 606 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        @extends('layouts.librenmsv1')
                        
                        @section('title', __('Overview'))
                        
                        @section('content')
                        Severity: Major
                        Found in resources/views/overview/default.blade.php - About 1 day to fix

                          Function checkSchema has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function checkSchema(): void
                              {
                                  $master_schema = Yaml::parse(file_get_contents($this->schema_file));
                                  $current_schema = Schema::dump();
                          
                          
                          Severity: Minor
                          Found in LibreNMS/Validations/Database/CheckSchemaStructure.php - About 1 day to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          File __init__.py has 598 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import json
                          import logging
                          import os
                          import sys
                          import tempfile
                          Severity: Major
                          Found in LibreNMS/__init__.py - About 1 day to fix

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

                            <?php
                            
                            $pagetitle[] = 'Apps';
                            $graphs['apache'] = [
                                'bits',
                            Severity: Major
                            Found in includes/html/pages/apps.inc.php - About 1 day to fix

                              File wrapper.py has 588 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              #! /usr/bin/env python3
                              """
                               wrapper        A small tool which wraps services, discovery and poller php scripts
                                              in order to run them as threads with Queue and workers
                              
                              
                              Severity: Major
                              Found in LibreNMS/wrapper.py - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language