mambax7/pedigree

View on GitHub
coi.php

Summary

Maintainability
F
1 wk
Test Coverage

File coi.php has 922 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 You may not change or alter any portion of this comment or credits of
 supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit
Severity: Major
Found in coi.php - About 2 days to fix

    Function boucle has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    function boucle($nb_gen, $nloop)
    {
        global $fathers, $mothers, $nbanims, $listing, $nl, $IDs;
        $nbtot   = 0;
        $listing = '';
    Severity: Minor
    Found in coi.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 GENEALOGY has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    function GENEALOGY()
    {
        global $IDs, $fathers, $mothers, $inds, $nb_gen, $nb_maxi, $nbani, $nl, $sql1;
        $impr       = 0;
        $fathers[0] = $IDs[1];
    Severity: Minor
    Found in coi.php - About 5 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 chrono_sort has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    function chrono_sort()
    {
        global $IDs, $inds, $fathers, $mothers, $chrono, $nl, $detail;
        $impr  = 0;
        $modif = 1;
    Severity: Minor
    Found in coi.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 GENEALOGY has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function GENEALOGY()
    {
        global $IDs, $fathers, $mothers, $inds, $nb_gen, $nb_maxi, $nbani, $nl, $sql1;
        $impr       = 0;
        $fathers[0] = $IDs[1];
    Severity: Major
    Found in coi.php - About 2 hrs to fix

      Function calc_dist has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function calc_dist() /* Common Ascendants and their distances */
      {
          global $IDs, $fathers, $mothers, $nbanims, $pater, $mater, $empty, $nb_gen, $nl;
          global $dmax, $detail, $nb_gen;
          $distan = [];
      Severity: Minor
      Found in coi.php - About 2 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 dist_p has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      function dist_p($p)
      {
          global $IDs, $fathers, $mothers, $pater, $nb_gen, $detail, $nl;
          // Anim #P is the sire
          $listall   = [$p];
      Severity: Minor
      Found in coi.php - About 2 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 dist_m has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      function dist_m($m)
      {
          global $IDs, $fathers, $mothers, $mater, $nb_gen, $detail, $nl;
          // Anim #M is the dam
          $listall   = [$m];
      Severity: Minor
      Found in coi.php - About 2 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 boucle has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function boucle($nb_gen, $nloop)
      {
          global $fathers, $mothers, $nbanims, $listing, $nl, $IDs;
          $nbtot   = 0;
          $listing = '';
      Severity: Minor
      Found in coi.php - About 1 hr to fix

        Method chrono_sort has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function chrono_sort()
        {
            global $IDs, $inds, $fathers, $mothers, $chrono, $nl, $detail;
            $impr  = 0;
            $modif = 1;
        Severity: Minor
        Found in coi.php - About 1 hr to fix

          Function mater_side has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function mater_side($p, $m, $a, $ndist)
          {
              global $fathers, $mothers, $marked, $COIs, $deltaf, $ICknown, $verbose, $nl, $chrono, $paternal_rank, $max_dist;
              if (!$m || $ndist > $max_dist) {
                  return 0;
          Severity: Minor
          Found in coi.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

          Method calc_dist has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function calc_dist() /* Common Ascendants and their distances */
          {
              global $IDs, $fathers, $mothers, $nbanims, $pater, $mater, $empty, $nb_gen, $nl;
              global $dmax, $detail, $nb_gen;
              $distan = [];
          Severity: Minor
          Found in coi.php - About 1 hr to fix

            Method SKETCH_PEDIGREE has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function SKETCH_PEDIGREE()
            {
                global $nl, $detail, $depth, $IDs;
                // print_r ($IDs) ;
                echo $nl
            Severity: Minor
            Found in coi.php - About 1 hr to fix

              Function output_animal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function output_animal($ind, $gen, $class)
              {
                  global $depth, $IDs, $fathers, $mothers, $nl;
                  if ($gen > $depth) {
                      return 0;
              Severity: Minor
              Found in coi.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

              Method dist_m has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function dist_m($m)
              {
                  global $IDs, $fathers, $mothers, $mater, $nb_gen, $detail, $nl;
                  // Anim #M is the dam
                  $listall   = [$m];
              Severity: Minor
              Found in coi.php - About 1 hr to fix

                Method dist_p has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function dist_p($p)
                {
                    global $IDs, $fathers, $mothers, $pater, $nb_gen, $detail, $nl;
                    // Anim #P is the sire
                    $listall   = [$p];
                Severity: Minor
                Found in coi.php - About 1 hr to fix

                  Method CONSANG has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function CONSANG($a)
                  {
                      global $fathers, $mothers, $ICknown, $COIs, $nl;
                      if (!$a || $ICknown[$a]) {
                          return 0;
                  Severity: Minor
                  Found in coi.php - About 1 hr to fix

                    Method output_animal has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function output_animal($ind, $gen, $class)
                    {
                        global $depth, $IDs, $fathers, $mothers, $nl;
                        if ($gen > $depth) {
                            return 0;
                    Severity: Minor
                    Found in coi.php - About 1 hr to fix

                      Function CONSANG has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function CONSANG($a)
                      {
                          global $fathers, $mothers, $ICknown, $COIs, $nl;
                          if (!$a || $ICknown[$a]) {
                              return 0;
                      Severity: Minor
                      Found in coi.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

                      Method one_animal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function one_animal($ID)
                      {
                          global $xoopsDB;
                          global $sex, $val, $sosa, $detail, $sql3;
                          $content = '';
                      Severity: Minor
                      Found in coi.php - About 1 hr to fix

                        Function add_multi has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function add_multi($ch, $niv)
                        {
                            global $implx, $couls, $nl;
                            reset($implx);
                            $first = 1;
                        Severity: Minor
                        Found in coi.php - About 55 mins 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 count_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function count_all($ind, $gen)
                        {
                            global $inds, $nb_gen, $nb_all, $fathers, $mothers;
                            if ($ind) {
                                ++$nb_all;
                        Severity: Minor
                        Found in coi.php - About 25 mins 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 SKETCH_PEDIGREE has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function SKETCH_PEDIGREE()
                        {
                            global $nl, $detail, $depth, $IDs;
                            // print_r ($IDs) ;
                            echo $nl
                        Severity: Minor
                        Found in coi.php - About 25 mins 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

                                    if (false !== ($d = $mothers[$i])) {
                                        if (!$list[$d]) {
                                            $new = 1;
                                            if ($j < $nb_gen) {
                                                ++$nbtot;
                        Severity: Major
                        Found in coi.php and 1 other location - About 1 hr to fix
                        coi.php on lines 697..711

                        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

                                    if (false !== ($s = $fathers[$i])) {
                                        if (!$list[$s]) {
                                            $new = 1;
                                            if ($j < $nb_gen) {
                                                ++$nbtot;
                        Severity: Major
                        Found in coi.php and 1 other location - About 1 hr to fix
                        coi.php on lines 712..726

                        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

                        There are no issues that match your filters.

                        Category
                        Status