HuasoFoundries/jpgraph

View on GitHub

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;
Severity: Minor
Found in src/graph/RectPattern3DPlane.php - About 2 hrs to fix

    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))) {
    Severity: Critical
    Found in src/graph/Graph.php - About 2 hrs to fix

      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';
      
      
      Severity: Minor
      Found in src/plot/PiePlot3D.php - About 1 hr to fix

        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;
        Severity: Minor
        Found in src/plot/PiePlot.php - About 1 hr to fix

          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);
                  }
          Severity: Minor
          Found in src/image/Image.php - About 1 hr to fix

            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) {
            Severity: Minor
            Found in src/image/Image.php - About 1 hr to fix

              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,
              Severity: Major
              Found in src/plot/WindrosePlot.php and 1 other location - About 1 hr to fix
              src/plot/WindrosePlot.php on lines 756..770

              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

              Further Reading

              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,
              Severity: Major
              Found in src/plot/WindrosePlot.php and 1 other location - About 1 hr to fix
              src/plot/WindrosePlot.php on lines 970..984

              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

              Further Reading

              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);
              Severity: Minor
              Found in src/plot/ScatterPlot.php - About 1 hr to fix

                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:
                Severity: Minor
                Found in src/image/RGB.php - About 1 hr to fix

                  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)) {
                  Severity: Minor
                  Found in src/graph/Graph.php - About 1 hr to fix

                    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;
                    Severity: Minor
                    Found in src/plot/FieldPlot.php - About 1 hr 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

                    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
                    Severity: Minor
                    Found in src/plot/BarPlot.php - About 1 hr 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

                    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) {
                    Severity: Minor
                    Found in src/plot/WindrosePlot.php - About 1 hr 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

                    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) {
                    Severity: Minor
                    Found in src/plot/AccBarPlot.php - About 1 hr 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

                    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') {
                    Severity: Minor
                    Found in src/plot/PlotBand.php - About 1 hr 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

                    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) {
                    Severity: Minor
                    Found in src/plot/PiePlot3D.php - About 1 hr 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

                    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;
                            }
                    Severity: Minor
                    Found in src/image/Image.php - About 1 hr 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

                    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);
                            }
                    Severity: Minor
                    Found in src/text/Text.php - About 1 hr 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

                    Function StrokeFrame has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function StrokeFrame()
                        {
                            if (!$this->doframe) {
                                return;
                            }
                    Severity: Minor
                    Found in src/graph/Graph.php - About 1 hr 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