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[0][1] =
            'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAByF' .
            'BMVEX/////////xsb/vb3/lIz/hIT/e3v/c3P/c2v/a2v/Y2P/' .
            'UlL/Skr/SkL/Qjn/MTH/MSn/KSn/ISH/IRj/GBj/GBD/EBD/EA' .
            'j/CAj/CAD/AAD3QkL3MTH3KSn3KSH3GBj3EBD3CAj3AAD1zMzv' .
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 320..349

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

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

    public function Stroke($aFileName = '')
    {
        // Find out the necessary size for the container image
        $w = 0;
        $h = 0;
Severity: Major
Found in src/graph/MGraph.php - About 2 hrs to fix

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

        public function Max()
        {
            list($xmax, $ymax) = $this->plots[0]->Max();
            $n                 = safe_count($this->plots);
            for ($i = 0; $i < $n; ++$i) {
    Severity: Major
    Found in src/plot/GroupBarPlot.php and 1 other location - About 2 hrs to fix
    src/plot/GroupBarPlot.php on lines 60..71

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

    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 Min()
        {
            list($xmin, $ymin) = $this->plots[0]->Min();
            $n                 = safe_count($this->plots);
            for ($i = 0; $i < $n; ++$i) {
    Severity: Major
    Found in src/plot/GroupBarPlot.php and 1 other location - About 2 hrs to fix
    src/plot/GroupBarPlot.php on lines 73..84

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

    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

    GanttGraph has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class GanttGraph extends Graph
    {
        public $scale; // Public accessible
        public $hgrid;
        private $iObj                    = []; // Gantt objects
    Severity: Minor
    Found in src/graph/GanttGraph.php - About 2 hrs to fix

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

          public function __construct()
          {
              /*
               * File: bullets_balls_red_013.png
               */
      Severity: Major
      Found in src/image/ImgData_Bevels.php - About 2 hrs to fix

        Method StrokeAxisLabelBackground has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function StrokeAxisLabelBackground()
            {
                // Types
                // 0 = No background
                // 1 = Only X-labels, length of axis
        Severity: Major
        Found in src/graph/Graph.php - About 2 hrs to fix

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

              public function Stroke($aImg, $aXLeft, $aYTop, $aXRight, $aYBottom, $aUseTextHeight = false)
              {
                  if (!$this->iShow) {
                      return;
                  }
          Severity: Major
          Found in src/graph/GanttActivityInfo.php - About 2 hrs to fix

            Method Legend has 57 lines of code (exceeds 25 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: Major
            Found in src/plot/BarPlot.php - About 2 hrs to fix

              Method AdjustMarginsForTitles has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function AdjustMarginsForTitles()
                  {
                      $totrequired =
                          ($this->title->t != ''
                          ? $this->title->GetTextHeight($this->img) + $this->title->margin + 5 * SUPERSAMPLING_SCALE
              Severity: Major
              Found in src/graph/Graph.php - About 2 hrs to fix

                Method doAutoScaleYnAxis has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function doAutoScaleYnAxis()
                    {
                        if ($this->y2scale != null) {
                            if (!$this->y2scale->IsSpecified() && safe_count($this->y2plots) > 0) {
                                list($min, $max) = $this->GetPlotsYMinMax($this->y2plots);
                Severity: Major
                Found in src/graph/Graph.php - About 2 hrs to fix

                  Method Get has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function Get($aSymb, $aCapital = false)
                      {
                          $iSymbols = [
                              /* Greek */
                              ['alpha', '03B1', '0391'],
                  Severity: Major
                  Found in src/graph/SymChar.php - About 2 hrs to fix

                    Method _doAutoTickPos has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _doAutoTickPos($aScale)
                        {
                            $maj_step_abs = $aScale->scale_factor * $this->major_step;
                            $min_step_abs = $aScale->scale_factor * $this->minor_step;
                    
                    
                    Severity: Major
                    Found in src/graph/LinearTicks.php - About 2 hrs to fix

                      Function StrokeLabels has a Cognitive Complexity of 17 (exceeds 5 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 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 Stroke has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function Stroke($aImg, $aScale)
                          {
                              // Put the mark in the middle at the middle of the day
                              $d = $aScale->NormalizeDate($this->iStart) + SECPERDAY / 2;
                              $x = $aScale->TranslateDate($d);
                      Severity: Minor
                      Found in src/plot/MileStone.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 AdjPercentage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function AdjPercentage($aData, $aPrec = 0)
                          {
                              $mul = 100;
                              if ($aPrec > 0 && $aPrec < 3) {
                                  if ($aPrec == 1) {
                      Severity: Minor
                      Found in src/plot/PiePlot.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 doDaily has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function doDaily($aType, $aMinor = false)
                          {
                              $m = self::$startmonth;
                              $y = self::$startyear;
                              $d = self::$startday;
                      Severity: Minor
                      Found in src/util/DateScaleUtils.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 StrokeYears has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function StrokeYears($aYCoord, $getHeight = false)
                          {
                              if ($this->year->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 Stroke has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function Stroke($pos, $dummy = true)
                          {
                              $this->img->SetLineWeight($this->weight);
                              $this->img->SetColor($this->color);
                              $this->img->SetFont($this->font_family, $this->font_style, $this->font_size);
                      Severity: Minor
                      Found in src/graph/PolarAxis.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

                      Method Legend has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function Legend($graph)
                          {
                              $colors = array_keys($graph->img->rgb->rgb_table);
                              sort($colors);
                              $ta = $this->themearr[$this->theme];
                      Severity: Major
                      Found in src/plot/PiePlot.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language