HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Function DisplayCSIMAreas has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function DisplayCSIMAreas()
    {
        $csim = '';
        foreach ($this->plots as $p) {
            $csim .= $p->GetCSIMareas();
Severity: Minor
Found in src/graph/PieGraph.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

Method StyleLine has 35 lines of code (exceeds 25 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

    Method ApplyPlot has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function ApplyPlot($plot)
        {
            switch (get_class($plot)) {
                case 'GroupBarPlot':
                        foreach ($plot->plots as $_plot) {
    Severity: Minor
    Found in src/themes/UniversalTheme.php - About 1 hr to fix

      Method StrokeFullSliceFrame has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function StrokeFullSliceFrame($img, $xc, $yc, $sa, $ea, $w, $h, $z, $edgecolor, $exploderadius, $fulledge)
      Severity: Major
      Found in src/plot/PiePlot3D.php - About 1 hr to fix

        Method _imageSmoothArcDrawSegment has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function _imageSmoothArcDrawSegment(&$img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $start, $stop, $seg)
        Severity: Major
        Found in src/image/Image.php - About 1 hr to fix

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

                      if (!($this->xtick_offset > 0 && $i == $nbrmajticks - 1) && !$this->supress_tickmarks) {
                          if ($this->majcolor != '') {
                              $aImg->PushColor($this->majcolor);
                          }
                          if ($hor) {
          Severity: Major
          Found in src/graph/LinearTicks.php and 1 other location - About 1 hr to fix
          src/graph/LinearTicks.php on lines 313..327

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

          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 {
                      if ($xl < $xl) {
                          $t  = $xl;
                          $xl = $xr;
                          $xr = $t;
          Severity: Major
          Found in src/image/Image.php and 1 other location - About 1 hr to fix
          src/image/Image.php on lines 1629..1656

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

          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 ($style === 1) {
                      // Horizontal stripe
                      if ($yl < $yu) {
                          $t  = $yl;
                          $yl = $yu;
          Severity: Major
          Found in src/image/Image.php and 1 other location - About 1 hr to fix
          src/image/Image.php on lines 1643..1656

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

          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 (!$this->supress_tickmarks && !$this->supress_minor_tickmarks) {
                              if ($this->mincolor != '') {
                                  $aImg->PushColor($this->mincolor);
                              }
                              if ($hor) {
          Severity: Major
          Found in src/graph/LinearTicks.php and 1 other location - About 1 hr to fix
          src/graph/LinearTicks.php on lines 337..351

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

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

              public function Stroke($aImg)
              {
                  list($dx, $dy) = $this->isizespec[$this->iSize];
                  $x             = $this->ix;
                  $y             = $this->iy;
          Severity: Minor
          Found in src/image/LinkArrow.php - About 1 hr to fix

            Method Set has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function Set($aLocale)
                {
                    if (in_array($aLocale, array_keys($this->iDayAbb), true)) {
                        $this->iLocale = $aLocale;
            
            
            Severity: Minor
            Found in src/util/DateLocale.php - About 1 hr to fix

              Method SetTickDensity has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function SetTickDensity($aYDensity = TICKD_NORMAL, $aXDensity = TICKD_NORMAL)
                  {
                      $this->xtick_factor = 30;
                      $this->ytick_factor = 25;
                      switch ($aYDensity) {
              Severity: Minor
              Found in src/graph/Graph.php - About 1 hr to fix

                Method StrokeTableHeaders has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function StrokeTableHeaders($aYBottom)
                    {
                        $img = $this->iImg;
                        $xt  = $img->left_margin;
                        $yt  = $img->top_margin;
                Severity: Minor
                Found in src/graph/GanttScale.php - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (($this->yaxis->pos == $this->xscale->GetMinVal() || (is_string($this->yaxis->pos) && $this->yaxis->pos == 'min')) &&
                              !is_numeric($this->xaxis->pos) && $this->yscale->GetMinVal() < 0 &&
                              substr($this->axtype, 0, 4) != 'text' && $this->xaxis->pos != 'min') {
                              //$this->yscale->ticks->SupressZeroLabel(false);
                              $this->xscale->ticks->SupressFirst();
                  Severity: Critical
                  Found in src/graph/Graph.php - About 1 hr to fix

                    Avoid using short method names like FuncGenerator::E(). The configured minimum method name length is 3.
                    Open

                        public function E($aXMin, $aXMax, $aSteps = 50)
                        {
                            $this->iMin      = $aXMin;
                            $this->iMax      = $aXMax;
                            $this->iStepSize = ($aXMax - $aXMin) / $aSteps;
                    Severity: Minor
                    Found in src/util/FuncGenerator.php by phpmd

                    ShortMethodName

                    Since: 0.2

                    Detects when very short method names are used.

                    Example

                    class ShortMethod {
                        public function a( $index ) { // Violation
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortmethodname

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

                            if ($this->iRow + $this->iRowSpan - 1 < $this->iTable->iSize[0] - 1) {
                                switch ($this->iGridStyle[2]) {
                                    case TGRID_SINGLE:
                                        $wf = 1;
                    
                    
                    Severity: Major
                    Found in src/text/GTextTableCell.php and 1 other location - About 1 hr to fix
                    src/text/GTextTableCell.php on lines 357..373

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

                    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 ($aAxisType == 'lin') {
                                $this->y2scale = new LinearScale($aY2Min, $aY2Max);
                            } elseif ($aAxisType == 'int') {
                                $this->y2scale = new LinearScale($aY2Min, $aY2Max);
                                $this->y2scale->SetIntScale();
                    Severity: Major
                    Found in src/graph/Graph.php and 1 other location - About 1 hr to fix
                    src/graph/Graph.php on lines 678..687

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

                    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 ($yt == 'lin') {
                                $this->yscale = new LinearScale($aYMin, $aYMax);
                            } elseif ($yt == 'int') {
                                $this->yscale = new LinearScale($aYMin, $aYMax);
                                $this->yscale->SetIntScale();
                    Severity: Major
                    Found in src/graph/Graph.php and 1 other location - About 1 hr to fix
                    src/graph/Graph.php on lines 728..737

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

                    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 ($this->iCol + $this->iColSpan - 1 < $this->iTable->iSize[1] - 1) {
                                switch ($this->iGridStyle[3]) {
                                    case TGRID_SINGLE:
                                        $wf = 1;
                    
                    
                    Severity: Major
                    Found in src/text/GTextTableCell.php and 1 other location - About 1 hr to fix
                    src/text/GTextTableCell.php on lines 340..356

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

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

                        public function Legend($graph)
                        {
                            if ($this->legend != '') {
                                if ($this->filled && !$this->fillgrad) {
                                    $graph->legend->Add(
                    Severity: Minor
                    Found in src/plot/LinePlot.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language