HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Function StrokeAngleLabels has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

    public function StrokeAngleLabels($pos, $type)
    {
        if (!$this->show_angle_label) {
            return;
        }
Severity: Minor
Found in src/graph/PolarAxis.php - About 1 day 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 Stroke has 306 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function Stroke($img, $xscale, $yscale)
    {
        $numpoints = safe_count($this->coords[0]);
        if (isset($this->coords[1])) {
            if (safe_count($this->coords[1]) != $numpoints) {
Severity: Major
Found in src/plot/BarPlot.php - About 1 day to fix

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

        public function Stroke($img, $scale, $pos)
        {
            $start     = $scale->GetMinVal();
            $limit     = $scale->GetMaxVal();
            $nextMajor = 10 * $start;
    Severity: Minor
    Found in src/graph/LogTicks.php - About 1 day 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

    File GanttGraph.php has 649 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * JPGraph v4.0.3
     */
    Severity: Major
    Found in src/graph/GanttGraph.php - About 1 day to fix

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

                  case GRAD_WIDE_MIDHOR:
                      $diff      = ceil(abs($yb - $yt));
                      $steps     = floor(abs($diff) / 3);
                      $firststep = $diff - 2 * $steps;
                      $delta     = $yb >= $yt ? 1 : -1;
      Severity: Major
      Found in src/plot/Gradient.php and 1 other location - About 1 day to fix
      src/plot/Gradient.php on lines 130..154

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

      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

                  case GRAD_WIDE_MIDVER:
                      $diff      = ceil(abs($xr - $xl));
                      $steps     = floor(abs($diff) / 3);
                      $firststep = $diff - 2 * $steps;
                      $delta     = $xr >= $xl ? 1 : -1;
      Severity: Major
      Found in src/plot/Gradient.php and 1 other location - About 1 day to fix
      src/plot/Gradient.php on lines 155..178

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

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

          public function Stroke($img, $x, $y)
          {
              if (!$this->show) {
                  return;
              }
      Severity: Minor
      Found in src/plot/PlotMark.php - About 1 day 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 _StrokeRegularRose has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _StrokeRegularRose($dblImg, $value, $scaling, $xc, $yc, $r, $ri)
          {
              // _StrokeRegularRose($dblImg,$xc,$yc,$r,$ri)
              // Plot radial grid lines and remember the end position
              // and the angle for later use when plotting the labels
      Severity: Minor
      Found in src/plot/WindrosePlot.php - About 1 day 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

                  'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABm' .
                  'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA' .
                  'B3RJTUUH0wMLFQolY9lkpgAACmhJREFUeJy9mOtzFNl5h5+3b9' .
                  'Mz0kzPBWmEVtIiWYhIiC0HCDhB8lb8ISk7nzdZ5+/zJ/8BTmpT' .
                  '660CZLwG1pVFgBkgGIHECEaa+/T9nHzQCCQuRpCNz6mp6g893U' .
      Severity: Major
      Found in src/image/ImgData_PushPins.php and 1 other location - About 1 day to fix
      src/image/ImgData_PushPins.php on lines 344..418

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

      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

                  'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABm' .
                  'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA' .
                  'B3RJTUUH0wMLFQ4hANhluwAACrNJREFUeJytmF1zE1eagJ+3u9' .
                  'XdkvUty2AbmLEtEzDBgZ0UpDBOalNTUzU3czl7tct/2n+wt3M/' .
                  'NVM12SSTQQSyW2TA+QAJQogtYYFtyfrqL3WfvWj5g8AEjzfvhS' .
      Severity: Major
      Found in src/image/ImgData_PushPins.php and 1 other location - About 1 day to fix
      src/image/ImgData_PushPins.php on lines 196..270

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

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

          public function Stroke($img, $x, $y)
          {
              if (!$this->show) {
                  return;
              }
      Severity: Major
      Found in src/plot/PlotMark.php - About 1 day to fix

        File BarPlot.php has 595 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * JPGraph v4.0.3
         */
        Severity: Major
        Found in src/plot/BarPlot.php - About 1 day to fix

          Function _StrokeFreeRose has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
          Open

              public function _StrokeFreeRose($dblImg, $value, $scaling, $xc, $yc, $r, $ri)
              {
                  // Plot radial grid lines and remember the end position
                  // and the angle for later use when plotting the labels
                  if ($this->iType != WINDROSE_TYPEFREE) {
          Severity: Minor
          Found in src/plot/WindrosePlot.php - About 1 day 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 65 (exceeds 5 allowed). Consider refactoring.
          Open

              public function Stroke($aStrokeFileName = '')
              {
                  // Fist make a sanity check that user has specified a scale
                  if (empty($this->yscale)) {
                      Util\JpGraphError::RaiseL(25031); //('You must specify what scale to use with a call to Graph::SetScale().');
          Severity: Minor
          Found in src/graph/Graph.php - About 1 day 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 Pie3D has 250 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function Pie3D(
                  $aaoption,
                  $img,
                  $data,
                  $colors,
          Severity: Major
          Found in src/plot/PiePlot3D.php - About 1 day to fix

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

                public function Stroke($img, $xscale, $yscale)
                {
                    $pattern = null;
                    $img->SetLineWeight($this->weight);
                    $grad = null;
            Severity: Major
            Found in src/plot/AccBarPlot.php - About 1 day to fix

              Function SetAutoScaleAngle has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function SetAutoScaleAngle($aIsRegRose = true)
                  {
                      // If the user already has manually set an angle don't
                      // trye to find a position
                      if (is_numeric($this->scale->iAngle)) {
              Severity: Minor
              Found in src/plot/WindrosePlot.php - About 1 day 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 doAutoscaleXAxis has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function doAutoscaleXAxis()
                  {
                      $aPlots = array_filter($this->plots, function ($plot) {
                          //\Kint::dump($plot, $plot instanceof Plot\Plot);
                          return $plot instanceof Plot\Plot;
              Severity: Minor
              Found in src/graph/Graph.php - About 1 day 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 FilledRectangle has 247 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function FilledRectangle($xl, $yt, $xr, $yb, $from_color, $to_color, $style = 1)
                  {
                      $this->img->SetLineWeight(1);
                      switch ($style) {
                          case GRAD_VER:
              Severity: Major
              Found in src/plot/Gradient.php - About 1 day to fix

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

                            if (empty($matches[5])) {
                                $r = strlen($matches[2]) == 1 ? $matches[2] . $matches[2] : $matches[2];
                                $g = strlen($matches[3]) == 1 ? $matches[3] . $matches[3] : $matches[3];
                                $b = strlen($matches[4]) == 1 ? $matches[4] . $matches[4] : $matches[4];
                                $r = hexdec($r);
                Severity: Major
                Found in src/image/RGB.php and 1 other location - About 1 day to fix
                src/util/RGB.php on lines 503..517

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

                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