Showing 1,091 of 1,093 total issues
MapLink
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class MapLink extends MapDataItem
{
const FMT_BITS_IN = '{link:this:bandwidth_in:%2k}';
const FMT_BITS_OUT = '{link:this:bandwidth_out:%2k}';
const FMT_UNFORM_IN = '{link:this:bandwidth_in}';
File cacti-mapper.php
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
# defaults. Should be overwritten by the cacti config.
$cacti_base = '../../';
$cacti_url = '/';
Method __construct
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct()
{
parent::__construct();
$this->inheritedFieldList = array
Method createMissingTables
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createMissingTables($tables)
{
$databaseUpdates = array();
if (!in_array('weathermap_maps', $tables)) {
Method tidyOneLink
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function tidyOneLink($link, $linknumber = 1, $linktotal = 1)
{
if ($link->isTemplate()) {
return;
}
Method __construct
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($name, $template, $owner)
{
parent::__construct();
$this->name = $name;
Method testParameterValidation
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testParameterValidation()
{
$ui = new EditorUI();
$this->assertFalse($ui->validateArgument("", 10), "Blank type is always false");
MapDataItem
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class MapDataItem extends MapItem
{
// arrays to replace a lot of what follows. Paving the way for >2 channels of data.
// (and generally less duplicated code)
public $maxValues = array();
UIBase
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class UIBase
{
const ARG_OPTIONAL = 2;
const ARG_TYPE = 1;
const ARG_NAME = 0;
Method initializeDatabase
has 61 lines of code (exceeds 25 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!
Function updateNode
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function updateNode($nodeName, $params)
{
if (!$this->isLoaded()) {
throw new WeathermapInternalFail("Map must be loaded before editing API called.");
}
- 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 testProcessString
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testProcessString()
{
global $weathermap_debugging;
Method permissionsList
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function permissionsList(
$id
) {
$map = $this->manager->getMap($id);
$title = $map->titlecache;
Method testNotes
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testNotes()
{
$testSuiteRoot = realpath(dirname(__FILE__) . "/../../../") . "/test-suite";
$map = new Map();
Identical blocks of code found in 2 locations. Consider refactoring. Open
function weathermap_setup_table()
{
$dbversion = \read_config_option('weathermap_db_version');
$myversioninfo = weathermap_version();
- 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 128.
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
function weathermap_setup_table()
{
$dbversion = \read_config_option('weathermap_db_version');
$myversioninfo = weathermap_version();
- 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 128.
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 testLinkProperties
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testLinkProperties()
{
$editor = new Editor();
$editor->newConfig();
Function readData
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function readData($targetString, &$map, &$mapItem)
{
$this->data[IN] = null;
$this->data[OUT] = null;
- 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 testIndexOrphans
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function testIndexOrphans()
{
# Check that all the little config XML files actually appear somewhere in the index.xml
$docsIndex = $this->docsRoot . "/index.xml";
- 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 drawLabelRotated
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function drawLabelRotated($imageRef, $centre, $degreesAngle, $text, $padding, $direction)
{
$fontObject = $this->owner->fonts->getFont($this->bwfont);
list($strWidth, $strHeight) = $fontObject->calculateImageStringSize($text);