HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if (empty($matches[5])) {
                $r = strlen($matches[2]) == 1 ? $matches[2] . $matches[2] : $matches[2];
                $g = strlen($matches[3]) == 1 ? $matches[3] . $matches[3] : $matches[3];
                $b = strlen($matches[4]) == 1 ? $matches[4] . $matches[4] : $matches[4];
                $r = hexdec($r);
Severity: Major
Found in src/util/RGB.php and 1 other location - About 1 day to fix
src/image/RGB.php on lines 509..523

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 284.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                } else {
                    // height is greater than width -> use y-dimension for steps
                    $steps = $yb - $yt;
                    $delta = $yb >= $yt ? 1 : -1;
                    $this->GetColArray($from_color, $to_color, $steps * 2, $colors, $this->numcolors);
Severity: Major
Found in src/plot/Gradient.php and 1 other location - About 1 day to fix
src/plot/Gradient.php on lines 293..333

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 276.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if ($xr - $xl > $yb - $yt) {
                    // width is greater than height -> use x-dimension for steps
                    $steps = $xr - $xl;
                    $delta = $xr >= $xl ? 1 : -1;
                    $this->GetColArray($from_color, $to_color, $steps * 2, $colors, $this->numcolors);
Severity: Major
Found in src/plot/Gradient.php and 1 other location - About 1 day to fix
src/plot/Gradient.php on lines 313..333

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 276.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if ($val > 0) {
                    $sp1[0] = $pts[6];
                    $sp1[1] = $pts[7];
                    $sp1[2] = $pts[4];
                    $sp1[3] = $pts[5];
Severity: Major
Found in src/plot/BarPlot.php and 1 other location - About 1 day to fix
src/plot/BarPlot.php on lines 595..613

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 273.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                } elseif ($val < 0) {
                    $sp1[0] = $pts[4];
                    $sp1[1] = $pts[5];
                    $sp1[2] = $pts[6];
                    $sp1[3] = $pts[7];
Severity: Major
Found in src/plot/BarPlot.php and 1 other location - About 1 day to fix
src/plot/BarPlot.php on lines 577..613

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 273.

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

Further Reading

File RGB.php has 555 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * JPGraph v4.0.3
 */
Severity: Major
Found in src/image/RGB.php - About 1 day to fix

    File RGB.php has 551 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * JPGraph v4.0.3
     */
    Severity: Major
    Found in src/util/RGB.php - About 1 day to fix

      Method _imageSmoothArcDrawSegment has 227 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function _imageSmoothArcDrawSegment(&$img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $start, $stop, $seg)
          {
              $fillColor = imagecolorexactalpha($img, $color[0], $color[1], $color[2], $color[3]);
      
              $xStart  = abs($a * cos($start));
      Severity: Major
      Found in src/image/Image.php - About 1 day to fix

        Method __construct has 225 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct()
            {
                /*
                 * warning.png
                 */
        Severity: Major
        Found in src/image/PredefIcons.php - About 1 day to fix

          Method Stroke has 224 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function Stroke($img, $xscale, $yscale)
              {
                  $idx       = 0;
                  $numpoints = safe_count($this->coords[0]);
                  if (isset($this->coords[1])) {
          Severity: Major
          Found in src/plot/LinePlot.php - About 1 day to fix

            Function StrokeConstrains has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

                public function StrokeConstrains()
                {
                    $n = safe_count($this->iObj);
            
                    // Stroke all constrains
            Severity: Minor
            Found in src/graph/GanttGraph.php - About 1 day to fix

            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 Stroke has 222 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function Stroke($aImg)
                {
                    // Constant
                    $fillBoxFrameWeight = 1;
            
            
            Severity: Major
            Found in src/graph/Legend.php - About 1 day to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          case GRAD_MIDVER:
                              $steps = ceil(abs($xr - $xl) / 2);
                              $delta = $xr >= $xl ? 1 : -1;
                              $this->GetColArray($from_color, $to_color, $steps, $colors, $this->numcolors);
                              for ($x = $xl, $i = 0; $i < $steps; ++$i) {
              Severity: Major
              Found in src/plot/Gradient.php and 1 other location - About 1 day to fix
              src/plot/Gradient.php on lines 88..108

              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 261.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          case GRAD_MIDHOR:
                              $steps = ceil(abs($yb - $yt) / 2);
                              $delta = $yb >= $yt ? 1 : -1;
                              $this->GetColArray($from_color, $to_color, $steps, $colors, $this->numcolors);
                              for ($y = $yt, $i = 0; $i < $steps; ++$i) {
              Severity: Major
              Found in src/plot/Gradient.php and 1 other location - About 1 day to fix
              src/plot/Gradient.php on lines 109..129

              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 261.

              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

              Further Reading

              GTextTable has 60 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class GTextTable
              {
                  public $iCells   = [];
                  public $iSize    = [0, 0]; // Need to be public since they are used by the cell
                  private $iWidth  = 0;
              Severity: Major
              Found in src/text/GTextTable.php - About 1 day to fix

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                <?php
                
                /**
                 * JPGraph - Community Edition
                 */
                Severity: Major
                Found in tests/RotateTest.php and 3 other locations - About 1 day to fix
                tests/ContourTest.php on lines 1..55
                tests/GeneralTest.php on lines 1..55
                tests/ScatterTest.php on lines 1..55

                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 256.

                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

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                <?php
                
                /**
                 * JPGraph - Community Edition
                 */
                Severity: Major
                Found in tests/GeneralTest.php and 3 other locations - About 1 day to fix
                tests/ContourTest.php on lines 1..55
                tests/RotateTest.php on lines 1..55
                tests/ScatterTest.php on lines 1..55

                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 256.

                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

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                <?php
                
                /**
                 * JPGraph - Community Edition
                 */
                Severity: Major
                Found in tests/ContourTest.php and 3 other locations - About 1 day to fix
                tests/GeneralTest.php on lines 1..55
                tests/RotateTest.php on lines 1..55
                tests/ScatterTest.php on lines 1..55

                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 256.

                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

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                <?php
                
                /**
                 * JPGraph - Community Edition
                 */
                Severity: Major
                Found in tests/ScatterTest.php and 3 other locations - About 1 day to fix
                tests/ContourTest.php on lines 1..55
                tests/GeneralTest.php on lines 1..55
                tests/RotateTest.php on lines 1..55

                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 256.

                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

                Further Reading

                Function Stroke has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function Stroke($aStrokeFileName = '')
                    {
                        // If the filename is the predefined value = '_csim_special_'
                        // we assume that the call to stroke only needs to do enough
                        // to correctly generate the CSIM maps.
                Severity: Minor
                Found in src/graph/PieGraph.php - About 1 day to fix

                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

                Severity
                Category
                Status
                Source
                Language