Showing 1,514 of 31,573 total issues
Function check_service
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
function check_service($command)
{
// This array is used to test for valid UOM's to be used for graphing.
// Valid values from: https://nagios-plugins.org/doc/guidelines.html#AEN200
// Note: This array must be decend from 2 char to 1 char so that the search works correctly.
- Read upRead up
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 alert_details
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
function alert_details($details)
{
if (is_string($details)) {
$details = json_decode(gzuncompress($details), true);
} elseif (! is_array($details)) {
- Read upRead up
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 common.php
has 559 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* LibreNMS - Common Functions
*
* Original Observium version by: Adam Armstrong, Tom Laermans
Function runRules
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
public function runRules($device_id)
{
//Check to see if under maintenance
if (AlertUtil::isMaintenance($device_id) > 0) {
echo "Under Maintenance, skipping alert rules check.\r\n";
- Read upRead up
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 ModuleTestHelper.php
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* ModuleTester.php
*
* -Description-
File queuemanager.py
has 549 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import threading
import traceback
from queue import Empty
from subprocess import CalledProcessError
Function collectd_draw_rrd
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
function collectd_draw_rrd($host, $plugin, $type, $pinst = null, $tinst = null, $opts = [])
{
$timespan_def = null;
$timespans = Config::get('timespan');
if (! isset($opts['timespan'])) {
- Read upRead up
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 process_syslog
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
function process_syslog($entry, $update)
{
global $dev_cache;
foreach (Config::get('syslog_filter') as $bi) {
- Read upRead up
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 ResolveGlues
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
function ResolveGlues($tables, $target, $x = 0, $hist = [], $last = [])
{
if (sizeof($tables) == 1 && $x != 0) {
if (dbFetchCell('SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_NAME = ? && COLUMN_NAME = ?', [$tables[0], $target]) == 1) {
return array_merge($last, [$tables[0] . '.' . $target]);
- Read upRead up
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 printEntPhysical
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
function printEntPhysical($device, $ent, $level, $class)
{
$ents = dbFetchRows('SELECT * FROM `entPhysical` WHERE device_id = ? AND entPhysicalContainedIn = ? ORDER BY entPhysicalContainedIn,entPhysicalIndex', [$device['device_id'], $ent]);
foreach ($ents as $ent) {
- Read upRead up
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 preCache
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
public static function preCache(OS $os)
{
// Pre-cache data for later use
$pre_cache = [];
$device = $os->getDeviceArray();
- Read upRead up
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 snmp.inc.php
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* LibreNMS - SNMP Functions
*
* Original Observium code by: Adam Armstrong, Tom Laermans
File command_runner.py
has 483 lines of code (exceeds 250 allowed). Consider refactoring. Open
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of command_runner module
Function get
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
public function get(Request $request, CustomMap $map): JsonResponse
{
$this->authorize('view', $map);
$edges = [];
- Read upRead up
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 discover
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
public static function discover(OS $os, $class, $yaml_data)
{
$pre_cache = $os->preCache();
$device = $os->getDeviceArray();
$items = [];
- Read upRead up
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 pollOS
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
public function pollOS(DataStorageInterface $datastore): void
{
// Polling the Wireless data TODO port to module
$apTable = snmpwalk_group($this->getDeviceArray(), 'hwWlanApName', 'HUAWEI-WLAN-AP-MIB', 2);
- Read upRead up
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 getData
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
private function getData()
{
if (($data = $this->read('irc')) !== false) {
$this->last_activity = time();
$this->data = $data;
- Read upRead up
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 Pmp.php
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Pmp.php
*
* Cambium
Method configDefinition
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function configDefinition($groups = null)
{
if ($groups === null || $groups === true) {
$groups = PollerGroup::list();
}
Function create_edit_bill
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
function create_edit_bill(Illuminate\Http\Request $request)
{
$data = json_decode($request->getContent(), true);
if (! $data) {
return api_error(500, 'Invalid JSON data');
- Read upRead up
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"