HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Function GetURLArguments has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function GetURLArguments($aAddRecursiveBlocker = false)
    {
        if ($aAddRecursiveBlocker) {
            // This is a JPGRAPH internal defined that prevents
            // us from recursively coming here again
Severity: Minor
Found in src/graph/Graph.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

Function AddLine has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function AddLine($aLine, $aToY2 = false)
    {
        if ($aLine == null) {
            Util\JpGraphError::RaiseL(25015); //("Graph::AddLine() You tried to add a null line to the graph.");
        }
Severity: Minor
Found in src/graph/Graph.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

Function doPrestrokeAdjustments has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function doPrestrokeAdjustments()
    {
        // Do any pre-stroke adjustment that is needed by the different plot types
        // (i.e bar plots want's to add an offset to the x-labels etc)
        for ($i = 0; $i < safe_count($this->plots); ++$i) {
Severity: Minor
Found in src/graph/Graph.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

Function AddText has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function AddText($aTxt, $aToY2 = false)
    {
        if ($aTxt == null) {
            Util\JpGraphError::RaiseL(25014); //("Graph::AddText() You tried to add a null text to the graph.");
        }
Severity: Minor
Found in src/graph/Graph.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

Function GetXMinMax has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function GetXMinMax()
    {
        list($min, $ymin) = $this->plots[0]->Min();
        list($max, $ymax) = $this->plots[0]->Max();

Severity: Minor
Found in src/graph/Graph.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

Function AddBand has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function AddBand($aBand, $aToY2 = false)
    {
        if ($aBand == null) {
            Util\JpGraphError::RaiseL(25016); //(" Graph::AddBand() You tried to add a null band to the graph.");
        }
Severity: Minor
Found in src/graph/Graph.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

Function _doManualTickPos has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _doManualTickPos($aScale)
    {
        $n     = safe_count($this->iManualTickPos);
        $m     = safe_count($this->iManualMinTickPos);
        $doLbl = safe_count($this->iManualTickLabels) > 0;
Severity: Minor
Found in src/graph/LinearTicks.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

Function Init has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function Init()
    {
        // Setup limits for color indications
        $lowx   = $this->iXMin;
        $highx  = $this->iXMax;
Severity: Minor
Found in src/graph/CCBPGraph.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

Function _StrokeAxisTitle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _StrokeAxisTitle($pos, $aAxisAngle, $title)
    {
        $this->title->Set($title);
        $marg = 6 + $this->title->margin;
        $xt   = round(($this->scale->world_abs_size + $marg) * cos($aAxisAngle) + $this->scale->scale_abs[0]);
Severity: Minor
Found in src/graph/RadarAxis.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

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

    public function Stroke($aStrokeFileName = '')
    {
        // If the filename is the predefined value = '_csim_special_'
        // we assume that the call to stroke only needs to do enough
        // to correctly generate the CSIM maps.
Severity: Minor
Found in src/graph/GanttGraph.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

Function Add has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function Add($aObj)
    {
        if (is_array($aObj) && safe_count($aObj) > 0) {
            $cl = $aObj[0];
        } else {
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

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

    public function Allocate($aColor, $aAlpha = 0.0)
    {
        list($r, $g, $b, $a) = $this->color($aColor);
        // If alpha is specified in the color string then this
        // takes precedence over the second argument
Severity: Major
Found in src/image/RGB.php and 1 other location - About 1 hr to fix
src/util/RGB.php on lines 564..577

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

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

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

namespace Amenadiel\JpGraph\Util;

// Utility class to hold coordinates for a rectangle
class Rectangle
{
Severity: Major
Found in src/util/Rectangle.php and 1 other location - About 1 hr to fix
src/graph/Rectangle.php on lines 1..25

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

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

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

<?php

/**
 * JPGraph v4.0.3
 */
Severity: Major
Found in src/graph/Rectangle.php and 1 other location - About 1 hr to fix
src/util/Rectangle.php on lines 7..28

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

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 Allocate($aColor, $aAlpha = 0.0)
    {
        list($r, $g, $b, $a) = $this->color($aColor);
        // If alpha is specified in the color string then this
        // takes precedence over the second argument
Severity: Major
Found in src/util/RGB.php and 1 other location - About 1 hr to fix
src/image/RGB.php on lines 574..587

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

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

    public function Stroke($img, $aVal, $x, $y)
    {
        if ($this->show) {
            if ($this->negformat == '') {
                $this->negformat = $this->format;
Severity: Minor
Found in src/plot/DisplayValue.php - About 1 hr to fix

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

        public function Get($errnbr, $a1 = null, $a2 = null, $a3 = null, $a4 = null, $a5 = null)
        {
            global $__jpg_err_locale;
            if (!isset($this->lt[$errnbr])) {
                return 'Internal error: The specified error message (' . $errnbr . ') does not exist in the chosen locale (' . $__jpg_err_locale . ')';
    Severity: Minor
    Found in src/util/ErrMsgText.php - About 1 hr to fix

      Method SetupGraph has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function SetupGraph($graph)
          {
              // graph
              $graph->SetFrame(false);
              $graph->SetMarginColor('white');
      Severity: Minor
      Found in src/themes/SoftyTheme.php - About 1 hr to fix

        Method _doLabelFormat has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _doLabelFormat($aVal, $aIdx, $aNbrTicks)
            {
                // If precision hasn't been specified set it to a sensible value
                if ($this->precision == -1) {
                    $t = log10($this->minor_step);
        Severity: Minor
        Found in src/graph/LinearTicks.php - About 1 hr to fix

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

                  if ($this->iEndTimeAlign !== false) {
                      if ($this->iEndTimeAlign >= 30) {
                          $adjend = $this->AdjEndTime($aEndTime, $this->iEndTimeAlign - 30);
                      } elseif ($this->iEndTimeAlign >= 20) {
                          $adjend = $this->AdjEndTime($aEndTime, false, $this->iEndTimeAlign - 20);
          Severity: Major
          Found in src/graph/DateScale.php and 3 other locations - About 1 hr to fix
          src/graph/DateScale.php on lines 480..488
          src/graph/DateScale.php on lines 499..507
          src/graph/DateScale.php on lines 508..516

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

          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