HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

<?php

/**
 * JPGraph v4.0.3
 */
Severity: Major
Found in src/graph/RectPatternHor.php and 1 other location - About 2 hrs to fix
src/graph/RectPatternVert.php on lines 1..36

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

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 SetImgFormat has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function SetImgFormat($aFormat, $aQuality = 75)
    {
        $this->quality = $aQuality;
        $aFormat       = strtolower($aFormat);
        $tst           = true;
Severity: Minor
Found in src/image/Image.php - About 2 hrs 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 AdjustMarginsForGrid has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function AdjustMarginsForGrid()
    {
        if ($this->iCol > 0) {
            switch ($this->iGridStyle[0]) {
                case TGRID_SINGLE:
Severity: Minor
Found in src/text/GTextTableCell.php - About 2 hrs 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 LoadBkgImage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public static function LoadBkgImage($aImgFormat = '', $aFile = '', $aImgStr = '')
    {
        if ($aImgStr != '') {
            return Image::CreateFromString($aImgStr);
        }
Severity: Minor
Found in src/graph/Graph.php - About 2 hrs 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

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

                        if ($this->label_angle == 0 || $this->label_angle == 90) {
                            if ($this->label_halign == '' && $this->label_valign == '') {
                                $this->img->SetTextAlign('center', 'bottom');
                            } else {
                                $this->img->SetTextAlign($this->label_halign, $this->label_valign);
Severity: Major
Found in src/graph/Axis.php and 1 other location - About 2 hrs to fix
src/graph/Axis.php on lines 209..221

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

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->label_angle == 0 || $this->label_angle == 90) {
                            if ($this->label_halign == '' && $this->label_valign == '') {
                                $this->img->SetTextAlign('center', 'top');
                            } else {
                                $this->img->SetTextAlign($this->label_halign, $this->label_valign);
Severity: Major
Found in src/graph/Axis.php and 1 other location - About 2 hrs to fix
src/graph/Axis.php on lines 230..242

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

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

    public function StrokeConstrains()
    {
        $n = safe_count($this->iObj);

        // Stroke all constrains
Severity: Major
Found in src/graph/GanttGraph.php - About 2 hrs to fix

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

        public function SetGridStyle($aLeft, $aTop = null, $aBottom = null, $aRight = null)
        {
            if ($aLeft !== null) {
                $this->iGridStyle[0] = $aLeft;
            }
    Severity: Major
    Found in src/text/GTextTableCell.php and 1 other location - About 2 hrs to fix
    src/text/GTextTableCell.php on lines 170..187

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

    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

        public function SetGridColor($aLeft, $aTop = null, $aBottom = null, $aRight = null)
        {
            if ($aLeft !== null) {
                $this->iGridColor[0] = $aLeft;
            }
    Severity: Major
    Found in src/text/GTextTableCell.php and 1 other location - About 2 hrs to fix
    src/text/GTextTableCell.php on lines 189..206

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

    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 UnitTesterActions.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * JPGraph - Community Edition
     */
    Severity: Minor
    Found in tests/_support/_generated/UnitTesterActions.php - About 2 hrs to fix

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

          public function Stroke($aImg, $aDummy1 = null, $aDummy2 = null)
          {
              if ($this->hide) {
                  return;
              }
      Severity: Major
      Found in src/text/GraphTabTitle.php - About 2 hrs to fix

        Method StrokeWeeks has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function StrokeWeeks($aYCoord, $getHeight = false)
            {
                if ($this->week->iShowLabels) {
                    $img = $this->iImg;
                    $yt  = $aYCoord + $img->top_margin;
        Severity: Major
        Found in src/graph/GanttScale.php - About 2 hrs to fix

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

              public function Stroke($aImg, &$grid, $aPos, $aAxisAngle, $aScale, &$aMajPos, &$aMajLabel)
              {
                  $start     = $aScale->GetMinVal();
                  $limit     = $aScale->GetMaxVal();
                  $nextMajor = 10 * $start;
          Severity: Major
          Found in src/graph/RadarLogTicks.php - About 2 hrs to fix

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

                    for ($i = 0; $i < $m; ++$i) {
                        $h = 0;
                        for ($j = 0; $j < $n; ++$j) {
                            $h = max($h, $this->iCells[$i][$j]->GetHeight($aImg));
                        }
            Severity: Major
            Found in src/text/GTextTable.php and 1 other location - About 2 hrs to fix
            src/text/GTextTable.php on lines 902..912

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

            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

                    for ($j = 0; $j < $n; ++$j) {
                        $w = 0;
                        for ($i = 0; $i < $m; ++$i) {
                            $w = max($w, $this->iCells[$i][$j]->GetWidth($aImg));
                        }
            Severity: Major
            Found in src/text/GTextTable.php and 1 other location - About 2 hrs to fix
            src/text/GTextTable.php on lines 889..899

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

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

                public function StrokeLabel($label, $img, $xc, $yc, $a, $r)
                {
                    // Default value
                    if ($this->ilabelposadj === 'auto') {
                        $this->ilabelposadj = 0.65;
            Severity: Major
            Found in src/plot/PiePlot.php - About 2 hrs to fix

              Method AdjTime has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function AdjTime($aTime, $aRound = 0, $aHourType = false, $aMinType = false, $aSecType = false)
                  {
                      $y = (int) date('Y', $aTime);
                      $m = (int) date('m', $aTime);
                      $d = (int) date('d', $aTime);
              Severity: Major
              Found in src/graph/DateScale.php - About 2 hrs to fix

                Method StrokeMonths has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function StrokeMonths($aYCoord, $getHeight = false)
                    {
                        if ($this->month->iShowLabels) {
                            $img = $this->iImg;
                            $img->SetFont($this->month->iFFamily, $this->month->iFStyle, $this->month->iFSize);
                Severity: Major
                Found in src/graph/GanttScale.php - About 2 hrs to fix

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

                      public function Stroke($pos, $aAxisAngle, &$grid, $title, $lf)
                      {
                          $this->img->SetColor($this->color);
                  
                          // Determine end points for the axis
                  Severity: Minor
                  Found in src/graph/RadarAxis.php - About 2 hrs 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

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

                          $this->imgdata_large[7][1] =
                              'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAB2l' .
                              'BMVEX////////3///v///n/+/e99bW/+/W99bO786/v7++vr69' .
                              '/96999a7wb24vbu1/9a1zqW1u7itxrWosq6l772l1qWlxrWlxq' .
                              '2lva2cxpSU562U3q2UxqWUvaWUpZyM77WM57WMvYyMtZyMrZyM' .
                  Severity: Major
                  Found in src/image/ImgData_Balls.php and 1 other location - About 2 hrs to fix
                  src/image/ImgData_Balls.php on lines 170..200

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language