Showing 1,091 of 1,093 total issues
Method drawLegendHorizontal
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function drawLegendHorizontal($keyWidth = 400)
{
$title = $this->keytitle;
Function renameNode
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function renameNode($oldName, $newName)
{
if (!$this->map->nodeExists($oldName)) {
return $oldName;
}
- 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 dumpKeywords
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function dumpKeywords()
{
$count = 0;
print "# Complete configuration keyword list\n\n";
foreach ($this->configKeywords as $scope => $keywords) {
- 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 getAvailableImages
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getAvailableImages($imageDirectory, $map)
{
$imageList = array();
if (is_dir($imageDirectory)) {
- 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 UIBase.php
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Weathermap\UI;
use Weathermap\Core\WeathermapInternalFail;
Method mapSettings
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mapSettings(
$id
) {
if ($id == 0) {
$title = __('Additional settings for ALL maps');
Method readFromRealRRDtoolWithAggregate
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readFromRealRRDtoolWithAggregate(
$rrdfile,
$cf,
$aggregatefn,
$start,
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function makeURL($params, $altURL = "")
{
$baseURL = $this->myURL;
if ($altURL != "") {
$baseURL = $altURL;
- Read upRead up
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 142.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function makeURL($params, $altURL = "")
{
$baseURL = $this->myURL;
if ($altURL != "") {
$baseURL = $altURL;
- Read upRead up
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 142.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method readFromPollerOutput
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readFromPollerOutput($rrdfile, $cf, $start, $end, $dsnames, &$map, &$item)
{
global $config;
$pdo = weathermap_get_pdo();
Method showMainPage
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showMainPage($editor)
{
global $hostPluginURL;
global $hostEditorURL;
global $hostType;
Function generateOutlines
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function generateOutlines()
{
MapUtility::debug("Calculating angled-style outline\n");
foreach ($this->directions as $direction) {
- 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 initializeDatabase
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function initializeDatabase()
{
// only bother with all this if it's a new install, a new version, or we're in a development version
// - saves a handful of db hits per request!
- 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 main
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function main($request, $cookies, $fromPlugin = false)
{
$mapFileName = "";
$action = "";
- 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 drawLegendVertical
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function drawLegendVertical($keyHeight = 400, $inverted = false)
{
$title = $this->keytitle;
$nScales = $this->scale->spanCount();
File Runner.php
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Weathermap\CLI;
use GetOpt\GetOpt;
Method drawLabel
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function drawLabel(&$map, $textPoint, $backgroundColour, $nodeImageRef, $labelBox)
{
MapUtility::debug("Label colour is $backgroundColour\n");
// if there's an icon, then you can choose to have no background
Function handleInheritance
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function handleInheritance($inheritables, $params)
{
$defaultLink = $this->map->getLink("DEFAULT");
$defaultNode = $this->map->getNode("DEFAULT");
- 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 readData
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readData($targetString, &$map, &$mapItem)
{
$this->data[IN] = null;
$this->data[OUT] = null;
Method readData
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readData($targetString, &$map, &$mapItem)
{
$this->data[IN] = null;
$this->data[OUT] = null;