Showing 6,805 of 6,805 total issues
Method DoPattern
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function DoPattern($aImg)
{
// "Fake" a nice 3D grid-effect.
$x0 = $this->rect->x + $this->rect->w / 2;
$y0 = $this->rect->y;
Consider simplifying this complex logical expression. Open
if (($ext == 'jpg' && !($supported & IMG_JPG)) ||
($ext == 'gif' && !($supported & IMG_GIF)) ||
($ext == 'png' && !($supported & IMG_PNG)) ||
($ext == 'bmp' && !($supported & IMG_WBMP)) ||
($ext == 'xpm' && !($supported & IMG_XPM))) {
Method StrokeLabels
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function StrokeLabels($label, $img, $a, $xp, $yp, $z)
{
$this->value->halign = 'left';
$this->value->valign = 'top';
Method AddSliceToCSIM
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea)
{
//Slice number, ellipse centre (x,y), height, width, start angle, end angle
while ($sa > 2 * M_PI) {
$sa = $sa - 2 * M_PI;
Method _StrokeBuiltinFont
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _StrokeBuiltinFont($x, $y, $txt, $dir, $paragraph_align, &$aBoundingBox, $aDebug = false)
{
if (is_numeric($dir) && $dir != 90 && $dir != 0) {
Util\JpGraphError::RaiseL(25091);
}
Method imagettfbbox_fixed
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function imagettfbbox_fixed($size, $angle, $fontfile, $text)
{
if (!USE_LIBRARY_IMAGETTFBBOX) {
$bbox = @imagettfbbox($size, $angle, $fontfile, $text);
if ($bbox === false) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
for ($j = 0; $j < $nn; ++$j) {
// We want the non scaled original radius
$legr = $this->scale->RelTranslate($legdata[$j], $r / $scaling, $ri / $scaling);
$this->_StrokeWindLeg(
$dblImg,
- 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 120.
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
for ($j = 0; $j < $nn; ++$j) {
// We want the non scaled original radius
$legr = $this->scale->RelTranslate($legdata[$j], $r / $scaling, $ri / $scaling);
$this->_StrokeWindLeg(
$dblImg,
- 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 120.
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 Stroke
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function Stroke($img, $xscale, $yscale)
{
$ymin = $yscale->scale_abs[0];
if ($yscale->scale[0] < 0) {
$yzero = $yscale->Translate(0);
Method Color
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function Color($aColor)
{
if (is_string($aColor)) {
$matches = [];
// this regex will parse a color string and fill the $matches array as such:
Method __construct
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($aWidth = 300, $aHeight = 200, $aCachedName = '', $aTimeout = 0, $aInline = true)
{
$this->gDateLocale = new Util\DateLocale();
$this->gJpgDateLocale = new Util\DateLocale();
if (!is_numeric($aWidth) || !is_numeric($aHeight)) {
Function Stroke
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($img, $xscale, $yscale)
{
// Remeber base color and size
$bc = $this->arrow->iColor;
$bs = $this->arrow->iSize;
- 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 Legend
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function Legend($graph)
{
if ($this->grad && $this->legend != '' && !$this->fill) {
$color = [$this->grad_fromcolor, $this->grad_tocolor];
// In order to differentiate between gradients and cooors specified as an Image\RGB triple
- 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 FixupIndexes
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function FixupIndexes($aDataArray, $num)
{
$ret = [];
$keys = array_keys($aDataArray);
foreach ($aDataArray as $idx => $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
Function Max
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function Max()
{
list($xmax) = $this->plots[0]->Max();
$nmax = 0;
for ($i = 0; $i < safe_count($this->plots); ++$i) {
- 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 Stroke
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($aImg, $aXScale, $aYScale)
{
assert($this->prect != null);
if ($this->dir == HORIZONTAL) {
if ($this->min === 'min') {
- 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 StrokeFullSliceFrame
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function StrokeFullSliceFrame($img, $xc, $yc, $sa, $ea, $w, $h, $z, $edgecolor, $exploderadius, $fulledge)
{
$step = 0.02;
if ($exploderadius > 0) {
- 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 StyleLine
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function StyleLine($x1, $y1, $x2, $y2, $aStyle = '', $from_grid_class = false)
{
if ($this->line_weight <= 0) {
return;
}
- 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 Stroke
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($aImg, $x = null, $y = null)
{
if (is_numeric($x)) {
$this->x = round($x);
}
- 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 StrokeFrame
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function StrokeFrame()
{
if (!$this->doframe) {
return;
}
- 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"