Showing 1,091 of 1,093 total issues
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">
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.css("left", Math.max(0, (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft()) + "px");
- 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 66.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.css("top", Math.max(0, (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop()) + "px");
- 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 66.
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
To group: <Selector id="groupselector"
options={Object.values(this.props.groups)}
value={this.state.selectedGroup}
defaultOption="select Group"
callbackFn={this.updateSelectedGroup}/>
- 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 66.
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
<p>Group name: <Selector id="groupselector"
options={Object.values(this.props.groups)}
value={this.state.selectedGroup}
defaultOption="select Group"
callbackFn={this.updateSelectedGroup}/>
- 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 66.
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