mambax7/pedigree

View on GitHub

Showing 702 of 1,100 total issues

Function URLreadFsock has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public static function URLreadFsock($host, $file, &$errstr, $successonly = true, $port = -1, $timeout = 10)
    {
        if (!function_exists('fsockopen') || self::FunctionIsDisabled('fsockopen')) {
            $errstr = 'URLreadFsock says: function fsockopen() unavailable';
            return false;
Severity: Minor
Found in phpthumb/phpthumb.functions.php - About 3 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 HistogramStretch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function HistogramStretch(&$gdimg, $band = '*', $method = 0, $threshold = 0.1)
    {
        // equivalent of "Auto Contrast" in Adobe Photoshop
        // method 0 stretches according to RGB colors. Gives a more conservative stretch.
        // method 1 band stretches according to grayscale which is color-biased (59% green, 30% red, 11% blue). May give a punchier / more aggressive stretch, possibly appearing over-saturated
Severity: Minor
Found in phpthumb/phpthumb.filters.php - About 3 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 pups has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function pups($oid, $gender)
    {
        global $numofcolumns, $nummatch, $pages, $columns, $dogs;
        $content = '';

Severity: Major
Found in class/Utility.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                    if (
    
                        // aspect ratio needs to be preserved AND
                        ($this->preserve_aspect_ratio || isset($auto_preserve_aspect_ratio))
                        && // both width and height are given
    Severity: Critical
    Found in library/Zebra_Image.php - About 3 hrs to fix

      pedigreeUtilities0 has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class pedigreeUtilities0
      {
          /**
           * Function responsible for checking if a directory exists, we can also write in and create an index.html file
           *
      Severity: Minor
      Found in 0old/pedigreeUtilities0.php - About 3 hrs to fix

        Method ErrorImage has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function ErrorImage($text, $width = 0, $height = 0, $forcedisplay = false)
            {
                $width  = ($width ?: $this->config_error_image_width);
                $height = ($height ?: $this->config_error_image_height);
        
        
        Severity: Major
        Found in 0old/phpthumb/phpthumb.class.php - About 3 hrs to fix

          Method pups has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function pups($oid, $gender)
          {
              global $numofcolumns, $numMatch, $pages, $columns, $dogs;
              $content = '';
              if (0 == $gender) {
          Severity: Major
          Found in include/functions.php - About 3 hrs to fix

            Method pups has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function pups($oid, $gender)
                {
                    global $numofcolumns, $numMatch, $pages, $columns, $dogs;
                    $content = '';
                    if (0 == $gender) {
            Severity: Major
            Found in 0old/pedigreeUtilities0.php - About 3 hrs to fix

              Method ErrorImage has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function ErrorImage($text, $width = 0, $height = 0, $forcedisplay = false)
                  {
                      $width  = ($width ? $width : $this->config_error_image_width);
                      $height = ($height ? $height : $this->config_error_image_height);
              
              
              Severity: Major
              Found in phpthumb/phpthumb.class.php - About 3 hrs to fix

                Function applyPathSegment has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function applyPathSegment(&$segments, $segment)
                    {
                        if ('.' === $segment) {
                            return; // always remove
                        }
                Severity: Minor
                Found in 0old/phpthumb/phpthumb.class.php - About 3 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 setCacheDirectory has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setCacheDirectory()
                    {
                        // resolve cache directory to absolute pathname
                        $this->DebugMessage('setCacheDirectory() starting with config_cache_directory = "' . $this->config_cache_directory . '"', __FILE__, __LINE__);
                        if ('.' === mb_substr($this->config_cache_directory, 0, 1)) {
                Severity: Minor
                Found in 0old/phpthumb/phpthumb.class.php - About 3 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 AntiOffsiteLinking has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function AntiOffsiteLinking()
                    {
                        // Optional anti-offsite hijacking of the thumbnail script
                        $allow = true;
                        if ($allow && $this->config_nooffsitelink_enabled
                Severity: Minor
                Found in 0old/phpthumb/phpthumb.class.php - About 3 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 setOutputFormat has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setOutputFormat()
                    {
                        static $alreadyCalled = false;
                        if ($this->thumbnailFormat && $alreadyCalled) {
                            return true;
                Severity: Minor
                Found in 0old/phpthumb/phpthumb.class.php - About 3 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 applyPathSegment has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function applyPathSegment(&$segments, $segment)
                    {
                        if ($segment == '.') {
                            return; // always remove
                        }
                Severity: Minor
                Found in phpthumb/phpthumb.class.php - About 3 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 ImageCropAuto has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function ImageCropAuto()
                    {
                        // ImageCropAuto
                        if (!is_null($this->ica)) {
                            $this->DebugMessage('ImageCropAuto(' . $this->ica . ') starting', __FILE__, __LINE__);
                Severity: Minor
                Found in phpthumb/phpthumb.class.php - About 3 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 OutputThumbnail has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function OutputThumbnail()
                    {
                        $this->purgeTempFiles();
                
                        if (!$this->useRawIMoutput && !is_resource($this->gdimg_output)) {
                Severity: Major
                Found in 0old/phpthumb/phpthumb.class.php - About 3 hrs to fix

                  Method GD2ICOstring has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function GD2ICOstring(&$gd_image_array)
                      {
                          $ImageWidths  = [];
                          $ImageHeights = [];
                          $bpp          = [];
                  Severity: Major
                  Found in phpthumb/phpthumb.ico.php - About 3 hrs to fix

                    Function initZoom has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            initZoom: function() {
                                var zoomSt = mfp.st.zoom,
                                    ns = '.zoom',
                                    image;
                    
                    
                    Severity: Major
                    Found in assets/js/jquery.magnific-popup.js - About 3 hrs to fix

                      Method createList has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function createList($result, $prefix, $link, $element)
                          {
                              $helper = XoopsModules\Pedigree\Helper::getInstance();
                              require_once $helper->path('include/common.php');
                      
                      
                      Severity: Major
                      Found in class/Utility.php - About 3 hrs to fix

                        Function getImage has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                getImage: function(item, template) {
                        
                                    var guard = 0,
                        
                                        // image load complete handler
                        Severity: Major
                        Found in assets/js/jquery.magnific-popup.js - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language