HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

    public function __get($name)
    {
        if (strpos($name, 'raw_') !== false) {
            // if $name == 'raw_left_margin' , return $this->_left_margin;
            $variable_name = '_' . str_replace('raw_', '', $name);
Severity: Major
Found in src/image/Image.php and 1 other location - About 1 hr to fix
src/text/Text.php on lines 393..408

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

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

    public function __get($name)
    {
        if (strpos($name, 'raw_') !== false) {
            // if $name == 'raw_left_margin' , return $this->_left_margin;
            $variable_name = '_' . str_replace('raw_', '', $name);
Severity: Major
Found in src/text/Text.php and 1 other location - About 1 hr to fix
src/image/Image.php on lines 2129..2144

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

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

    public function Stroke($aImg, $aXScale, $aYScale)
    {
        assert($this->prect != null);
        if ($this->dir == HORIZONTAL) {
            if ($this->min === 'min') {
Severity: Minor
Found in src/plot/PlotBand.php - About 1 hr to fix

    Method IntCalcTicks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function IntCalcTicks($maxsteps, $min, $max, $a, $majend = true)
        {
            $diff = $max - $min;
            if ($diff == 0) {
                Util\JpGraphError::RaiseL(25075); //('Can\'t automatically determine ticks since min==max.');
    Severity: Minor
    Found in src/graph/LinearScale.php - About 1 hr to fix

      Method GetXMinMax has 36 lines of code (exceeds 25 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

        Method _doManualTickPos has 36 lines of code (exceeds 25 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

          Method doAutoScaleYAxis has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function doAutoScaleYAxis()
              {
                  //Check if we should autoscale y-axis
                  if (!$this->yscale->IsSpecified() && safe_count($this->plots) > 0) {
                      list($min, $max) = $this->GetPlotsYMinMax($this->plots);
          Severity: Minor
          Found in src/graph/Graph.php - About 1 hr to fix

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

                    $this->iBuiltinIcon[12][1] =
                        'iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlz' .
                        'AAALDwAACw8BkvkDpQAAAAd0SU1FB9ECDAcjDeD3lKsAAAZ2SURBVHicrZhPaFzHHcc/897s7lutJCsr2VHsOHWMk0MPbsBUrcnF' .
                        'OFRdSo6FNhdB6SGHlpDmYtJCDyoxyKe6EBxKQkt7KKL0T6ABo0NbciqigtC6PhWKI2NFqqxdSd7V2/dmftPDvPd212t55dCBYfbN' .
                        'zpvfZ77z+/1mdhUjytWrV93Hf/24eD5z9gwiMlDjOKbb7dLtdhER2u02u7u73Lp1CxEZBw4AeZwdNQqkMd9wbziFGINJUt6rRbz5' .
            Severity: Major
            Found in src/image/PredefIcons.php and 1 other location - About 1 hr to fix
            src/image/ImgData_PushPins.php on lines 478..502

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

            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

                    $this->imgdata_small[3][1] =
                        'iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAACi1' .
                        'BMVEX///8AAAAAADMAAGYAAJkAAMwAAP8zAAAzADMzAGYzAJkz' .
                        'AMwzAP9mAABmADNmAGZmAJlmAMxmAP+ZAACZADOZAGaZAJmZAM' .
                        'yZAP/MAADMADPMAGbMAJnMAMzMAP//AAD/ADP/AGb/AJn/AMz/' .
            Severity: Major
            Found in src/image/ImgData_PushPins.php and 1 other location - About 1 hr to fix
            src/image/PredefIcons.php on lines 287..311

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

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

                public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea)
                {
                    //Slice number, ellipse centre (x,y), height, width, start angle, end angle
                    while ($sa > 2 * M_PI) {
                        $sa = $sa - 2 * M_PI;
            Severity: Minor
            Found in src/plot/PiePlot.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 Add3DSliceToCSIM has a Cognitive Complexity of 12 (exceeds 5 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

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

                public function Set($aLocale)
                {
                    if (in_array($aLocale, array_keys($this->iDayAbb), true)) {
                        $this->iLocale = $aLocale;
            
            
            Severity: Minor
            Found in src/util/DateLocale.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 Stream has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function Stream($aFile = '')
                {
                    $this->DoSupersampling();
            
                    $func = 'image' . $this->img_format;
            Severity: Minor
            Found in src/image/Image.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 SetLineStyle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function SetLineStyle($s)
                {
                    if (is_numeric($s)) {
                        if ($s < 1 || $s > 4) {
                            Util\JpGraphError::RaiseL(25101, $s); //(" Illegal numeric argument to SetLineStyle(): ($s)");
            Severity: Minor
            Found in src/image/Image.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 _autoSizeTable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _autoSizeTable($aImg)
                {
                    // Get maximum column width and row height
                    $m = $this->iSize[0];
                    $n = $this->iSize[1];
            Severity: Minor
            Found in src/text/GTextTable.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 Raise has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function Raise($aMsg, $aHalt = false)
                {
                    if ($this->iDest != '') {
                        if ($this->iDest == 'syslog') {
                            error_log($this->iTitle . $aMsg);
            Severity: Minor
            Found in src/util/JpGraphErrObject.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 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function Stroke($img, $grid)
                {
                    if (!$this->show) {
                        return;
                    }
            Severity: Minor
            Found in src/graph/RadarGrid.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 DisplayClientSideaImageMapAreas has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function DisplayClientSideaImageMapAreas()
                {
                    // Debug stuff - display the outline of the image map areas
                    $csim = '';
                    foreach ($this->plots as $p) {
            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 GetPlotsYMinMax has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function GetPlotsYMinMax($bPlots)
                {
                    $aPlots = array_filter($bPlots, function ($plot) {
                        //\Kint::dump($plot, $plot instanceof Plot\Plot);
                        return $plot instanceof Plot\Plot;
            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 AutoScale has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function AutoScale($img, $min, $max, $maxsteps, $majend = true)
                {
                    if ($min == 0) {
                        $min = 1;
                    }
            Severity: Minor
            Found in src/graph/LogScale.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

            Severity
            Category
            Status
            Source
            Language