HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

Function CheckCSIMCache has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function CheckCSIMCache($aCacheName, $aTimeOut = 60)
    {
        global $_SERVER;

        if ($aCacheName == 'auto') {
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 StrokeBands has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function StrokeBands($aDepth, $aCSIM)
    {
        // Stroke bands
        if ($this->bands != null && !$aCSIM) {
            for ($i = 0; $i < safe_count($this->bands); ++$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 Stroke has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function Stroke($aImg, $aXLeft, $aYTop, $aXRight, $aYBottom, $aUseTextHeight = false)
    {
        if (!$this->iShow) {
            return;
        }
Severity: Minor
Found in src/graph/GanttActivityInfo.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

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

            if ($adj < 1) {
                $m = ($adj - 1.0) * max(255, max($r, max($g, $b)));

                return [max(0, $r + $m), max(0, $g + $m), max(0, $b + $m), $alpha];
            }
Severity: Major
Found in src/util/RGB.php and 1 other location - About 1 hr to fix
src/image/RGB.php on lines 546..550

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

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

            if ($adj < 1) {
                $m = ($adj - 1.0) * max(255, max($r, max($g, $b)));

                return [max(0, $r + $m), max(0, $g + $m), max(0, $b + $m), $alpha];
            }
Severity: Major
Found in src/image/RGB.php and 1 other location - About 1 hr to fix
src/util/RGB.php on lines 536..540

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

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

    public function Add3DSliceToCSIM($i, $xc, $yc, $height, $width, $thick, $sa, $ea)
    {
        //Slice number, ellipse centre (x,y), height, width, start angle, end angle

        $sa *= M_PI / 180;
Severity: Minor
Found in src/plot/PiePlot3D.php - About 1 hr to fix

    Method StrokeFullSliceFrame has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function StrokeFullSliceFrame($img, $xc, $yc, $sa, $ea, $w, $h, $z, $edgecolor, $exploderadius, $fulledge)
        {
            $step = 0.02;
    
            if ($exploderadius > 0) {
    Severity: Minor
    Found in src/plot/PiePlot3D.php - About 1 hr to fix

      Method CopyMerge has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function CopyMerge($fromImg, $toX, $toY, $fromX, $fromY, $toWidth, $toHeight, $fromWidth = -1, $fromHeight = -1, $aMix = 100)
          {
              if ($aMix == 100) {
                  $this->CopyCanvasH(
                      $this->img,
      Severity: Minor
      Found in src/image/Image.php - About 1 hr to fix

        Method GetBBoxTTF has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function GetBBoxTTF($aTxt, $aAngle = 0)
            {
                // Normalize the bounding box to become a minimum
                // enscribing rectangle
        
        
        Severity: Minor
        Found in src/image/Image.php - About 1 hr to fix

          Method LoadBkgImage has 38 lines of code (exceeds 25 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 1 hr to fix

            Method StrokeBoxedText2 has 12 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $x,
                    $y,
                    $txt,
                    $dir = 0,
                    $fcolor = 'white',
            Severity: Major
            Found in src/image/Image.php - About 1 hr to fix

              Method StrokeBoxedText has 12 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $x,
                      $y,
                      $txt,
                      $dir = 0,
                      $fcolor = 'white',
              Severity: Major
              Found in src/image/Image.php - About 1 hr to fix

                The class Ticks has 22 fields. Consider redesigning Ticks to keep the number of fields under 15.
                Open

                class Ticks
                {
                    public $label_formatstr         = ''; // C-style format string to use for labels
                    public $label_formfunc          = '';
                    public $label_dateformatstr     = '';
                Severity: Minor
                Found in src/graph/Ticks.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class WindrosePlotScale has 20 fields. Consider redesigning WindrosePlotScale to keep the number of fields under 15.
                Open

                class WindrosePlotScale
                {
                    private $iMax;
                    private $iDelta          = 5;
                    private $iNumCirc        = 3;
                Severity: Minor
                Found in src/graph/WindrosePlotScale.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class Image has 42 fields. Consider redesigning Image to keep the number of fields under 15.
                Open

                class Image
                {
                    public $img;
                    public $rgb;
                    public $img_format;
                Severity: Minor
                Found in src/image/Image.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class ImgData_Balls has 17 fields. Consider redesigning ImgData_Balls to keep the number of fields under 15.
                Open

                class ImgData_Balls extends ImgData
                {
                    protected $name = 'Round Balls';
                    protected $an   = [MARK_IMG_LBALL     => 'imgdata_large',
                        MARK_IMG_MBALL                    => 'imgdata_small',
                Severity: Minor
                Found in src/image/ImgData_Balls.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class AxisPrototype has 29 fields. Consider redesigning AxisPrototype to keep the number of fields under 15.
                Open

                class AxisPrototype
                {
                    public $scale;
                    public $img;
                    public $hide        = false;
                Severity: Minor
                Found in src/graph/AxisPrototype.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class GanttActivityInfo has 18 fields. Consider redesigning GanttActivityInfo to keep the number of fields under 15.
                Open

                class GanttActivityInfo
                {
                    public $iShow            = true;
                    public $iLeftColMargin   = 4;
                    public $iRightColMargin  = 1;
                Severity: Minor
                Found in src/graph/GanttActivityInfo.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class GanttScale has 27 fields. Consider redesigning GanttScale to keep the number of fields under 15.
                Open

                class GanttScale
                {
                    public $minute;
                    public $hour;
                    public $day;
                Severity: Minor
                Found in src/graph/GanttScale.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                The class Graph has 120 fields. Consider redesigning Graph to keep the number of fields under 15.
                Open

                class Graph
                {
                    public $gDateLocale;
                    public $gJpgDateLocale;
                    public $cache; // Cache object (singleton)
                Severity: Minor
                Found in src/graph/Graph.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

                Source https://phpmd.org/rules/codesize.html#toomanyfields

                Severity
                Category
                Status
                Source
                Language