HuasoFoundries/jpgraph

View on GitHub

Showing 6,805 of 6,805 total issues

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

    public function __construct()
    {
        self::$FONT_BASEPATH = getenv('JPGRAPH_FONT_BASEPATH') ?
        getenv('JPGRAPH_FONT_BASEPATH') :
        dirname(__DIR__) . '/fonts/';
Severity: Major
Found in src/text/TTF.php - About 7 hrs to fix

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

        public function Stroke($aImg, $aScale)
        {
            $factory = new Graph\RectPatternFactory();
            $prect   = $factory->Create($this->iPattern, $this->iPatternColor);
            $prect->SetDensity($this->iPatternDensity);
    Severity: Minor
    Found in src/plot/GanttBar.php - About 7 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 49 (exceeds 5 allowed). Consider refactoring.
    Open

        public function Stroke($aImg, $aX, $aY)
        {
            if ($this->iShow) {
                $aImg->SetColor($this->iColor);
                $aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
    Severity: Minor
    Found in src/text/TextProperty.php - About 7 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 StrokeTitles has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

        public function StrokeTitles()
        {
            $margin = 3;
    
            if ($this->titlebackground) {
    Severity: Minor
    Found in src/graph/Graph.php - About 7 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 AutoSize has 186 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function AutoSize()
        {
            if ($this->img->img == null) {
                // The predefined left, right, top, bottom margins.
                // Note that the top margin might incease depending on
    Severity: Major
    Found in src/graph/GanttGraph.php - About 7 hrs to fix

      Function FilledRectangle has a Cognitive Complexity of 48 (exceeds 5 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: Minor
      Found in src/plot/Gradient.php - About 7 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 _StrokeTTF has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _StrokeTTF($x, $y, $txt, $dir, $paragraph_align, &$aBoundingBox, $debug = false)
          {
              // Setup default inter line margin for paragraphs to be
              // 3% of the font height.
              $ConstLineSpacing = 0.03;
      Severity: Minor
      Found in src/image/Image.php - About 7 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

      File GTextTableCell.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * JPGraph v4.0.3
       */
      Severity: Minor
      Found in src/text/GTextTableCell.php - About 7 hrs to fix

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

            public function GetTextsYMinMax($aY2 = false)
            {
                if ($aY2) {
                    $txts = $this->y2texts;
                } else {
        Severity: Major
        Found in src/graph/Graph.php and 1 other location - About 7 hrs to fix
        src/graph/Graph.php on lines 1107..1132

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

        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 GetTextsXMinMax($aY2 = false)
            {
                if ($aY2) {
                    $txts = $this->y2texts;
                } else {
        Severity: Major
        Found in src/graph/Graph.php and 1 other location - About 7 hrs to fix
        src/graph/Graph.php on lines 1080..1105

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

        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 static function GetSpectrum($aVal, $aDynamicRange = 1.0)
            {
                if ($aVal < 0 || $aVal > 1.0001) {
                    return [0, 0, 0]; // Invalid case - just return black
                }
        Severity: Major
        Found in src/image/RGB.php and 1 other location - About 7 hrs to fix
        src/util/RGB.php on lines 608..627

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

        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 static function GetSpectrum($aVal, $aDynamicRange = 1.0)
            {
                if ($aVal < 0 || $aVal > 1.0001) {
                    return [0, 0, 0]; // Invalid case - just return black
                }
        Severity: Major
        Found in src/util/RGB.php and 1 other location - About 7 hrs to fix
        src/image/RGB.php on lines 618..637

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

        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

        File ImgData_PushPins.php has 463 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * JPGraph v4.0.3
         */
        Severity: Minor
        Found in src/image/ImgData_PushPins.php - About 7 hrs to fix

          Method Stroke has 176 lines of code (exceeds 25 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: Major
          Found in src/graph/Graph.php - About 7 hrs to fix

            Function PutAndStream has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
            Open

                public function PutAndStream($aImage, $aCacheFileName, $aInline, $aStrokeFileName)
                {
                    // Check if we should always stroke the image to a file
                    if (_FORCE_IMGTOFILE) {
                        $aStrokeFileName = _FORCE_IMGDIR . Util\Helper::GenImgName();
            Severity: Minor
            Found in src/image/ImgStreamCache.php - About 6 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 doMonthly has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function doMonthly($aType, $aMinor = false)
                {
                    $monthcount = 0;
                    $m          = self::$startmonth;
                    $y          = self::$startyear;
            Severity: Minor
            Found in src/util/DateScaleUtils.php - About 6 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 StrokeMinutes has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
            Open

                public function StrokeMinutes($aYCoord, $getHeight = false)
                {
                    $img = $this->iImg;
                    $xt  = $img->left_margin + $this->iLabelWidth;
                    $yt  = $aYCoord + $img->top_margin;
            Severity: Minor
            Found in src/graph/GanttScale.php - About 6 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 StrokeAngleLabels has 168 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function StrokeAngleLabels($pos, $type)
                {
                    if (!$this->show_angle_label) {
                        return;
                    }
            Severity: Major
            Found in src/graph/PolarAxis.php - About 6 hrs to fix

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

              <?php
              
              /**
               * JPGraph v4.0.3
               */
              Severity: Major
              Found in src/graph/RectPatternDiagCross.php and 1 other location - About 6 hrs to fix
              src/graph/RectPatternCross.php on lines 1..49

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

              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

              <?php
              
              /**
               * JPGraph v4.0.3
               */
              Severity: Major
              Found in src/graph/RectPatternCross.php and 1 other location - About 6 hrs to fix
              src/graph/RectPatternDiagCross.php on lines 1..49

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

              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