Showing 380 of 1,093 total issues
Method handleNodeStep1
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleNodeStep1($request, $context = null)
{
global $config; // Cacti config object
$hostId = -1;
Method interpretNodeSpec
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function interpretNodeSpec($input)
{
$endOffset = 'C';
$nodeName = $input;
$xOffset = 0;
Method updateNode
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateNode($nodeName, $params)
{
if (!$this->isLoaded()) {
throw new WeathermapInternalFail("Map must be loaded before editing API called.");
}
Method updateMapProperties
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateMapProperties($params)
{
if (!$this->isLoaded()) {
throw new WeathermapInternalFail("Map must be loaded before editing API called.");
}
Method readData
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readData($targetString, &$map, &$mapItem)
{
$this->data[IN] = null;
$this->data[OUT] = null;
Method handleNODES
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleNODES($fullcommand, $args, $matches)
{
$offsetDX = array();
$offsetDY = array();
$nodeNames = array();
Method colourFromValue
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function colourFromValue($value, $itemName = '', $isPercentage = true, $showScaleWarnings = true)
{
$scaleName = $this->name;
MapUtility::debug("Finding a colour for value %s in scale %s\n", $value, $this->name);
Method copyParamsFromCacti
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function copyParamsFromCacti($profileName, $hostId)
{
$params = array();
foreach ($this->snmpParamDefaults as $keyname => $default) {
Function validateRequest
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function validateRequest($action, $request)
{
if (!array_key_exists($action, $this->commands)) {
error_log("Given action does not exist!");
return false;
- 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 drawRealIcon
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function drawRealIcon(&$map, $iconColour)
{
$this->iconfile = $map->processString($this->iconfile, $this);
MapUtility::debug('Actual image-based icon from ' . $this->iconfile . " for $this->name\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
Function colourFromValue
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function colourFromValue($value, $itemName = '', $isPercentage = true, $showScaleWarnings = true)
{
$scaleName = $this->name;
MapUtility::debug("Finding a colour for value %s in scale %s\n", $value, $this->name);
- 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 getSNMPData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getSNMPData($host, $params, $oids, &$item, $timeout, $retries)
{
$channels = array(
'in' => IN,
'out' => OUT
- 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 ReadData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function ReadData($targetString, &$map, &$mapItem)
{
// By default, fail.
// Remove these 4 lines ONLY if you understand the risks, and have taken appropriate measures
// so that users (or the public) can't access your map editor! Otherwise they can run
- 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
Method testPoint
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testPoint()
{
$point1 = new Point(10, 13);
$point2 = new Point(-40, 40);
$point3 = new Point(30, 33);
Method runOutputTest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function runOutputTest($iconFileName, $imageFileName, $htmlFileName, $newConfigFileName)
{
$map = new Map();
$map->readConfig($iconFileName);
Method getSNMPData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSNMPData($host, $params, $oids, &$item, $timeout, $retries)
{
$channels = array(
'in' => IN,
'out' => OUT
Method outputMapViewHeader
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function outputMapViewHeader($pageTitle, $isCycling, $limitingToGroup)
{
\html_start_box($pageTitle, '100%', '', '3', 'center', '');
?>
<tr class="even">
Function attach_click_events
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function attach_click_events() {
jQuery("area[id^='LINK:']").attr("href", "#").click(click_handler);
jQuery("area[id^='NODE:']").attr("href", "#").click(click_handler);
jQuery("area[id^='TIMES']").attr("href", "#").click(position_timestamp);
Method editorData
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function editorData()
{
$newOutput = array(
"id" => "L" . $this->id,
"name" => $this->name,
Method parseString
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseString($input)
{
$output = array(); // Array of Output
$cPhraseQuote = null; // Record of the quote that opened the current phrase
$sPhrase = null; // Temp storage for the current phrase we are building