HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

        $this->imgdata_large[2][1] =
            'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAB2l' .
            'BMVEX//////////+///+f//9b//8b//73//7X//63//6X//5T/' .
            '/4z//4T//3P//2v//1r//0r//0L//zH//yn//yH//xj//xD//w' .
            'j//wD/90L/9zn/9zH/9xj/9xD/9wj/9wD39yn37zn37zH37yH3' .
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 355..385

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

Method _TransVert3D has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _TransVert3D($aGdImg, $aHorizon = 100, $aSkewDist = 120, $aDir = SKEW3D_DOWN, $aMinSize = true, $aFillColor = '#FFFFFF', $aQuality = false, $aBorder = false, $aHorizonPos = 0.5)
    {
        // Parameter check
        if ($aHorizonPos < 0 || $aHorizonPos > 1.0) {
            Util\JpGraphError::RaiseL(9001);
Severity: Major
Found in src/image/ImgTrans.php - About 2 hrs to fix

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

                if ($this->subsubtitle->halign == 'center') {
                    $this->subsubtitle->Center(0, $w, $y);
                } elseif ($this->subsubtitle->halign == 'left') {
                    $this->subsubtitle->SetPos($this->subsubtitle->margin + 2, $y);
                } elseif ($this->subsubtitle->halign == 'right') {
    Severity: Major
    Found in src/graph/MGraph.php and 1 other location - About 2 hrs to fix
    src/graph/MGraph.php on lines 259..269

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

    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->title->halign == 'center') {
                    $this->title->Center(0, $w, $y);
                } elseif ($this->title->halign == 'left') {
                    $this->title->SetPos($this->title->margin + 2, $y);
                } elseif ($this->title->halign == 'right') {
    Severity: Major
    Found in src/graph/MGraph.php and 1 other location - About 2 hrs to fix
    src/graph/MGraph.php on lines 289..299

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

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

        public static function doMonthly($aType, $aMinor = false)
        {
            $monthcount = 0;
            $m          = self::$startmonth;
            $y          = self::$startyear;
    Severity: Major
    Found in src/util/DateScaleUtils.php - About 2 hrs to fix

      Method StrokeAxis has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function StrokeAxis($aStrokeLabels = true)
          {
              if ($aStrokeLabels) {
                  $this->StrokeAxisLabelBackground();
              }
      Severity: Major
      Found in src/graph/Graph.php - About 2 hrs to fix

        LinearScale has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LinearScale
        {
            public $textscale = false; // Just a flag to let the Plot class find out if
            // we are a textscale or not. This is a cludge since
            // this information is available in Graph::axtype but
        Severity: Minor
        Found in src/graph/LinearScale.php - About 2 hrs to fix

          Method AddSliceToCSIM has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea)
              {
                  //Slice number, ellipse centre (x,y), radius, start angle, end angle
                  while ($sa > 2 * M_PI) {
                      $sa = $sa - 2 * M_PI;
          Severity: Major
          Found in src/plot/PiePlotC.php - About 2 hrs to fix

            Method AutoScale has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function AutoScale($img, $aStartTime, $aEndTime, $aNumSteps, $_adummy = false)
                {
                    // We need to have one dummy argument to make the signature of AutoScale()
                    // identical to LinearScale::AutoScale
                    if ($aStartTime == $aEndTime) {
            Severity: Major
            Found in src/graph/DateScale.php - About 2 hrs to fix

              Method getIsobars has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getIsobars()
                  {
                      $this->adjustDataPointValues();
              
                      for ($isobar = 0; $isobar < $this->nbrIsobars; ++$isobar) {
              Severity: Major
              Found in src/plot/Contour.php - About 2 hrs to fix

                Method _TransHor3D has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _TransHor3D($aGdImg, $aHorizon = 100, $aSkewDist = 120, $aDir = SKEW3D_LEFT, $aMinSize = true, $aFillColor = '#FFFFFF', $aQuality = false, $aBorder = false, $aHorizonPos = 0.5)
                    {
                        $w = imagesx($aGdImg);
                        $h = imagesy($aGdImg);
                
                
                Severity: Major
                Found in src/image/ImgTrans.php - About 2 hrs to fix

                  Function FilledFlatPolygon has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function FilledFlatPolygon($pts, $from_color, $to_color)
                      {
                          if (safe_count($pts) == 0) {
                              return;
                          }
                  Severity: Minor
                  Found in src/plot/Gradient.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 StrokeBoxedText has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function StrokeBoxedText(
                          $x,
                          $y,
                          $txt,
                          $dir = 0,
                  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 StrokeVGrid has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function StrokeVGrid($aImg, $aX, $aY, $aWidth, $aHeight, $aDir = 1)
                      {
                          // Left or right grid line
                          // For the right we increase the X-pos and for the right we decrease it. This is
                          // determined by the direction argument.
                  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 FromCSV2 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function FromCSV2($aFile, &$aData, $aOptions = [])
                      {
                          $aDefaults = [
                              'separator'    => ',',
                              'enclosure'    => chr(34),
                  Severity: Minor
                  Found in src/util/ReadFileData.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 StrokeHGrid has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function StrokeHGrid($aImg, $aX, $aY, $aWidth, $aHeight, $aDir = 1)
                      {
                          // Top or bottom grid line
                          // For the left we increase the X-pos and for the right we decrease it. This is
                          // determined by the direction argument.
                  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 StrokeWeeks has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function StrokeWeeks($aYCoord, $getHeight = false)
                      {
                          if ($this->week->iShowLabels) {
                              $img = $this->iImg;
                              $yt  = $aYCoord + $img->top_margin;
                  Severity: Minor
                  Found in src/graph/GanttScale.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 AdjustMarginsForTitles has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function AdjustMarginsForTitles()
                      {
                          $totrequired =
                              ($this->title->t != ''
                              ? $this->title->GetTextHeight($this->img) + $this->title->margin + 5 * SUPERSAMPLING_SCALE
                  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

                  Function StrokeCSIM has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function StrokeCSIM($aScriptName = 'auto', $aCSIMName = '', $aBorder = 0)
                      {
                          if ($aCSIMName == '') {
                              // create a random map name
                              srand((int) (microtime() * 1000000));
                  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

                          $this->imgdata_large[6][1] =
                              'iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABoV' .
                              'BMVEX////Gzs7GvbXGrZTGpXu9nHO1nHO1nIy9taXGxs7GtaXO' .
                              'nHPGlFrGjEq9hEq1hEqte0Klczmcazmce1KtnIzGxsbGvb3OlF' .
                              'LOlFq9hFKte0qcc0KUYzGEWimMc1K9ta3OnGvOnGPWnGO9jFq9' .
                  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 92..121

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

                  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